class WXDLLIMPEXP_RICHTEXT wxRichTextListStyleDefinition;
class WXDLLIMPEXP_RICHTEXT wxRichTextEvent;
class WXDLLIMPEXP_RICHTEXT wxRichTextRenderer;
+class WXDLLIMPEXP_RICHTEXT wxRichTextBuffer;
/*!
* Flags determining the available space, passed to Layout
// the rect passed to Layout.
#define wxRICHTEXT_LAYOUT_SPECIFIED_RECT 0x10
+/*!
+ * Flags to pass to Draw
+ */
+
+// Ignore paragraph cache optimization, e.g. for printing purposes
+// where one line may be drawn higher (on the next page) compared
+// with the previous line
+#define wxRICHTEXT_DRAW_IGNORE_CACHE 0x01
+
/*!
* Flags returned from hit-testing
*/
#define wxTEXT_ATTR_BULLET_TEXT 0x00080000
#define wxTEXT_ATTR_BULLET_NAME 0x00100000
#define wxTEXT_ATTR_URL 0x00200000
+#define wxTEXT_ATTR_PAGE_BREAK 0x00400000
/*!
* Styles for wxTextAttrEx::SetBulletStyle
void SetBulletName(const wxString& name) { m_bulletName = name; SetFlags(GetFlags() | wxTEXT_ATTR_BULLET_NAME); }
void SetBulletFont(const wxString& bulletFont) { m_bulletFont = bulletFont; }
void SetURL(const wxString& url) { m_urlTarget = url; SetFlags(GetFlags() | wxTEXT_ATTR_URL); }
+ void SetPageBreak(bool pageBreak = true) { SetFlags(pageBreak ? (GetFlags() | wxTEXT_ATTR_PAGE_BREAK) : (GetFlags() & ~wxTEXT_ATTR_PAGE_BREAK)); }
const wxString& GetCharacterStyleName() const { return m_characterStyleName; }
const wxString& GetParagraphStyleName() const { return m_paragraphStyleName; }
bool HasBulletText() const { return HasFlag(wxTEXT_ATTR_BULLET_TEXT); }
bool HasBulletName() const { return HasFlag(wxTEXT_ATTR_BULLET_NAME); }
bool HasURL() const { return HasFlag(wxTEXT_ATTR_URL); }
+ bool HasPageBreak() const { return HasFlag(wxTEXT_ATTR_PAGE_BREAK); }
// Is this a character style?
bool IsCharacterStyle() const { return (0 != (GetFlags() & wxTEXT_ATTR_CHARACTER)); }
void SetBulletFont(const wxString& bulletFont) { m_bulletFont = bulletFont; }
void SetBulletName(const wxString& name) { m_bulletName = name; m_flags |= wxTEXT_ATTR_BULLET_NAME; }
void SetURL(const wxString& url) { m_urlTarget = url; m_flags |= wxTEXT_ATTR_URL; }
+ void SetPageBreak(bool pageBreak = true) { SetFlags(pageBreak ? (GetFlags() | wxTEXT_ATTR_PAGE_BREAK) : (GetFlags() & ~wxTEXT_ATTR_PAGE_BREAK)); }
const wxColour& GetTextColour() const { return m_colText; }
const wxColour& GetBackgroundColour() const { return m_colBack; }
bool HasBulletText() const { return (m_flags & wxTEXT_ATTR_BULLET_TEXT) != 0; }
bool HasBulletName() const { return (m_flags & wxTEXT_ATTR_BULLET_NAME) != 0; }
bool HasURL() const { return HasFlag(wxTEXT_ATTR_URL); }
+ bool HasPageBreak() const { return HasFlag(wxTEXT_ATTR_PAGE_BREAK); }
bool HasFlag(long flag) const { return (m_flags & flag) != 0; }
void SetDescent(int descent) { m_descent = descent; }
int GetDescent() const { return m_descent; }
+ /// Gets the containing buffer
+ wxRichTextBuffer* GetBuffer() const;
+
// Operations
/// Clone the object
void Reference() { m_refCount ++; }
void Dereference();
- /// Convert units in tends of a millimetre to device units
- static int ConvertTenthsMMToPixels(wxDC& dc, int units);
+ /// Convert units in tenths of a millimetre to device units
+ int ConvertTenthsMMToPixels(wxDC& dc, int units);
+ static int ConvertTenthsMMToPixels(int ppi, int units);
protected:
wxSize m_size;
// Constructors
wxRichTextParagraph(wxRichTextObject* parent = NULL, wxTextAttrEx* style = NULL);
- wxRichTextParagraph(const wxString& text, wxRichTextObject* parent = NULL, wxTextAttrEx* style = NULL);
+ wxRichTextParagraph(const wxString& text, wxRichTextObject* parent = NULL, wxTextAttrEx* paraStyle = NULL, wxTextAttrEx* charStyle = NULL);
virtual ~wxRichTextParagraph();
wxRichTextParagraph(const wxRichTextParagraph& obj): wxRichTextBox() { Copy(obj); }
// Constructors
wxRichTextImage(wxRichTextObject* parent = NULL): wxRichTextObject(parent) { }
- wxRichTextImage(const wxImage& image, wxRichTextObject* parent = NULL);
- wxRichTextImage(const wxRichTextImageBlock& imageBlock, wxRichTextObject* parent = NULL);
+ wxRichTextImage(const wxImage& image, wxRichTextObject* parent = NULL, wxTextAttrEx* charStyle = NULL);
+ wxRichTextImage(const wxRichTextImageBlock& imageBlock, wxRichTextObject* parent = NULL, wxTextAttrEx* charStyle = NULL);
wxRichTextImage(const wxRichTextImage& obj): wxRichTextObject() { Copy(obj); }
// Overrideables
/// Initialisation
void Init();
- /// Clears the buffer and resets the command processor
- virtual void Clear();
-
- /// The same as Clear, and adds an empty paragraph.
- virtual void Reset();
+ /// Clears the buffer, adds an empty paragraph, and clears the command processor.
+ virtual void ResetAndClearCommands();
/// Load a file
virtual bool LoadFile(const wxString& filename, int type = wxRICHTEXT_TYPE_ANY);
/// Factor to multiply by character height to get a reasonable bullet size
static float GetBulletProportion() { return sm_bulletProportion; }
static void SetBulletProportion(float prop) { sm_bulletProportion = prop; }
+
+ /// Scale factor for calculating dimensions
+ double GetScale() const { return m_scale; }
+ void SetScale(double scale) { m_scale = scale; }
+
protected:
/// Command processor
/// Factor to multiply by character height to get a reasonable bullet size
static float sm_bulletProportion;
+
+ /// Scaling factor in use: needed to calculate correct dimensions when printing
+ double m_scale;
};
/*!
bool Undo();
/// Update the control appearance
- void UpdateAppearance(long caretPosition, bool sendUpdateEvent = false);
+ void UpdateAppearance(long caretPosition, bool sendUpdateEvent = false,
+ wxArrayInt* optimizationLineCharPositions = NULL, wxArrayInt* optimizationLineYPositions = NULL);
/// Replace the buffer paragraphs with the given fragment.
void ApplyParagraphs(const wxRichTextParagraphLayoutBox& fragment);
WXDLLIMPEXP_RICHTEXT bool wxRichTextApplyStyle(wxTextAttrEx& destStyle, const wxTextAttrEx& style);
WXDLLIMPEXP_RICHTEXT bool wxRichTextApplyStyle(wxRichTextAttr& destStyle, const wxTextAttrEx& style);
WXDLLIMPEXP_RICHTEXT bool wxRichTextApplyStyle(wxTextAttrEx& destStyle, const wxRichTextAttr& style, wxRichTextAttr* compareWith = NULL);
+WXDLLIMPEXP_RICHTEXT bool wxRichTextApplyStyle(wxRichTextAttr& destStyle, const wxRichTextAttr& style, wxRichTextAttr* compareWith = NULL);
+
+/// Split into paragraph and character styles
+WXDLLIMPEXP_RICHTEXT bool wxRichTextSplitParaCharStyles(const wxTextAttrEx& style, wxTextAttrEx& parStyle, wxTextAttrEx& charStyle);
/// Compare tabs
WXDLLIMPEXP_RICHTEXT bool wxRichTextTabsEq(const wxArrayInt& tabs1, const wxArrayInt& tabs2);