X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bf0c00c6e8f4dd3e29732c22a2e8626c40e22099..8e193f384f7b98daef459653ddb8485173fba8ba:/src/html/htmlcell.cpp diff --git a/src/html/htmlcell.cpp b/src/html/htmlcell.cpp index dd4e4502a7..6ed7c1fa80 100644 --- a/src/html/htmlcell.cpp +++ b/src/html/htmlcell.cpp @@ -46,6 +46,25 @@ void wxHtmlCell::OnMouseClick(wxWindow *parent, int x, int y, +bool wxHtmlCell::AdjustPagebreak(int *pagebreak) +{ + + if ((!m_CanLiveOnPagebreak) && + m_PosY < *pagebreak && m_PosY + m_Height > *pagebreak) { + *pagebreak = m_PosY; + if (m_Next != NULL) m_Next -> AdjustPagebreak(pagebreak); + return TRUE; + } + + else { + if (m_Next != NULL) return m_Next -> AdjustPagebreak(pagebreak); + else return FALSE; + } +} + + + + //----------------------------------------------------------------------------- // wxHtmlWordCell //----------------------------------------------------------------------------- @@ -59,6 +78,7 @@ wxHtmlWordCell::wxHtmlWordCell(const wxString& word, wxDC& dc) : wxHtmlCell() m_Word.Replace(">", ">", TRUE); m_Word.Replace("&", "&", TRUE); dc.GetTextExtent(m_Word, &m_Width, &m_Height, &m_Descent); + SetCanLiveOnPagebreak(FALSE); } @@ -129,6 +149,27 @@ int wxHtmlContainerCell::GetIndentUnits(int ind) const +bool wxHtmlContainerCell::AdjustPagebreak(int *pagebreak) +{ + if (!m_CanLiveOnPagebreak) + return wxHtmlCell::AdjustPagebreak(pagebreak); + + else { + wxHtmlCell *c = GetFirstCell(); + bool rt = FALSE; + int pbrk = *pagebreak - m_PosY; + + while (c) { + if (c -> AdjustPagebreak(&pbrk)) rt = TRUE; + c = c -> GetNext(); + } + if (rt) *pagebreak = pbrk + m_PosY; + return rt; + } +} + + + void wxHtmlContainerCell::Layout(int w) { wxHtmlCell *cell = m_Cells, *line = m_Cells;