From 4d6d8bf4fb93f77bfe7f259ab03a31d7a180a33b Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Fri, 10 Nov 2006 15:48:46 +0000 Subject: [PATCH] Added outline level Removed unnecessary wxRichTextAttr::CopyTo git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43277 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/richtextattr.tex | 34 ++++++ docs/latex/wx/textattrex.tex | 33 ++++++ include/wx/richtext/richtextbuffer.h | 16 ++- include/wx/richtext/richtextindentspage.h | 5 + src/richtext/richtextbuffer.cpp | 129 ++++++++++++++-------- src/richtext/richtextdialogs.pjd | 171 +++++++++++++++++++++++++----- src/richtext/richtextindentspage.cpp | 117 ++++++++++++++------ src/richtext/richtextxml.cpp | 10 ++ 8 files changed, 409 insertions(+), 106 deletions(-) diff --git a/docs/latex/wx/richtextattr.tex b/docs/latex/wx/richtextattr.tex index 2c3631d..2f1bcbd 100644 --- a/docs/latex/wx/richtextattr.tex +++ b/docs/latex/wx/richtextattr.tex @@ -80,6 +80,7 @@ for a text control. #define wxTEXT_ATTR_URL 0x00200000 #define wxTEXT_ATTR_PAGE_BREAK 0x00400000 #define wxTEXT_ATTR_EFFECTS 0x00800000 +#define wxTEXT_ATTR_OUTLINE_LEVEL 0x01000000 \end{verbatim} } @@ -297,6 +298,12 @@ wxTEXT\_ATTR\_LINE\_SPACING\_HALF, and wxTEXT\_ATTR\_LINE\_SPACING\_TWICE. Returns the name of the list style. +\membersection{wxRichTextAttr::GetOutlineLevel}\label{wxrichtextattrgetoutlinelevel} + +\constfunc{bool}{GetOutlineLevel}{\void} + +Returns the outline level. + \membersection{wxRichTextAttr::GetParagraphSpacingAfter}\label{wxrichtextattrgetparagraphspacingafter} \constfunc{int}{GetParagraphSpacingAfter}{\void} @@ -439,6 +446,12 @@ Returns \true if the attribute object specifies line spacing. Returns \true if the attribute object specifies a list style name. +\membersection{wxRichTextAttr::HasOutlineLevel}\label{wxrichtextattrhasoutlinelevel} + +\constfunc{bool}{HasOutlineLevel}{\void} + +Returns \true if the attribute object specifies an outline level. + \membersection{wxRichTextAttr::HasPageBreak}\label{wxrichtextattrhaspagebreak} \constfunc{bool}{HasPageBreak}{\void} @@ -487,12 +500,24 @@ Returns \true if the attribute object specifies tab stops. Returns \true if the attribute object specifies a text foreground colour. +\membersection{wxRichTextAttr::HasTextEffects}\label{wxrichtextattrhastexteffects} + +\constfunc{bool}{HasTextEffects}{\void} + +Returns \true if the attribute object specifies text effects. + \membersection{wxRichTextAttr::HasUnderlined}\label{wxrichtextattrhasunderlined} \constfunc{bool}{HasUnderlined}{\void} Returns \true if the attribute object specifies either underlining or no underlining. +\membersection{wxRichTextAttr::HasURL}\label{wxrichtextattrhasurl} + +\constfunc{bool}{HasURL}{\void} + +Returns \true if the attribute object specifies a URL. + \membersection{wxRichTextAttr::HasWeight}\label{wxrichtextattrhasweight} \constfunc{bool}{HasWeight}{\void} @@ -658,6 +683,7 @@ flags can be passed in a bitlist: #define wxTEXT_ATTR_URL 0x00200000 #define wxTEXT_ATTR_PAGE_BREAK 0x00400000 #define wxTEXT_ATTR_EFFECTS 0x00800000 +#define wxTEXT_ATTR_OUTLINE_LEVEL 0x01000000 \end{verbatim} } @@ -729,6 +755,14 @@ defined for convenience: Sets the list style name. +\membersection{wxRichTextAttr::SetOutlineLevel}\label{wxrichtextattrsetoutlinelevel} + +\func{void}{SetOutlineLevel}{\param{int}{ level}} + +Specifies the outline level. Zero represents normal text. At present, the outline level is +not used, but may be used in future for determining list levels and for applications +that need to store document structure information. + \membersection{wxRichTextAttr::SetPageBreak}\label{wxrichtextattrsetpagebreak} \func{void}{SetPageBreak}{\param{bool}{ pageBreak = true}} diff --git a/docs/latex/wx/textattrex.tex b/docs/latex/wx/textattrex.tex index 5c94102..f190f3b 100644 --- a/docs/latex/wx/textattrex.tex +++ b/docs/latex/wx/textattrex.tex @@ -83,6 +83,7 @@ for a text control. #define wxTEXT_ATTR_URL 0x00200000 #define wxTEXT_ATTR_PAGE_BREAK 0x00400000 #define wxTEXT_ATTR_EFFECTS 0x00800000 +#define wxTEXT_ATTR_OUTLINE_LEVEL 0x01000000 \end{verbatim} } @@ -220,6 +221,12 @@ wxTEXT\_ATTR\_LINE\_SPACING\_HALF, and wxTEXT\_ATTR\_LINE\_SPACING\_TWICE. Returns the name of the list style. +\membersection{wxTextAttrEx::GetOutlineLevel}\label{wxtextattrexgetoutlinelevel} + +\constfunc{bool}{GetOutlineLevel}{\void} + +Returns the outline level. + \membersection{wxTextAttrEx::GetParagraphSpacingAfter}\label{wxtextattrexgetparagraphspacingafter} \constfunc{int}{GetParagraphSpacingAfter}{\void} @@ -301,6 +308,12 @@ Returns \true if the attribute object specifies line spacing. Returns \true if the attribute object specifies a list style name. +\membersection{wxTextAttrEx::HasOutlineLevel}\label{wxtextattrexhasoutlinelevel} + +\constfunc{bool}{HasOutlineLevel}{\void} + +Returns \true if the attribute object specifies an outline level. + \membersection{wxTextAttrEx::HasPageBreak}\label{wxtextattrexhaspagebreak} \constfunc{bool}{HasPageBreak}{\void} @@ -325,6 +338,18 @@ Returns \true if the attribute object specifies spacing before a paragraph. Returns \true if the attribute object specifies a paragraph style name. +\membersection{wxTextAttrEx::HasTextEffects}\label{wxtextattrexhastexteffects} + +\constfunc{bool}{HasTextEffects}{\void} + +Returns \true if the attribute object specifies text effects. + +\membersection{wxTextAttrEx::HasURL}\label{wxtextattrexhasurl} + +\constfunc{bool}{HasURL}{\void} + +Returns \true if the attribute object specifies a URL. + \membersection{wxTextAttrEx::Init}\label{wxtextattrexinit} \func{void}{Init}{\void} @@ -436,6 +461,14 @@ defined for convenience: Sets the list style name. +\membersection{wxTextAttrEx::SetOutlineLevel}\label{wxtextattrexsetoutlinelevel} + +\func{void}{SetOutlineLevel}{\param{int}{ level}} + +Specifies the outline level. Zero represents normal text. At present, the outline level is +not used, but may be used in future for determining list levels and for applications +that need to store document structure information. + \membersection{wxTextAttrEx::SetPageBreak}\label{wxtextattrexsetpagebreak} \func{void}{SetPageBreak}{\param{bool}{ pageBreak = true}} diff --git a/include/wx/richtext/richtextbuffer.h b/include/wx/richtext/richtextbuffer.h index 8a1149d..c57f858 100644 --- a/include/wx/richtext/richtextbuffer.h +++ b/include/wx/richtext/richtextbuffer.h @@ -200,6 +200,7 @@ class WXDLLIMPEXP_RICHTEXT wxRichTextBuffer; #define wxTEXT_ATTR_URL 0x00200000 #define wxTEXT_ATTR_PAGE_BREAK 0x00400000 #define wxTEXT_ATTR_EFFECTS 0x00800000 +#define wxTEXT_ATTR_OUTLINE_LEVEL 0x01000000 /*! * Styles for wxTextAttrEx::SetBulletStyle @@ -256,7 +257,7 @@ class WXDLLIMPEXP_RICHTEXT wxRichTextBuffer; #define wxTEXT_ATTR_PARAGRAPH (wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_TABS|\ wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER|wxTEXT_ATTR_LINE_SPACING|\ wxTEXT_ATTR_BULLET_STYLE|wxTEXT_ATTR_BULLET_NUMBER|wxTEXT_ATTR_BULLET_TEXT|wxTEXT_ATTR_BULLET_NAME|\ - wxTEXT_ATTR_PARAGRAPH_STYLE_NAME|wxTEXT_ATTR_LIST_STYLE_NAME) + wxTEXT_ATTR_PARAGRAPH_STYLE_NAME|wxTEXT_ATTR_LIST_STYLE_NAME|wxTEXT_ATTR_OUTLINE_LEVEL) #define wxTEXT_ATTR_ALL (wxTEXT_ATTR_CHARACTER|wxTEXT_ATTR_PARAGRAPH) @@ -367,6 +368,7 @@ public: void SetPageBreak(bool pageBreak = true) { SetFlags(pageBreak ? (GetFlags() | wxTEXT_ATTR_PAGE_BREAK) : (GetFlags() & ~wxTEXT_ATTR_PAGE_BREAK)); } void SetTextEffects(int effects) { m_textEffects = effects; SetFlags(GetFlags() | wxTEXT_ATTR_EFFECTS); } void SetTextEffectFlags(int effects) { m_textEffectFlags = effects; } + void SetOutlineLevel(int level) { m_outlineLevel = level; SetFlags(GetFlags() | wxTEXT_ATTR_OUTLINE_LEVEL); } const wxString& GetCharacterStyleName() const { return m_characterStyleName; } const wxString& GetParagraphStyleName() const { return m_paragraphStyleName; } @@ -382,6 +384,7 @@ public: const wxString& GetURL() const { return m_urlTarget; } int GetTextEffects() const { return m_textEffects; } int GetTextEffectFlags() const { return m_textEffectFlags; } + int GetOutlineLevel() const { return m_outlineLevel; } bool HasWeight() const { return (GetFlags() & wxTEXT_ATTR_FONT_WEIGHT) != 0; } bool HasSize() const { return (GetFlags() & wxTEXT_ATTR_FONT_SIZE) != 0; } @@ -403,6 +406,7 @@ public: bool HasPageBreak() const { return HasFlag(wxTEXT_ATTR_PAGE_BREAK); } bool HasTextEffects() const { return HasFlag(wxTEXT_ATTR_EFFECTS); } bool HasTextEffect(int effect) const { return HasFlag(wxTEXT_ATTR_EFFECTS) && ((GetTextEffectFlags() & effect) != 0); } + bool HasOutlineLevel() const { return HasFlag(wxTEXT_ATTR_OUTLINE_LEVEL); } // Is this a character style? bool IsCharacterStyle() const { return (0 != (GetFlags() & wxTEXT_ATTR_CHARACTER)); } @@ -430,6 +434,7 @@ private: int m_bulletNumber; int m_textEffects; int m_textEffectFlags; + int m_outlineLevel; wxString m_bulletText; wxString m_bulletFont; wxString m_bulletName; @@ -479,9 +484,6 @@ public: // Making a wxTextAttrEx object. operator wxTextAttrEx () const ; - // Copy to a wxTextAttr - void CopyTo(wxTextAttrEx& attr) const; - // Create font from font attributes. wxFont CreateFont() const; @@ -519,6 +521,7 @@ public: void SetPageBreak(bool pageBreak = true) { SetFlags(pageBreak ? (GetFlags() | wxTEXT_ATTR_PAGE_BREAK) : (GetFlags() & ~wxTEXT_ATTR_PAGE_BREAK)); } void SetTextEffects(int effects) { m_textEffects = effects; SetFlags(GetFlags() | wxTEXT_ATTR_EFFECTS); } void SetTextEffectFlags(int effects) { m_textEffectFlags = effects; } + void SetOutlineLevel(int level) { m_outlineLevel = level; SetFlags(GetFlags() | wxTEXT_ATTR_OUTLINE_LEVEL); } const wxColour& GetTextColour() const { return m_colText; } const wxColour& GetBackgroundColour() const { return m_colBack; } @@ -549,6 +552,7 @@ public: const wxString& GetURL() const { return m_urlTarget; } int GetTextEffects() const { return m_textEffects; } int GetTextEffectFlags() const { return m_textEffectFlags; } + int GetOutlineLevel() const { return m_outlineLevel; } // accessors bool HasTextColour() const { return m_colText.Ok() && HasFlag(wxTEXT_ATTR_TEXT_COLOUR) ; } @@ -578,6 +582,7 @@ public: bool HasPageBreak() const { return HasFlag(wxTEXT_ATTR_PAGE_BREAK); } bool HasTextEffects() const { return HasFlag(wxTEXT_ATTR_EFFECTS); } bool HasTextEffect(int effect) const { return HasFlag(wxTEXT_ATTR_EFFECTS) && ((GetTextEffectFlags() & effect) != 0); } + bool HasOutlineLevel() const { return HasFlag(wxTEXT_ATTR_OUTLINE_LEVEL); } bool HasFlag(long flag) const { return (m_flags & flag) != 0; } @@ -616,6 +621,7 @@ private: int m_bulletNumber; int m_textEffects; int m_textEffectFlags; + int m_outlineLevel; wxString m_bulletText; wxString m_bulletFont; wxString m_bulletName; @@ -1136,7 +1142,7 @@ public: /// Set basic (overall) style virtual void SetBasicStyle(const wxTextAttrEx& style) { m_attributes = style; } - virtual void SetBasicStyle(const wxRichTextAttr& style) { style.CopyTo(m_attributes); } + virtual void SetBasicStyle(const wxRichTextAttr& style) { m_attributes = style; } /// Get basic (overall) style virtual const wxTextAttrEx& GetBasicStyle() const { return m_attributes; } diff --git a/include/wx/richtext/richtextindentspage.h b/include/wx/richtext/richtextindentspage.h index a999579..a801703 100644 --- a/include/wx/richtext/richtextindentspage.h +++ b/include/wx/richtext/richtextindentspage.h @@ -99,6 +99,9 @@ public: /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_RIGHT void OnIndentRightUpdated( wxCommandEvent& event ); + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_OUTLINELEVEL + void OnRichtextOutlinelevelSelected( wxCommandEvent& event ); + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_BEFORE void OnSpacingBeforeUpdated( wxCommandEvent& event ); @@ -131,6 +134,7 @@ public: wxTextCtrl* m_indentLeft; wxTextCtrl* m_indentLeftFirst; wxTextCtrl* m_indentRight; + wxComboBox* m_outlineLevelCtrl; wxTextCtrl* m_spacingBefore; wxTextCtrl* m_spacingAfter; wxComboBox* m_spacingLine; @@ -146,6 +150,7 @@ public: ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT = 10103, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT_FIRST = 10104, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_RIGHT = 10113, + ID_RICHTEXTINDENTSSPACINGPAGE_OUTLINELEVEL = 10105, ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_BEFORE = 10114, ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_AFTER = 10116, ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_LINE = 10115, diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index e361c51..fceaaf7 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -2261,6 +2261,21 @@ bool wxRichTextParagraphLayoutBox::CollectStyle(wxTextAttrEx& currentStyle, cons } } + if (style.HasOutlineLevel() && !wxHasStyle(multipleStyleAttributes, wxTEXT_ATTR_OUTLINE_LEVEL)) + { + if (currentStyle.HasOutlineLevel()) + { + if (currentStyle.GetOutlineLevel() != style.GetOutlineLevel()) + { + // Clash of style - mark as such + multipleStyleAttributes |= wxTEXT_ATTR_OUTLINE_LEVEL; + currentStyle.SetFlags(currentStyle.GetFlags() & ~wxTEXT_ATTR_OUTLINE_LEVEL); + } + } + else + currentStyle.SetOutlineLevel(style.GetOutlineLevel()); + } + return true; } @@ -5185,8 +5200,7 @@ bool wxRichTextBuffer::BeginCharacterStyle(const wxString& characterStyle) wxRichTextCharacterStyleDefinition* def = GetStyleSheet()->FindCharacterStyle(characterStyle); if (def) { - wxTextAttrEx attr; - def->GetStyle().CopyTo(attr); + wxTextAttrEx attr = def->GetStyle(); return BeginStyle(attr); } } @@ -5201,8 +5215,7 @@ bool wxRichTextBuffer::BeginParagraphStyle(const wxString& paragraphStyle) wxRichTextParagraphStyleDefinition* def = GetStyleSheet()->FindParagraphStyle(paragraphStyle); if (def) { - wxTextAttrEx attr; - def->GetStyle().CopyTo(attr); + wxTextAttrEx attr = def->GetStyle(); return BeginStyle(attr); } } @@ -5237,7 +5250,7 @@ bool wxRichTextBuffer::BeginURL(const wxString& url, const wxString& characterSt wxRichTextCharacterStyleDefinition* def = GetStyleSheet()->FindCharacterStyle(characterStyle); if (def) { - def->GetStyle().CopyTo(attr); + attr = def->GetStyle(); } } attr.SetURL(url); @@ -6400,6 +6413,7 @@ bool wxTextAttrEq(const wxTextAttrEx& attr1, const wxRichTextAttr& attr2) attr1.GetBulletText() == attr2.GetBulletText() && attr1.GetBulletName() == attr2.GetBulletName() && attr1.GetBulletFont() == attr2.GetBulletFont() && + attr1.GetOutlineLevel() == attr2.GetOutlineLevel() && attr1.GetCharacterStyleName() == attr2.GetCharacterStyleName() && attr1.GetParagraphStyleName() == attr2.GetParagraphStyleName() && attr1.GetListStyleName() == attr2.GetListStyleName() && @@ -6504,6 +6518,10 @@ bool wxTextAttrEqPartial(const wxTextAttrEx& attr1, const wxTextAttrEx& attr2, i return false; } + if ((flags & wxTEXT_ATTR_OUTLINE_LEVEL) && + (attr1.GetOutlineLevel() != attr2.GetOutlineLevel())) + return false; + return true; } @@ -6606,6 +6624,10 @@ bool wxTextAttrEqPartial(const wxTextAttrEx& attr1, const wxRichTextAttr& attr2, return false; } + if ((flags & wxTEXT_ATTR_OUTLINE_LEVEL) && + (attr1.GetOutlineLevel() != attr2.GetOutlineLevel())) + return false; + return true; } @@ -6745,13 +6767,15 @@ bool wxRichTextApplyStyle(wxTextAttrEx& destStyle, const wxTextAttrEx& style) destStyle.SetTextEffectFlags(destFlags); } + if (style.HasOutlineLevel()) + destStyle.SetOutlineLevel(style.GetOutlineLevel()); + return true; } bool wxRichTextApplyStyle(wxRichTextAttr& destStyle, const wxTextAttrEx& style) { - wxTextAttrEx destStyle2; - destStyle.CopyTo(destStyle2); + wxTextAttrEx destStyle2 = destStyle; wxRichTextApplyStyle(destStyle2, style); destStyle = destStyle2; return true; @@ -6982,6 +7006,12 @@ bool wxRichTextApplyStyle(wxTextAttrEx& destStyle, const wxRichTextAttr& style, } } + if (style.HasOutlineLevel()) + { + if (!(compareWith && compareWith->HasOutlineLevel() && compareWith->GetOutlineLevel() == style.GetOutlineLevel())) + destStyle.SetOutlineLevel(style.GetOutlineLevel()); + } + return true; } @@ -7137,6 +7167,7 @@ void wxRichTextAttr::Init() m_bulletStyle = wxTEXT_ATTR_BULLET_STYLE_NONE; m_textEffects = wxTEXT_ATTR_EFFECT_NONE; m_textEffectFlags = wxTEXT_ATTR_EFFECT_NONE; + m_outlineLevel = 0; m_bulletNumber = 0; } @@ -7171,6 +7202,7 @@ void wxRichTextAttr::Copy(const wxRichTextAttr& attr) m_bulletText = attr.m_bulletText; m_bulletFont = attr.m_bulletFont; m_bulletName = attr.m_bulletName; + m_outlineLevel = attr.m_outlineLevel; m_urlTarget = attr.m_urlTarget; } @@ -7207,6 +7239,7 @@ void wxRichTextAttr::operator= (const wxTextAttrEx& attr) m_bulletText = attr.GetBulletText(); m_bulletName = attr.GetBulletName(); m_bulletFont = attr.GetBulletFont(); + m_outlineLevel = attr.GetOutlineLevel(); m_urlTarget = attr.GetURL(); @@ -7218,7 +7251,32 @@ void wxRichTextAttr::operator= (const wxTextAttrEx& attr) wxRichTextAttr::operator wxTextAttrEx () const { wxTextAttrEx attr; - CopyTo(attr); + attr.SetTextColour(GetTextColour()); + attr.SetBackgroundColour(GetBackgroundColour()); + attr.SetAlignment(GetAlignment()); + attr.SetTabs(GetTabs()); + attr.SetLeftIndent(GetLeftIndent(), GetLeftSubIndent()); + attr.SetRightIndent(GetRightIndent()); + attr.SetFont(CreateFont()); + + attr.SetParagraphSpacingAfter(m_paragraphSpacingAfter); + attr.SetParagraphSpacingBefore(m_paragraphSpacingBefore); + attr.SetLineSpacing(m_lineSpacing); + attr.SetBulletStyle(m_bulletStyle); + attr.SetBulletNumber(m_bulletNumber); + attr.SetBulletText(m_bulletText); + attr.SetBulletName(m_bulletName); + attr.SetBulletFont(m_bulletFont); + attr.SetCharacterStyleName(m_characterStyleName); + attr.SetParagraphStyleName(m_paragraphStyleName); + attr.SetListStyleName(m_listStyleName); + attr.SetTextEffects(m_textEffects); + attr.SetTextEffectFlags(m_textEffectFlags); + attr.SetOutlineLevel(m_outlineLevel); + + attr.SetURL(m_urlTarget); + + attr.SetFlags(GetFlags()); // Important: set after SetFont and others, since they set flags return attr; } @@ -7252,43 +7310,15 @@ bool wxRichTextAttr::operator== (const wxRichTextAttr& attr) const GetTextEffects() == attr.GetTextEffects() && GetTextEffectFlags() == attr.GetTextEffectFlags() && - m_fontSize == attr.m_fontSize && - m_fontStyle == attr.m_fontStyle && - m_fontWeight == attr.m_fontWeight && - m_fontUnderlined == attr.m_fontUnderlined && - m_fontFaceName == attr.m_fontFaceName && - - m_urlTarget == attr.m_urlTarget; -} - -// Copy to a wxTextAttr -void wxRichTextAttr::CopyTo(wxTextAttrEx& attr) const -{ - attr.SetTextColour(GetTextColour()); - attr.SetBackgroundColour(GetBackgroundColour()); - attr.SetAlignment(GetAlignment()); - attr.SetTabs(GetTabs()); - attr.SetLeftIndent(GetLeftIndent(), GetLeftSubIndent()); - attr.SetRightIndent(GetRightIndent()); - attr.SetFont(CreateFont()); - - attr.SetParagraphSpacingAfter(m_paragraphSpacingAfter); - attr.SetParagraphSpacingBefore(m_paragraphSpacingBefore); - attr.SetLineSpacing(m_lineSpacing); - attr.SetBulletStyle(m_bulletStyle); - attr.SetBulletNumber(m_bulletNumber); - attr.SetBulletText(m_bulletText); - attr.SetBulletName(m_bulletName); - attr.SetBulletFont(m_bulletFont); - attr.SetCharacterStyleName(m_characterStyleName); - attr.SetParagraphStyleName(m_paragraphStyleName); - attr.SetListStyleName(m_listStyleName); - attr.SetTextEffects(m_textEffects); - attr.SetTextEffectFlags(m_textEffectFlags); - - attr.SetURL(m_urlTarget); + GetOutlineLevel() == attr.GetOutlineLevel() && - attr.SetFlags(GetFlags()); // Important: set after SetFont and others, since they set flags + GetFontSize() == attr.GetFontSize() && + GetFontStyle() == attr.GetFontStyle() && + GetFontWeight() == attr.GetFontWeight() && + GetFontUnderlined() == attr.GetFontUnderlined() && + GetFontFaceName() == attr.GetFontFaceName() && + + GetURL() == attr.GetURL(); } // Create font from font attributes. @@ -7422,6 +7452,9 @@ wxRichTextAttr wxRichTextAttr::Combine(const wxRichTextAttr& attr, newAttr.SetTextEffectFlags(attr.GetTextEffectFlags()); } + if (attr.HasOutlineLevel()) + newAttr.SetOutlineLevel(attr.GetOutlineLevel()); + return newAttr; } @@ -7444,6 +7477,7 @@ void wxTextAttrEx::Init() m_textEffects = wxTEXT_ATTR_EFFECT_NONE; m_textEffectFlags = wxTEXT_ATTR_EFFECT_NONE; m_bulletNumber = 0; + m_outlineLevel = 0; } // Copy @@ -7465,6 +7499,7 @@ void wxTextAttrEx::Copy(const wxTextAttrEx& attr) m_urlTarget = attr.m_urlTarget; m_textEffects = attr.m_textEffects; m_textEffectFlags = attr.m_textEffectFlags; + m_outlineLevel = attr.m_outlineLevel; } // Assignment from a wxTextAttrEx object @@ -7483,10 +7518,12 @@ void wxTextAttrEx::operator= (const wxTextAttr& attr) bool wxTextAttrEx::operator== (const wxTextAttrEx& attr) const { return ( + GetFlags() == attr.GetFlags() && GetTextColour() == attr.GetTextColour() && GetBackgroundColour() == attr.GetBackgroundColour() && GetFont() == attr.GetFont() && GetTextEffects() == attr.GetTextEffects() && + GetTextEffectFlags() == attr.GetTextEffectFlags() && GetAlignment() == attr.GetAlignment() && GetLeftIndent() == attr.GetLeftIndent() && GetRightIndent() == attr.GetRightIndent() && @@ -7503,6 +7540,7 @@ bool wxTextAttrEx::operator== (const wxTextAttrEx& attr) const GetCharacterStyleName() == attr.GetCharacterStyleName() && GetParagraphStyleName() == attr.GetParagraphStyleName() && GetListStyleName() == attr.GetListStyleName() && + GetOutlineLevel() == attr.GetOutlineLevel() && GetURL() == attr.GetURL()); } @@ -7660,6 +7698,9 @@ wxTextAttrEx wxTextAttrEx::CombineEx(const wxTextAttrEx& attr, newAttr.SetTextEffectFlags(attr.GetTextEffectFlags()); } + if (attr.HasOutlineLevel()) + newAttr.SetOutlineLevel(attr.GetOutlineLevel()); + return newAttr; } diff --git a/src/richtext/richtextdialogs.pjd b/src/richtext/richtextdialogs.pjd index e9f1a5b..69360c4 100644 --- a/src/richtext/richtextdialogs.pjd +++ b/src/richtext/richtextdialogs.pjd @@ -6,7 +6,7 @@ "" "" "" - 283 + 285 "" 0 0 @@ -273,6 +273,14 @@ "wbBoxSizerProxy" "Vertical" "" + "Centre" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 0 0 0 @@ -1658,14 +1666,6 @@ "wbBoxSizerProxy" "Vertical" "" - "Centre" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 0 0 0 @@ -2481,7 +2481,7 @@ "wbBoxSizerProxy" "Horizontal" "" - "Centre" + "Expand" "Centre" 0 5 @@ -2552,7 +2552,7 @@ -1 "Centre" "Centre" - 0 + 1 5 1 1 @@ -2637,7 +2637,7 @@ "wbBoxSizerProxy" "Horizontal" "" - "Centre" + "Expand" "Centre" 0 5 @@ -2708,7 +2708,7 @@ -1 "Centre" "Centre" - 0 + 1 5 1 1 @@ -2793,7 +2793,7 @@ "wbBoxSizerProxy" "Horizontal" "" - "Centre" + "Expand" "Centre" 0 5 @@ -2864,7 +2864,7 @@ -1 "Centre" "Centre" - 0 + 1 5 1 1 @@ -2877,6 +2877,119 @@ "" + + "wxStaticText: wxID_STATIC" + "dialog-control-document" + "" + "statictext" + 0 + 1 + 0 + 0 + "10/11/2006" + "wbStaticTextProxy" + "wxID_STATIC" + 5105 + "wxStaticText" + "" + "&Outline level:" + -1 + "" + "" + "" + "" + "" + 0 + 1 + "<Any platform>" + "" + "" + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Centre" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 1 + 0 + "" + "" + + + "wxComboBox: ID_RICHTEXTINDENTSSPACINGPAGE_OUTLINELEVEL" + "dialog-control-document" + "" + "combobox" + 0 + 1 + 0 + 0 + "10/11/2006" + "wbComboBoxProxy" + "wxEVT_COMMAND_COMBOBOX_SELECTED|OnRichtextOutlinelevelSelected" + "ID_RICHTEXTINDENTSSPACINGPAGE_OUTLINELEVEL" + 10105 + "wxComboBox" + "m_outlineLevelCtrl" + "Normal|1|2|3|4|5|6|7|8|9" + "Normal" + "The outline level." + "" + "" + "" + "" + 0 + 1 + "<Any platform>" + "" + "" + 0 + 0 + 1 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Expand" + "Centre" + 1 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + @@ -3127,7 +3240,7 @@ 0 "3/10/2006" "wbFlexGridSizerProxy" - "" + "1" "" 2 2 @@ -3161,7 +3274,7 @@ 5105 "wxStaticText" "" - "Before a paragraph:" + "&Before a paragraph:" -1 "" "" @@ -3218,7 +3331,7 @@ "wbBoxSizerProxy" "Horizontal" "" - "Centre" + "Expand" "Centre" 0 5 @@ -3289,7 +3402,7 @@ -1 "Centre" "Centre" - 0 + 1 5 1 1 @@ -3317,7 +3430,7 @@ 5105 "wxStaticText" "" - "After a paragraph:" + "&After a paragraph:" -1 "" "" @@ -3374,9 +3487,9 @@ "wbBoxSizerProxy" "Horizontal" "" - "Centre" + "Expand" "Centre" - 0 + 1 5 0 0 @@ -3445,7 +3558,7 @@ -1 "Centre" "Centre" - 0 + 1 5 1 1 @@ -3473,7 +3586,7 @@ 5105 "wxStaticText" "" - "Line spacing:" + "L&ine spacing:" -1 "" "" @@ -3530,7 +3643,7 @@ "wbBoxSizerProxy" "Horizontal" "" - "Centre" + "Expand" "Centre" 0 5 @@ -7621,6 +7734,14 @@ "wbBoxSizerProxy" "Vertical" "" + "Centre" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 0 0 0 diff --git a/src/richtext/richtextindentspage.cpp b/src/richtext/richtextindentspage.cpp index 12ddce2..db9a294 100644 --- a/src/richtext/richtextindentspage.cpp +++ b/src/richtext/richtextindentspage.cpp @@ -42,6 +42,8 @@ BEGIN_EVENT_TABLE( wxRichTextIndentsSpacingPage, wxPanel ) EVT_TEXT( ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_RIGHT, wxRichTextIndentsSpacingPage::OnIndentRightUpdated ) + EVT_COMBOBOX( ID_RICHTEXTINDENTSSPACINGPAGE_OUTLINELEVEL, wxRichTextIndentsSpacingPage::OnRichtextOutlinelevelSelected ) + EVT_TEXT( ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_BEFORE, wxRichTextIndentsSpacingPage::OnSpacingBeforeUpdated ) EVT_TEXT( ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_AFTER, wxRichTextIndentsSpacingPage::OnSpacingAfterUpdated ) @@ -84,6 +86,7 @@ void wxRichTextIndentsSpacingPage::Init() m_indentLeft = NULL; m_indentLeftFirst = NULL; m_indentRight = NULL; + m_outlineLevelCtrl = NULL; m_spacingBefore = NULL; m_spacingAfter = NULL; m_spacingLine = NULL; @@ -203,87 +206,110 @@ void wxRichTextIndentsSpacingPage::CreateControls() itemFlexGridSizer22->Add(itemStaticText23, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); wxBoxSizer* itemBoxSizer24 = new wxBoxSizer(wxHORIZONTAL); - itemFlexGridSizer22->Add(itemBoxSizer24, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); + itemFlexGridSizer22->Add(itemBoxSizer24, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5); m_indentLeft = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT, _T(""), wxDefaultPosition, wxSize(50, -1), 0 ); m_indentLeft->SetHelpText(_("The left indent.")); if (ShowToolTips()) m_indentLeft->SetToolTip(_("The left indent.")); - itemBoxSizer24->Add(m_indentLeft, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + itemBoxSizer24->Add(m_indentLeft, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxStaticText* itemStaticText26 = new wxStaticText( itemPanel1, wxID_STATIC, _("Left (&first line):"), wxDefaultPosition, wxDefaultSize, 0 ); itemFlexGridSizer22->Add(itemStaticText26, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); wxBoxSizer* itemBoxSizer27 = new wxBoxSizer(wxHORIZONTAL); - itemFlexGridSizer22->Add(itemBoxSizer27, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); + itemFlexGridSizer22->Add(itemBoxSizer27, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5); m_indentLeftFirst = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT_FIRST, _T(""), wxDefaultPosition, wxSize(50, -1), 0 ); m_indentLeftFirst->SetHelpText(_("The first line indent.")); if (ShowToolTips()) m_indentLeftFirst->SetToolTip(_("The first line indent.")); - itemBoxSizer27->Add(m_indentLeftFirst, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + itemBoxSizer27->Add(m_indentLeftFirst, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxStaticText* itemStaticText29 = new wxStaticText( itemPanel1, wxID_STATIC, _("&Right:"), wxDefaultPosition, wxDefaultSize, 0 ); itemFlexGridSizer22->Add(itemStaticText29, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); wxBoxSizer* itemBoxSizer30 = new wxBoxSizer(wxHORIZONTAL); - itemFlexGridSizer22->Add(itemBoxSizer30, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); + itemFlexGridSizer22->Add(itemBoxSizer30, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5); m_indentRight = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_RIGHT, _T(""), wxDefaultPosition, wxSize(50, -1), 0 ); m_indentRight->SetHelpText(_("The right indent.")); if (ShowToolTips()) m_indentRight->SetToolTip(_("The right indent.")); - itemBoxSizer30->Add(m_indentRight, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + itemBoxSizer30->Add(m_indentRight, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); + + wxStaticText* itemStaticText32 = new wxStaticText( itemPanel1, wxID_STATIC, _("&Outline level:"), wxDefaultPosition, wxDefaultSize, 0 ); + itemFlexGridSizer22->Add(itemStaticText32, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); + + wxString m_outlineLevelCtrlStrings[] = { + _("Normal"), + _("1"), + _("2"), + _("3"), + _("4"), + _("5"), + _("6"), + _("7"), + _("8"), + _("9") + }; + m_outlineLevelCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_OUTLINELEVEL, _("Normal"), wxDefaultPosition, wxDefaultSize, 10, m_outlineLevelCtrlStrings, wxCB_READONLY ); + m_outlineLevelCtrl->SetStringSelection(_("Normal")); + m_outlineLevelCtrl->SetHelpText(_("The outline level.")); + if (ShowToolTips()) + m_outlineLevelCtrl->SetToolTip(_("The outline level.")); + itemFlexGridSizer22->Add(m_outlineLevelCtrl, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5); itemBoxSizer4->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5); - wxStaticLine* itemStaticLine33 = new wxStaticLine( itemPanel1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); - itemBoxSizer4->Add(itemStaticLine33, 0, wxGROW|wxTOP|wxBOTTOM, 5); + wxStaticLine* itemStaticLine35 = new wxStaticLine( itemPanel1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); + itemBoxSizer4->Add(itemStaticLine35, 0, wxGROW|wxTOP|wxBOTTOM, 5); itemBoxSizer4->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5); - wxBoxSizer* itemBoxSizer35 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer4->Add(itemBoxSizer35, 0, wxGROW, 5); + wxBoxSizer* itemBoxSizer37 = new wxBoxSizer(wxVERTICAL); + itemBoxSizer4->Add(itemBoxSizer37, 0, wxGROW, 5); - wxStaticText* itemStaticText36 = new wxStaticText( itemPanel1, wxID_STATIC, _("&Spacing (tenths of a mm)"), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer35->Add(itemStaticText36, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); + wxStaticText* itemStaticText38 = new wxStaticText( itemPanel1, wxID_STATIC, _("&Spacing (tenths of a mm)"), wxDefaultPosition, wxDefaultSize, 0 ); + itemBoxSizer37->Add(itemStaticText38, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); - wxBoxSizer* itemBoxSizer37 = new wxBoxSizer(wxHORIZONTAL); - itemBoxSizer35->Add(itemBoxSizer37, 0, wxALIGN_LEFT|wxALL, 5); + wxBoxSizer* itemBoxSizer39 = new wxBoxSizer(wxHORIZONTAL); + itemBoxSizer37->Add(itemBoxSizer39, 0, wxALIGN_LEFT|wxALL, 5); - itemBoxSizer37->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL, 5); + itemBoxSizer39->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL, 5); - wxFlexGridSizer* itemFlexGridSizer39 = new wxFlexGridSizer(2, 2, 0, 0); - itemBoxSizer37->Add(itemFlexGridSizer39, 0, wxALIGN_CENTER_VERTICAL, 5); + wxFlexGridSizer* itemFlexGridSizer41 = new wxFlexGridSizer(2, 2, 0, 0); + itemFlexGridSizer41->AddGrowableCol(1); + itemBoxSizer39->Add(itemFlexGridSizer41, 0, wxALIGN_CENTER_VERTICAL, 5); - wxStaticText* itemStaticText40 = new wxStaticText( itemPanel1, wxID_STATIC, _("Before a paragraph:"), wxDefaultPosition, wxDefaultSize, 0 ); - itemFlexGridSizer39->Add(itemStaticText40, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); + wxStaticText* itemStaticText42 = new wxStaticText( itemPanel1, wxID_STATIC, _("&Before a paragraph:"), wxDefaultPosition, wxDefaultSize, 0 ); + itemFlexGridSizer41->Add(itemStaticText42, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); - wxBoxSizer* itemBoxSizer41 = new wxBoxSizer(wxHORIZONTAL); - itemFlexGridSizer39->Add(itemBoxSizer41, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); + wxBoxSizer* itemBoxSizer43 = new wxBoxSizer(wxHORIZONTAL); + itemFlexGridSizer41->Add(itemBoxSizer43, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5); m_spacingBefore = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_BEFORE, _T(""), wxDefaultPosition, wxSize(50, -1), 0 ); m_spacingBefore->SetHelpText(_("The spacing before the paragraph.")); if (ShowToolTips()) m_spacingBefore->SetToolTip(_("The spacing before the paragraph.")); - itemBoxSizer41->Add(m_spacingBefore, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + itemBoxSizer43->Add(m_spacingBefore, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxStaticText* itemStaticText43 = new wxStaticText( itemPanel1, wxID_STATIC, _("After a paragraph:"), wxDefaultPosition, wxDefaultSize, 0 ); - itemFlexGridSizer39->Add(itemStaticText43, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); + wxStaticText* itemStaticText45 = new wxStaticText( itemPanel1, wxID_STATIC, _("&After a paragraph:"), wxDefaultPosition, wxDefaultSize, 0 ); + itemFlexGridSizer41->Add(itemStaticText45, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); - wxBoxSizer* itemBoxSizer44 = new wxBoxSizer(wxHORIZONTAL); - itemFlexGridSizer39->Add(itemBoxSizer44, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); + wxBoxSizer* itemBoxSizer46 = new wxBoxSizer(wxHORIZONTAL); + itemFlexGridSizer41->Add(itemBoxSizer46, 1, wxGROW|wxALIGN_CENTER_VERTICAL, 5); m_spacingAfter = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_AFTER, _T(""), wxDefaultPosition, wxSize(50, -1), 0 ); if (ShowToolTips()) m_spacingAfter->SetToolTip(_("The spacing after the paragraph.")); - itemBoxSizer44->Add(m_spacingAfter, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + itemBoxSizer46->Add(m_spacingAfter, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxStaticText* itemStaticText46 = new wxStaticText( itemPanel1, wxID_STATIC, _("Line spacing:"), wxDefaultPosition, wxDefaultSize, 0 ); - itemFlexGridSizer39->Add(itemStaticText46, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); + wxStaticText* itemStaticText48 = new wxStaticText( itemPanel1, wxID_STATIC, _("L&ine spacing:"), wxDefaultPosition, wxDefaultSize, 0 ); + itemFlexGridSizer41->Add(itemStaticText48, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); - wxBoxSizer* itemBoxSizer47 = new wxBoxSizer(wxHORIZONTAL); - itemFlexGridSizer39->Add(itemBoxSizer47, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); + wxBoxSizer* itemBoxSizer49 = new wxBoxSizer(wxHORIZONTAL); + itemFlexGridSizer41->Add(itemBoxSizer49, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5); wxString m_spacingLineStrings[] = { _("Single"), @@ -295,7 +321,7 @@ void wxRichTextIndentsSpacingPage::CreateControls() m_spacingLine->SetHelpText(_("The line spacing.")); if (ShowToolTips()) m_spacingLine->SetToolTip(_("The line spacing.")); - itemBoxSizer47->Add(m_spacingLine, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + itemBoxSizer49->Add(m_spacingLine, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); itemBoxSizer3->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); @@ -424,6 +450,10 @@ bool wxRichTextIndentsSpacingPage::TransferDataFromWindow() attr->SetFlags(attr->GetFlags() & (~wxTEXT_ATTR_LINE_SPACING)); else attr->SetLineSpacing(lineSpacing); + + int outlineLevel = m_outlineLevelCtrl->GetSelection(); + if (outlineLevel != wxNOT_FOUND) + attr->SetOutlineLevel(outlineLevel); return true; } @@ -512,6 +542,19 @@ bool wxRichTextIndentsSpacingPage::TransferDataToWindow() else m_spacingLine->SetSelection(-1); + if (attr->HasOutlineLevel()) + { + int outlineLevel = attr->GetOutlineLevel(); + if (outlineLevel < 0) + outlineLevel = 0; + if (outlineLevel > 9) + outlineLevel = 9; + + m_outlineLevelCtrl->SetSelection(outlineLevel); + } + else + m_outlineLevelCtrl->SetSelection(-1); + UpdatePreview(); m_dontUpdate = false; @@ -673,4 +716,14 @@ void wxRichTextIndentsSpacingPage::OnSpacingLineSelected( wxCommandEvent& WXUNUS UpdatePreview(); } +/*! + * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_OUTLINELEVEL + */ + +void wxRichTextIndentsSpacingPage::OnRichtextOutlinelevelSelected( wxCommandEvent& WXUNUSED(event) ) +{ + if (!m_dontUpdate) + UpdatePreview(); +} + #endif // wxUSE_RICHTEXT diff --git a/src/richtext/richtextxml.cpp b/src/richtext/richtextxml.cpp index 26189e9..9a22fd4 100644 --- a/src/richtext/richtextxml.cpp +++ b/src/richtext/richtextxml.cpp @@ -996,6 +996,10 @@ wxString wxRichTextXMLHandler::CreateStyle(const wxTextAttrEx& attr, bool isPara { str << wxT(" pagebreak=\"1\""); } + + if (attr.HasOutlineLevel()) + str << wxT(" outlinelevel=\"") << (int) attr.GetOutlineLevel() << wxT("\""); + } return str; @@ -1195,6 +1199,12 @@ bool wxRichTextXMLHandler::GetStyle(wxTextAttrEx& attr, wxXmlNode* node, bool is { attr.SetPageBreak(wxAtoi(value) != 0); } + + value = node->GetPropVal(wxT("outlinelevel"), wxEmptyString); + if (!value.IsEmpty()) + { + attr.SetOutlineLevel(wxAtoi(value) != 0); + } } return true; -- 2.7.4