wxRichTextBuffer* wxRichTextObject::GetBuffer() const
{
const wxRichTextObject* obj = this;
- while (obj && !obj->IsKindOf(CLASSINFO(wxRichTextBuffer)))
+ while (obj && !wxDynamicCast(obj, wxRichTextBuffer))
obj = obj->GetParent();
return wxDynamicCast(obj, wxRichTextBuffer);
}
if (childRange.GetLength() == 0 && GetRange().GetLength() == 1)
childRange.SetEnd(childRange.GetEnd()+1);
- if (!childRange.IsOutside(range) && child->IsKindOf(CLASSINFO(wxRichTextPlainText)))
+ if (!childRange.IsOutside(range) && wxDynamicCast(child, wxRichTextPlainText))
{
foundCount ++;
wxRichTextAttr textAttr = para->GetCombinedAttributes(child->GetAttributes());
wxRichTextApplyStyle(newPara->GetAttributes(), listStyle);
// Now we need to do numbering
- if (renumber)
+ // Preserve the existing list item continuation bullet style, if any
+ if (para->GetAttributes().HasBulletStyle() && (para->GetAttributes().GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_CONTINUATION))
+ newPara->GetAttributes().SetBulletStyle(newPara->GetAttributes().GetBulletStyle()|wxTEXT_ATTR_BULLET_STYLE_CONTINUATION);
+ else
{
- newPara->GetAttributes().SetBulletNumber(n);
- }
+ // Now we need to do numbering
+ if (renumber)
+ {
+ newPara->GetAttributes().SetBulletNumber(n);
+ }
- n ++;
+ n ++;
+ }
}
else if (!newPara->GetAttributes().GetListStyleName().IsEmpty())
{
wxRichTextAttr listStyle(defToUse->GetCombinedStyleForLevel(thisLevel, styleSheet));
wxRichTextApplyStyle(newPara->GetAttributes(), listStyle);
+ // Preserve the existing list item continuation bullet style, if any
+ if (para->GetAttributes().HasBulletStyle() && (para->GetAttributes().GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_CONTINUATION))
+ newPara->GetAttributes().SetBulletStyle(newPara->GetAttributes().GetBulletStyle()|wxTEXT_ATTR_BULLET_STYLE_CONTINUATION);
+
// OK, we've (re)applied the style, now let's get the numbering right.
if (currentLevel == -1)
}
else
{
- levels[currentLevel] ++;
+ if (!(para->GetAttributes().HasBulletStyle() && (para->GetAttributes().GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_CONTINUATION)))
+ levels[currentLevel] ++;
}
newPara->GetAttributes().SetBulletNumber(levels[currentLevel]);
/// position of the paragraph that it had to start looking from.
bool wxRichTextParagraphLayoutBox::FindNextParagraphNumber(wxRichTextParagraph* previousParagraph, wxRichTextAttr& attr) const
{
+ // Search for a paragraph that isn't a continuation paragraph (no bullet)
+ while (previousParagraph && previousParagraph->GetAttributes().HasBulletStyle() && previousParagraph->GetAttributes().GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_CONTINUATION)
+ {
+ wxRichTextObjectList::compatibility_iterator node = ((wxRichTextCompositeObject*) previousParagraph->GetParent())->GetChildren().Find(previousParagraph);
+ if (node)
+ {
+ node = node->GetPrevious();
+ if (node)
+ previousParagraph = wxDynamicCast(node->GetData(), wxRichTextParagraph);
+ else
+ previousParagraph = NULL;
+ }
+ else
+ previousParagraph = NULL;
+ }
+
if (!previousParagraph->GetAttributes().HasFlag(wxTEXT_ATTR_BULLET_STYLE) || previousParagraph->GetAttributes().GetBulletStyle() == wxTEXT_ATTR_BULLET_STYLE_NONE)
return false;
DrawBoxAttributes(dc, GetBuffer(), attr, paraRect);
// Draw the bullet, if any
- if (attr.GetBulletStyle() != wxTEXT_ATTR_BULLET_STYLE_NONE)
+ if ((attr.GetBulletStyle() == wxTEXT_ATTR_BULLET_STYLE_NONE) == 0 && (attr.GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_CONTINUATION) == 0)
{
if (attr.GetLeftSubIndent() != 0)
{
// Line end position shouldn't be the same as the end, or greater.
if (wrapPosition >= GetRange().GetEnd())
- wrapPosition = GetRange().GetEnd()-1;
+ wrapPosition = wxMax(0, GetRange().GetEnd()-1);
// wxLogDebug(wxT("Split at %ld"), wrapPosition);
// If floating, ignore. We already laid out floats.
// Also ignore if empty object, except if we haven't got any
// size yet.
- if (!child->IsFloating() && child->GetRange().GetLength() != 0 && !child->IsKindOf(CLASSINFO(wxRichTextPlainText)))
+ if (!child->IsFloating() && child->GetRange().GetLength() != 0 && !wxDynamicCast(child, wxRichTextPlainText))
{
if (child->GetCachedSize().x > minWidth)
minWidth = child->GetMinSize().x;
wxString str = m_text;
wxString toRemove = wxRichTextLineBreakChar;
str.Replace(toRemove, wxT(" "));
- if (textAttr.HasTextEffects() && (textAttr.GetTextEffects() & wxTEXT_ATTR_EFFECT_CAPITALS))
+ if (textAttr.HasTextEffects() && (textAttr.GetTextEffects() & (wxTEXT_ATTR_EFFECT_CAPITALS|wxTEXT_ATTR_EFFECT_SMALL_CAPITALS)))
str.MakeUpper();
long len = range.GetLength();
int x, y;
if ( textFont.IsOk() )
{
+ if (textAttr.HasTextEffects() && (textAttr.GetTextEffects() & wxTEXT_ATTR_EFFECT_SMALL_CAPITALS))
+ {
+ textFont.SetPointSize((int) (textFont.GetPointSize()*0.75));
+ wxCheckSetFont(dc, textFont);
+ charHeight = dc.GetCharHeight();
+ }
+
if ( textAttr.HasTextEffects() && (textAttr.GetTextEffects() & wxTEXT_ATTR_EFFECT_SUPERSCRIPT) )
{
if (textFont.IsUsingSizeInPixels())
{
double size = static_cast<double>(textFont.GetPixelSize().y) / wxSCRIPT_MUL_FACTOR;
- textFont.SetPixelSize(wxSize(0, static_cast<int>(size)) );
+ textFont.SetPixelSize(wxSize(0, static_cast<int>(size)));
x = rect.x;
y = rect.y;
}
else
{
double size = static_cast<double>(textFont.GetPointSize()) / wxSCRIPT_MUL_FACTOR;
- textFont.SetPointSize( static_cast<int>(size) );
+ textFont.SetPointSize(static_cast<int>(size));
x = rect.x;
y = rect.y;
}
double size = static_cast<double>(textFont.GetPixelSize().y) / wxSCRIPT_MUL_FACTOR;
textFont.SetPixelSize(wxSize(0, static_cast<int>(size)));
x = rect.x;
- int sub_height = static_cast<int>( static_cast<double>(charHeight) / wxSCRIPT_MUL_FACTOR);
+ int sub_height = static_cast<int>(static_cast<double>(charHeight) / wxSCRIPT_MUL_FACTOR);
y = rect.y + (rect.height - sub_height + (descent - m_descent));
}
else
{
double size = static_cast<double>(textFont.GetPointSize()) / wxSCRIPT_MUL_FACTOR;
- textFont.SetPointSize( static_cast<int>(size) );
+ textFont.SetPointSize(static_cast<int>(size));
x = rect.x;
- int sub_height = static_cast<int>( static_cast<double>(charHeight) / wxSCRIPT_MUL_FACTOR);
+ int sub_height = static_cast<int>(static_cast<double>(charHeight) / wxSCRIPT_MUL_FACTOR);
y = rect.y + (rect.height - sub_height + (descent - m_descent));
}
wxCheckSetFont(dc, textFont);
wxCheckSetFont(dc, textFont);
bScript = true;
}
+ else if (textAttr.HasTextEffects() && (textAttr.GetTextEffects() & wxTEXT_ATTR_EFFECT_SMALL_CAPITALS))
+ {
+ wxFont textFont = font;
+ textFont.SetPointSize((int) (textFont.GetPointSize()*0.75));
+ wxCheckSetFont(dc, textFont);
+ bScript = true;
+ }
else
{
wxCheckSetFont(dc, font);
wxString stringChunk = str.Mid(startPos, (size_t) len);
- if (textAttr.HasTextEffects() && (textAttr.GetTextEffects() & wxTEXT_ATTR_EFFECT_CAPITALS))
+ if (textAttr.HasTextEffects() && (textAttr.GetTextEffects() & (wxTEXT_ATTR_EFFECT_CAPITALS|wxTEXT_ATTR_EFFECT_SMALL_CAPITALS)))
stringChunk.MakeUpper();
wxCoord w, h;
/// Returns true if this object can merge itself with the given one.
bool wxRichTextPlainText::CanMerge(wxRichTextObject* object) const
{
- return object->GetClassInfo() == CLASSINFO(wxRichTextPlainText) &&
+ return object->GetClassInfo() == wxCLASSINFO(wxRichTextPlainText) &&
(m_text.empty() || (wxTextAttrEq(GetAttributes(), object->GetAttributes()) && m_properties == object->GetProperties()));
}
wxRichTextObjectPropertiesDialog cellDlg(this, wxGetTopLevelParent(parent), wxID_ANY, caption);
cellDlg.SetAttributes(attr);
- wxRichTextSizePage* sizePage = wxDynamicCast(cellDlg.FindPage(CLASSINFO(wxRichTextSizePage)), wxRichTextSizePage);
+ wxRichTextSizePage* sizePage = wxDynamicCast(cellDlg.FindPage(wxCLASSINFO(wxRichTextSizePage)), wxRichTextSizePage);
if (sizePage)
{
// We don't want position and floating controls for a cell.
// first, but of course this means we'll be doing it twice.
if (!m_buffer->IsDirty() && m_ctrl) // can only do optimisation if the buffer is already laid out correctly
{
- wxSize clientSize = m_ctrl->GetClientSize();
- wxPoint firstVisiblePt = m_ctrl->GetFirstVisiblePoint();
+ wxSize clientSize = m_ctrl->GetUnscaledSize(m_ctrl->GetClientSize());
+ wxPoint firstVisiblePt = m_ctrl->GetUnscaledPoint(m_ctrl->GetFirstVisiblePoint());
int lastY = firstVisiblePt.y + clientSize.y;
wxRichTextParagraph* para = container->GetParagraphAtPosition(GetRange().GetStart());
{
size_t i;
- wxSize clientSize = m_ctrl->GetClientSize();
- wxPoint firstVisiblePt = m_ctrl->GetFirstVisiblePoint();
+ wxSize clientSize = m_ctrl->GetUnscaledSize(m_ctrl->GetClientSize());
+ wxPoint firstVisiblePt = m_ctrl->GetUnscaledPoint(m_ctrl->GetFirstVisiblePoint());
// Start/end positions
int firstY = 0;
lastY = firstVisiblePt.y + clientSize.y;
// Convert to device coordinates
- wxRect rect(m_ctrl->GetPhysicalPoint(wxPoint(firstVisiblePt.x, firstY)), wxSize(clientSize.x, lastY - firstY));
+ wxRect rect(m_ctrl->GetPhysicalPoint(m_ctrl->GetScaledPoint(wxPoint(firstVisiblePt.x, firstY))), m_ctrl->GetScaledSize(wxSize(clientSize.x, lastY - firstY)));
m_ctrl->RefreshRect(rect);
}
else
}
else
{
- wxFont font(fontSize, wxDEFAULT, fontSpec.GetFontStyle(), fontSpec.GetFontWeight(), fontSpec.GetFontUnderlined(), facename.c_str());
+ wxFont font(fontSize, wxFONTFAMILY_DEFAULT, fontSpec.GetFontStyle(), fontSpec.GetFontWeight(), fontSpec.GetFontUnderlined(), facename.c_str());
if (fontSpec.HasFontStrikethrough() && fontSpec.GetFontStrikethrough())
font.SetStrikethrough(true);
if (attr.HasFont())
{
- if (attr.HasFontPointSize() && !wxHasStyle(forbiddenFlags, wxTEXT_ATTR_FONT_POINT_SIZE))
+ // If different font size units are being used, this is a clash.
+ if (((attr.GetFlags() & wxTEXT_ATTR_FONT_SIZE) | (currentStyle.GetFlags() & wxTEXT_ATTR_FONT_SIZE)) == wxTEXT_ATTR_FONT_SIZE)
{
- if (currentStyle.HasFontPointSize())
+ currentStyle.SetFontSize(0);
+ currentStyle.RemoveFlag(wxTEXT_ATTR_FONT_SIZE);
+ clashingAttr.AddFlag(wxTEXT_ATTR_FONT_SIZE);
+ }
+ else
+ {
+ if (attr.HasFontPointSize() && !wxHasStyle(forbiddenFlags, wxTEXT_ATTR_FONT_POINT_SIZE))
{
- if (currentStyle.GetFontSize() != attr.GetFontSize())
+ if (currentStyle.HasFontPointSize())
{
- // Clash of attr - mark as such
- clashingAttr.AddFlag(wxTEXT_ATTR_FONT_POINT_SIZE);
- currentStyle.RemoveFlag(wxTEXT_ATTR_FONT_POINT_SIZE);
+ if (currentStyle.GetFontSize() != attr.GetFontSize())
+ {
+ // Clash of attr - mark as such
+ clashingAttr.AddFlag(wxTEXT_ATTR_FONT_POINT_SIZE);
+ currentStyle.RemoveFlag(wxTEXT_ATTR_FONT_POINT_SIZE);
+ }
}
+ else
+ currentStyle.SetFontSize(attr.GetFontSize());
}
- else
- currentStyle.SetFontSize(attr.GetFontSize());
- }
- if (attr.HasFontPixelSize() && !wxHasStyle(forbiddenFlags, wxTEXT_ATTR_FONT_PIXEL_SIZE))
- {
- if (currentStyle.HasFontPixelSize())
+ if (attr.HasFontPixelSize() && !wxHasStyle(forbiddenFlags, wxTEXT_ATTR_FONT_PIXEL_SIZE))
{
- if (currentStyle.GetFontSize() != attr.GetFontSize())
+ if (currentStyle.HasFontPixelSize())
{
- // Clash of attr - mark as such
- clashingAttr.AddFlag(wxTEXT_ATTR_FONT_PIXEL_SIZE);
- currentStyle.RemoveFlag(wxTEXT_ATTR_FONT_PIXEL_SIZE);
+ if (currentStyle.GetFontSize() != attr.GetFontSize())
+ {
+ // Clash of attr - mark as such
+ clashingAttr.AddFlag(wxTEXT_ATTR_FONT_PIXEL_SIZE);
+ currentStyle.RemoveFlag(wxTEXT_ATTR_FONT_PIXEL_SIZE);
+ }
}
+ else
+ currentStyle.SetFontPixelSize(attr.GetFontSize());
}
- else
- currentStyle.SetFontPixelSize(attr.GetFontSize());
}
if (attr.HasFontItalic() && !wxHasStyle(forbiddenFlags, wxTEXT_ATTR_FONT_ITALIC))