// So when changing a list style interactively, could retrieve level based on current style, then
// set appropriate indent and apply new style.
+ int outline = -1;
+ int num = -1;
+ if (para->GetAttributes().HasOutlineLevel())
+ outline = para->GetAttributes().GetOutlineLevel();
+ if (para->GetAttributes().HasBulletNumber())
+ num = para->GetAttributes().GetBulletNumber();
+
if (!para->GetAttributes().GetParagraphStyleName().IsEmpty() && !para->GetAttributes().GetListStyleName().IsEmpty())
{
int currentIndent = para->GetAttributes().GetLeftIndent();
foundCount ++;
}
}
+
+ if (outline != -1)
+ para->GetAttributes().SetOutlineLevel(outline);
+ if (num != -1)
+ para->GetAttributes().SetBulletNumber(num);
}
node = node->GetNext();
int lineSpacing = 0;
// Let's assume line spacing of 10 is normal, 15 is 1.5, 20 is 2, etc.
- if (attr.GetLineSpacing() != 10 && GetBuffer())
+ if (attr.HasLineSpacing() && attr.GetLineSpacing() > 0 && attr.GetFont().Ok())
{
- wxFont font(GetBuffer()->GetFontTable().FindFont(attr));
- wxCheckSetFont(dc, font);
- lineSpacing = (ConvertTenthsMMToPixels(dc, dc.GetCharHeight()) * attr.GetLineSpacing())/10;
+ wxCheckSetFont(dc, attr.GetFont());
+ lineSpacing = (int) (double(dc.GetCharHeight()) * (double(attr.GetLineSpacing())/10.0 - 1.0));
}
// Available space for text on each line differs.
// Apply styles to wrapped lines
ApplyParagraphStyle(attr, rect, dc);
- SetCachedSize(wxSize(maxWidth, currentPosition.y + spaceBeforePara + spaceAfterPara));
+ SetCachedSize(wxSize(maxWidth, currentPosition.y + spaceAfterPara));
m_dirty = false;
wxRichTextImageBlock::~wxRichTextImageBlock()
{
- if (m_data)
- {
- delete[] m_data;
- m_data = NULL;
- }
+ wxDELETEA(m_data);
}
void wxRichTextImageBlock::Init()
void wxRichTextImageBlock::Clear()
{
- delete[] m_data;
- m_data = NULL;
+ wxDELETEA(m_data);
m_dataSize = 0;
m_imageType = wxBITMAP_TYPE_INVALID;
}
void wxRichTextImageBlock::Copy(const wxRichTextImageBlock& block)
{
m_imageType = block.m_imageType;
- if (m_data)
- {
- delete[] m_data;
- m_data = NULL;
- }
+ wxDELETEA(m_data);
m_dataSize = block.m_dataSize;
if (m_dataSize == 0)
return;
bool wxRichTextBufferDataObject::SetData(size_t WXUNUSED(len), const void *buf)
{
- delete m_richTextBuffer;
- m_richTextBuffer = NULL;
+ wxDELETE(m_richTextBuffer);
wxString bufXML((const char*) buf, wxConvUTF8);
{
wxLogError(wxT("Could not read the buffer from an XML stream.\nYou may have forgotten to add the XML file handler."));
- delete m_richTextBuffer;
- m_richTextBuffer = NULL;
+ wxDELETE(m_richTextBuffer);
return false;
}