preparing for HTML printing
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3919 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -38,7 +38,7 @@ class wxHtmlContainerCell;
|
|||||||
class WXDLLEXPORT wxHtmlCell : public wxObject
|
class WXDLLEXPORT wxHtmlCell : public wxObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxHtmlCell() : wxObject() {m_Next = NULL; m_Parent = NULL; m_Width = m_Height = m_Descent = 0;};
|
wxHtmlCell() : wxObject() {m_Next = NULL; m_Parent = NULL; m_Width = m_Height = m_Descent = 0; m_CanLiveOnPagebreak = TRUE;}
|
||||||
virtual ~wxHtmlCell() {if (m_Next) delete m_Next;};
|
virtual ~wxHtmlCell() {if (m_Next) delete m_Next;};
|
||||||
|
|
||||||
void SetParent(wxHtmlContainerCell *p) {m_Parent = p;}
|
void SetParent(wxHtmlContainerCell *p) {m_Parent = p;}
|
||||||
@@ -94,6 +94,20 @@ class WXDLLEXPORT wxHtmlCell : public wxObject
|
|||||||
// Parent is pointer to wxHtmlWindow that generated the event
|
// Parent is pointer to wxHtmlWindow that generated the event
|
||||||
// HINT: if this handling is not enough for you you should use
|
// HINT: if this handling is not enough for you you should use
|
||||||
// wxHtmlBinderCell
|
// wxHtmlBinderCell
|
||||||
|
|
||||||
|
virtual bool AdjustPagebreak(int *pagebreak);
|
||||||
|
// This method used to adjust pagebreak position. The parameter is
|
||||||
|
// variable that contains y-coordinate of page break (= horizontal line that
|
||||||
|
// should not be crossed by words, images etc.). If this cell cannot be divided
|
||||||
|
// into two pieces (each one on another page) then it moves the pagebreak
|
||||||
|
// few pixels up.
|
||||||
|
//
|
||||||
|
// Returned value : true if pagebreak was modified, false otherwise
|
||||||
|
// Usage : while (container->AdjustPagebreak(&p)) {}
|
||||||
|
|
||||||
|
void SetCanLiveOnPagebreak(bool can) {m_CanLiveOnPagebreak = can;}
|
||||||
|
// Sets cell's behaviour on pagebreaks (see AdjustPagebreak). Default
|
||||||
|
// is true - the cell can be split on two pages
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -108,6 +122,8 @@ class WXDLLEXPORT wxHtmlCell : public wxObject
|
|||||||
// position where the fragment is drawn
|
// position where the fragment is drawn
|
||||||
wxString m_Link;
|
wxString m_Link;
|
||||||
// destination address if this fragment is hypertext link, "" otherwise
|
// destination address if this fragment is hypertext link, "" otherwise
|
||||||
|
bool m_CanLiveOnPagebreak;
|
||||||
|
// true if this cell can be placed on pagebreak, false otherwise
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -175,6 +191,7 @@ class WXDLLEXPORT wxHtmlContainerCell : public wxHtmlCell
|
|||||||
virtual void Layout(int w);
|
virtual void Layout(int w);
|
||||||
virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
|
virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
|
||||||
virtual void DrawInvisible(wxDC& dc, int x, int y);
|
virtual void DrawInvisible(wxDC& dc, int x, int y);
|
||||||
|
virtual bool AdjustPagebreak(int *pagebreak);
|
||||||
|
|
||||||
void InsertCell(wxHtmlCell *cell);
|
void InsertCell(wxHtmlCell *cell);
|
||||||
// insert cell at the end of m_Cells list
|
// insert cell at the end of m_Cells list
|
||||||
|
@@ -77,8 +77,8 @@
|
|||||||
|
|
||||||
#define HTML_COND_ISIMAGEMAP 2
|
#define HTML_COND_ISIMAGEMAP 2
|
||||||
// Finds imagemap of 'param' name (pointer to wxString).
|
// Finds imagemap of 'param' name (pointer to wxString).
|
||||||
// (used exclusively by mod_image.cpp)
|
// (used exclusively by m_image.cpp)
|
||||||
|
|
||||||
#define HTML_COND_USER 10000
|
#define HTML_COND_USER 10000
|
||||||
// User-defined conditions should start from this number
|
// User-defined conditions should start from this number
|
||||||
|
|
||||||
@@ -94,6 +94,8 @@
|
|||||||
/* size of temporary buffer used during parsing */
|
/* size of temporary buffer used during parsing */
|
||||||
#define HTML_REALLOC_STEP 32
|
#define HTML_REALLOC_STEP 32
|
||||||
/* steps of array reallocation */
|
/* steps of array reallocation */
|
||||||
|
#define HTML_PRINT_MAX_PAGES 999
|
||||||
|
/* maximum number of pages printable via html printing */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@@ -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
|
// wxHtmlWordCell
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -59,6 +78,7 @@ wxHtmlWordCell::wxHtmlWordCell(const wxString& word, wxDC& dc) : wxHtmlCell()
|
|||||||
m_Word.Replace(">", ">", TRUE);
|
m_Word.Replace(">", ">", TRUE);
|
||||||
m_Word.Replace("&", "&", TRUE);
|
m_Word.Replace("&", "&", TRUE);
|
||||||
dc.GetTextExtent(m_Word, &m_Width, &m_Height, &m_Descent);
|
dc.GetTextExtent(m_Word, &m_Width, &m_Height, &m_Descent);
|
||||||
|
SetCanLiveOnPagebreak(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -129,6 +149,24 @@ 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;
|
||||||
|
|
||||||
|
while (c) {
|
||||||
|
if (c -> AdjustPagebreak(pagebreak)) rt = TRUE;
|
||||||
|
c = c -> GetNext();
|
||||||
|
}
|
||||||
|
return rt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void wxHtmlContainerCell::Layout(int w)
|
void wxHtmlContainerCell::Layout(int w)
|
||||||
{
|
{
|
||||||
wxHtmlCell *cell = m_Cells, *line = m_Cells;
|
wxHtmlCell *cell = m_Cells, *line = m_Cells;
|
||||||
|
@@ -321,6 +321,7 @@ wxHtmlImageCell::wxHtmlImageCell(wxFSFile *input, int w, int h, int align, wxStr
|
|||||||
|
|
||||||
m_ImageMap = NULL;
|
m_ImageMap = NULL;
|
||||||
m_MapName = mapname;
|
m_MapName = mapname;
|
||||||
|
SetCanLiveOnPagebreak(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user