1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/richtext/richtextprint.cpp
3 // Purpose: Rich text printing classes
4 // Author: Julian Smart
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx/wx.h".
12 #include "wx/wxprec.h"
18 #if wxUSE_RICHTEXT && wxUSE_PRINTING_ARCHITECTURE && wxUSE_STREAMS
24 #include "wx/settings.h"
25 #include "wx/msgdlg.h"
28 #include "wx/datetime.h"
30 #include "wx/printdlg.h"
31 #include "wx/richtext/richtextprint.h"
32 #include "wx/wfstream.h"
38 wxRichTextPrintout::wxRichTextPrintout(const wxString
& title
) : wxPrintout(title
)
40 m_numPages
= wxRICHTEXT_PRINT_MAX_PAGES
;
42 SetMargins(); // to default values
45 wxRichTextPrintout::~wxRichTextPrintout()
49 void wxRichTextPrintout::OnPreparePrinting()
55 m_pageBreaksStart
.Clear();
56 m_pageBreaksEnd
.Clear();
60 wxRect rect
, headerRect
, footerRect
;
62 /// Sets the DC scaling and returns important page rectangles
63 CalculateScaling(GetDC(), rect
, headerRect
, footerRect
);
65 if (GetRichTextBuffer())
67 GetRichTextBuffer()->Invalidate(wxRICHTEXT_ALL
);
69 GetRichTextBuffer()->Layout(*GetDC(), rect
, wxRICHTEXT_FIXED_WIDTH
|wxRICHTEXT_VARIABLE_HEIGHT
);
71 // Now calculate the page breaks
75 wxRichTextLine
* lastLine
= NULL
;
77 wxRichTextObjectList::compatibility_iterator node
= GetRichTextBuffer()->GetChildren().GetFirst();
80 // child is a paragraph
81 wxRichTextParagraph
* child
= wxDynamicCast(node
->GetData(), wxRichTextParagraph
);
82 wxASSERT (child
!= NULL
);
84 wxRichTextLineList::compatibility_iterator node2
= child
->GetLines().GetFirst();
87 wxRichTextLine
* line
= node2
->GetData();
89 // Set the line to the page-adjusted position
90 line
->SetPosition(wxPoint(line
->GetPosition().x
, line
->GetPosition().y
- yOffset
));
92 int lineY
= child
->GetPosition().y
+ line
->GetPosition().y
;
94 // Break the page if either we're going off the bottom, or this paragraph specifies
95 // an explicit page break
97 if (((lineY
+ line
->GetSize().y
) > rect
.GetBottom()) ||
98 ((node2
== child
->GetLines().GetFirst()) && child
->GetAttributes().HasPageBreak()))
100 // New page starting at this line
103 // We increase the offset by the difference between new and old positions
105 int increaseOffsetBy
= lineY
- newY
;
106 yOffset
+= increaseOffsetBy
;
108 line
->SetPosition(wxPoint(line
->GetPosition().x
, newY
- child
->GetPosition().y
));
113 m_pageBreaksStart
.Add(lastStartPos
);
114 m_pageBreaksEnd
.Add(lastLine
->GetAbsoluteRange().GetEnd());
116 lastStartPos
= line
->GetAbsoluteRange().GetStart();
123 node2
= node2
->GetNext();
126 node
= node
->GetNext();
129 // Closing page break
130 if (m_pageBreaksStart
.GetCount() > 0 && (m_pageBreaksEnd
[m_pageBreaksEnd
.GetCount()-1] < (GetRichTextBuffer()->GetRange().GetEnd()-1)))
132 m_pageBreaksStart
.Add(lastStartPos
);
133 m_pageBreaksEnd
.Add(GetRichTextBuffer()->GetRange().GetEnd());
139 bool wxRichTextPrintout::OnBeginDocument(int startPage
, int endPage
)
141 if (!wxPrintout::OnBeginDocument(startPage
, endPage
)) return false;
146 bool wxRichTextPrintout::OnPrintPage(int page
)
152 RenderPage(dc
, page
);
158 void wxRichTextPrintout::GetPageInfo(int *minPage
, int *maxPage
, int *selPageFrom
, int *selPageTo
)
161 *maxPage
= m_numPages
;
163 *selPageTo
= m_numPages
;
166 bool wxRichTextPrintout::HasPage(int pageNum
)
168 return pageNum
> 0 && pageNum
<= m_numPages
;
171 void wxRichTextPrintout::RenderPage(wxDC
*dc
, int page
)
173 if (!GetRichTextBuffer())
178 wxRect textRect
, headerRect
, footerRect
;
180 /// Sets the DC scaling and returns important page rectangles
181 CalculateScaling(dc
, textRect
, headerRect
, footerRect
);
183 if (page
> 1 || m_headerFooterData
.GetShowOnFirstPage())
185 if (m_headerFooterData
.GetFont().Ok())
186 dc
->SetFont(m_headerFooterData
.GetFont());
188 dc
->SetFont(*wxNORMAL_FONT
);
189 if (m_headerFooterData
.GetTextColour().Ok())
190 dc
->SetTextForeground(m_headerFooterData
.GetTextColour());
192 dc
->SetTextForeground(*wxBLACK
);
193 dc
->SetBackgroundMode(wxTRANSPARENT
);
195 // Draw header, if any
196 wxRichTextOddEvenPage oddEven
= ((page
% 2) == 1) ? wxRICHTEXT_PAGE_ODD
: wxRICHTEXT_PAGE_EVEN
;
198 wxString headerTextCentre
= m_headerFooterData
.GetHeaderText(oddEven
, wxRICHTEXT_PAGE_CENTRE
);
199 wxString headerTextLeft
= m_headerFooterData
.GetHeaderText(oddEven
, wxRICHTEXT_PAGE_LEFT
);
200 wxString headerTextRight
= m_headerFooterData
.GetHeaderText(oddEven
, wxRICHTEXT_PAGE_RIGHT
);
202 if (!headerTextLeft
.IsEmpty())
204 SubstituteKeywords(headerTextLeft
, GetTitle(), page
, m_numPages
);
207 //dc->GetTextExtent(headerTextLeft, & tx, & ty);
209 int x
= headerRect
.GetLeft();
210 int y
= headerRect
.GetX();
211 dc
->DrawText(headerTextLeft
, x
, y
);
213 if (!headerTextCentre
.IsEmpty())
215 SubstituteKeywords(headerTextCentre
, GetTitle(), page
, m_numPages
);
218 dc
->GetTextExtent(headerTextCentre
, & tx
, & ty
);
220 int x
= headerRect
.GetWidth()/2 - tx
/2 + headerRect
.GetLeft();
221 int y
= headerRect
.GetY();
222 dc
->DrawText(headerTextCentre
, x
, y
);
224 if (!headerTextRight
.IsEmpty())
226 SubstituteKeywords(headerTextRight
, GetTitle(), page
, m_numPages
);
229 dc
->GetTextExtent(headerTextRight
, & tx
, & ty
);
231 int x
= headerRect
.GetRight() - tx
;
232 int y
= headerRect
.GetY();
233 dc
->DrawText(headerTextRight
, x
, y
);
236 // Draw footer, if any
237 wxString footerTextCentre
= m_headerFooterData
.GetFooterText(oddEven
, wxRICHTEXT_PAGE_CENTRE
);
238 wxString footerTextLeft
= m_headerFooterData
.GetFooterText(oddEven
, wxRICHTEXT_PAGE_LEFT
);
239 wxString footerTextRight
= m_headerFooterData
.GetFooterText(oddEven
, wxRICHTEXT_PAGE_RIGHT
);
241 if (!footerTextLeft
.IsEmpty())
243 SubstituteKeywords(footerTextLeft
, GetTitle(), page
, m_numPages
);
246 dc
->GetTextExtent(footerTextLeft
, & tx
, & ty
);
248 int x
= footerRect
.GetLeft();
249 int y
= footerRect
.GetBottom() - ty
;
250 dc
->DrawText(footerTextLeft
, x
, y
);
252 if (!footerTextCentre
.IsEmpty())
254 SubstituteKeywords(footerTextCentre
, GetTitle(), page
, m_numPages
);
257 dc
->GetTextExtent(footerTextCentre
, & tx
, & ty
);
259 int x
= footerRect
.GetWidth()/2 - tx
/2 + footerRect
.GetLeft();
260 int y
= footerRect
.GetBottom() - ty
;
261 dc
->DrawText(footerTextCentre
, x
, y
);
263 if (!footerTextRight
.IsEmpty())
265 SubstituteKeywords(footerTextRight
, GetTitle(), page
, m_numPages
);
268 dc
->GetTextExtent(footerTextRight
, & tx
, & ty
);
270 int x
= footerRect
.GetRight() - tx
;
271 int y
= footerRect
.GetBottom() - ty
;
272 dc
->DrawText(footerTextRight
, x
, y
);
276 wxRichTextRange
rangeToDraw(m_pageBreaksStart
[page
-1], m_pageBreaksEnd
[page
-1]);
278 GetRichTextBuffer()->Draw(*dc
, rangeToDraw
, wxRichTextRange(-1,-1), textRect
, 0 /* descent */, wxRICHTEXT_DRAW_IGNORE_CACHE
/* flags */);
281 void wxRichTextPrintout::SetMargins(int top
, int bottom
, int left
, int right
)
284 m_marginBottom
= bottom
;
286 m_marginRight
= right
;
289 /// Calculate scaling and rectangles, setting the device context scaling
290 void wxRichTextPrintout::CalculateScaling(wxDC
* dc
, wxRect
& textRect
, wxRect
& headerRect
, wxRect
& footerRect
)
292 // Get the logical pixels per inch of screen and printer
293 int ppiScreenX
, ppiScreenY
;
294 GetPPIScreen(&ppiScreenX
, &ppiScreenY
);
295 int ppiPrinterX
, ppiPrinterY
;
296 GetPPIPrinter(&ppiPrinterX
, &ppiPrinterY
);
298 // This scales the DC so that the printout roughly represents the
299 // the screen scaling.
300 float scale
= (float)((float)ppiPrinterX
/(float)ppiScreenX
);
302 // Now we have to check in case our real page size is reduced
303 // (e.g. because we're drawing to a print preview memory DC)
304 int pageWidth
, pageHeight
;
307 GetPageSizePixels(&pageWidth
, &pageHeight
);
309 // If printer pageWidth == current DC width, then this doesn't
310 // change. But w might be the preview bitmap width, so scale down.
311 float previewScale
= (float)(w
/(float)pageWidth
);
312 float overallScale
= scale
* previewScale
;
314 // The dimensions used for indentation etc. have to be unscaled
315 // during printing to be correct when scaling is applied.
317 m_richTextBuffer
->SetScale(scale
);
320 int marginLeft
= wxRichTextObject::ConvertTenthsMMToPixels(ppiPrinterX
, m_marginLeft
);
321 int marginTop
= wxRichTextObject::ConvertTenthsMMToPixels(ppiPrinterX
, m_marginTop
);
322 int marginRight
= wxRichTextObject::ConvertTenthsMMToPixels(ppiPrinterX
, m_marginRight
);
323 int marginBottom
= wxRichTextObject::ConvertTenthsMMToPixels(ppiPrinterX
, m_marginBottom
);
325 // Header and footer margins
326 int headerMargin
= wxRichTextObject::ConvertTenthsMMToPixels(ppiPrinterX
, m_headerFooterData
.GetHeaderMargin());
327 int footerMargin
= wxRichTextObject::ConvertTenthsMMToPixels(ppiPrinterX
, m_headerFooterData
.GetFooterMargin());
329 dc
->SetUserScale(overallScale
, overallScale
);
331 wxRect
rect((int) (marginLeft
/scale
), (int) (marginTop
/scale
),
332 (int) ((pageWidth
- marginLeft
- marginRight
)/scale
), (int)((pageHeight
- marginTop
- marginBottom
)/scale
));
334 headerRect
= wxRect(0, 0, 0, 0);
336 if (!m_headerFooterData
.GetHeaderText(wxRICHTEXT_PAGE_ODD
, wxRICHTEXT_PAGE_LEFT
).IsEmpty() ||
337 !m_headerFooterData
.GetHeaderText(wxRICHTEXT_PAGE_ODD
, wxRICHTEXT_PAGE_CENTRE
).IsEmpty() ||
338 !m_headerFooterData
.GetHeaderText(wxRICHTEXT_PAGE_ODD
, wxRICHTEXT_PAGE_RIGHT
).IsEmpty() ||
340 !m_headerFooterData
.GetHeaderText(wxRICHTEXT_PAGE_EVEN
, wxRICHTEXT_PAGE_LEFT
).IsEmpty() ||
341 !m_headerFooterData
.GetHeaderText(wxRICHTEXT_PAGE_EVEN
, wxRICHTEXT_PAGE_CENTRE
).IsEmpty() ||
342 !m_headerFooterData
.GetHeaderText(wxRICHTEXT_PAGE_EVEN
, wxRICHTEXT_PAGE_RIGHT
).IsEmpty())
344 if (m_headerFooterData
.GetFont().Ok())
345 dc
->SetFont(m_headerFooterData
.GetFont());
347 dc
->SetFont(*wxNORMAL_FONT
);
349 int charHeight
= dc
->GetCharHeight();
351 int headerHeight
= (int) (charHeight
+ headerMargin
/scale
);
353 headerRect
= wxRect(rect
.x
, rect
.y
, rect
.width
, headerHeight
);
355 rect
.y
+= headerHeight
;
356 rect
.height
-= headerHeight
;
359 footerRect
= wxRect(0, 0, 0, 0);
361 if (!m_headerFooterData
.GetFooterText(wxRICHTEXT_PAGE_ODD
, wxRICHTEXT_PAGE_LEFT
).IsEmpty() ||
362 !m_headerFooterData
.GetFooterText(wxRICHTEXT_PAGE_ODD
, wxRICHTEXT_PAGE_CENTRE
).IsEmpty() ||
363 !m_headerFooterData
.GetFooterText(wxRICHTEXT_PAGE_ODD
, wxRICHTEXT_PAGE_RIGHT
).IsEmpty() ||
365 !m_headerFooterData
.GetFooterText(wxRICHTEXT_PAGE_EVEN
, wxRICHTEXT_PAGE_LEFT
).IsEmpty() ||
366 !m_headerFooterData
.GetFooterText(wxRICHTEXT_PAGE_EVEN
, wxRICHTEXT_PAGE_CENTRE
).IsEmpty() ||
367 !m_headerFooterData
.GetFooterText(wxRICHTEXT_PAGE_EVEN
, wxRICHTEXT_PAGE_RIGHT
).IsEmpty())
369 if (m_headerFooterData
.GetFont().Ok())
370 dc
->SetFont(m_headerFooterData
.GetFont());
372 dc
->SetFont(*wxNORMAL_FONT
);
374 int charHeight
= dc
->GetCharHeight();
376 int footerHeight
= (int) (charHeight
+ footerMargin
/scale
);
378 footerRect
= wxRect(rect
.x
, rect
.y
+ rect
.height
, rect
.width
, footerHeight
);
380 rect
.height
-= footerHeight
;
386 bool wxRichTextPrintout::SubstituteKeywords(wxString
& str
, const wxString
& title
, int pageNum
, int pageCount
)
390 num
.Printf(wxT("%i"), pageNum
);
391 str
.Replace(wxT("@PAGENUM@"), num
);
393 num
.Printf(wxT("%lu"), (unsigned long) pageCount
);
394 str
.Replace(wxT("@PAGESCNT@"), num
);
396 wxDateTime now
= wxDateTime::Now();
398 str
.Replace(wxT("@DATE@"), now
.FormatDate());
399 str
.Replace(wxT("@TIME@"), now
.FormatTime());
401 str
.Replace(wxT("@TITLE@"), title
);
410 wxRichTextPrinting::wxRichTextPrinting(const wxString
& name
, wxWindow
*parentWindow
)
412 m_richTextBufferPrinting
= NULL
;
413 m_richTextBufferPreview
= NULL
;
415 m_parentWindow
= parentWindow
;
419 m_previewRect
= wxRect(wxPoint(100, 100), wxSize(800, 800));
421 m_pageSetupData
= new wxPageSetupDialogData
;
422 m_pageSetupData
->EnableMargins(true);
423 m_pageSetupData
->SetMarginTopLeft(wxPoint(25, 25));
424 m_pageSetupData
->SetMarginBottomRight(wxPoint(25, 25));
427 wxRichTextPrinting::~wxRichTextPrinting()
430 delete m_pageSetupData
;
431 delete m_richTextBufferPrinting
;
432 delete m_richTextBufferPreview
;
435 wxPrintData
*wxRichTextPrinting::GetPrintData()
437 if (m_printData
== NULL
)
438 m_printData
= new wxPrintData();
442 /// Set the rich text buffer pointer, deleting the existing object if present
443 void wxRichTextPrinting::SetRichTextBufferPrinting(wxRichTextBuffer
* buf
)
445 if (m_richTextBufferPrinting
)
447 delete m_richTextBufferPrinting
;
448 m_richTextBufferPrinting
= NULL
;
450 m_richTextBufferPrinting
= buf
;
453 void wxRichTextPrinting::SetRichTextBufferPreview(wxRichTextBuffer
* buf
)
455 if (m_richTextBufferPreview
)
457 delete m_richTextBufferPreview
;
458 m_richTextBufferPreview
= NULL
;
460 m_richTextBufferPreview
= buf
;
463 bool wxRichTextPrinting::PreviewFile(const wxString
& richTextFile
)
465 SetRichTextBufferPreview(new wxRichTextBuffer
);
467 if (!m_richTextBufferPreview
->LoadFile(richTextFile
))
469 SetRichTextBufferPreview(NULL
);
473 SetRichTextBufferPrinting(new wxRichTextBuffer(*m_richTextBufferPreview
));
475 wxRichTextPrintout
*p1
= CreatePrintout();
476 p1
->SetRichTextBuffer(m_richTextBufferPreview
);
478 wxRichTextPrintout
*p2
= CreatePrintout();
479 p2
->SetRichTextBuffer(m_richTextBufferPrinting
);
480 return DoPreview(p1
, p2
);
483 bool wxRichTextPrinting::PreviewBuffer(const wxRichTextBuffer
& buffer
)
485 SetRichTextBufferPreview(new wxRichTextBuffer(buffer
));
486 SetRichTextBufferPrinting(new wxRichTextBuffer(buffer
));
488 wxRichTextPrintout
*p1
= CreatePrintout();
489 p1
->SetRichTextBuffer(m_richTextBufferPreview
);
491 wxRichTextPrintout
*p2
= CreatePrintout();
492 p2
->SetRichTextBuffer(m_richTextBufferPrinting
);
494 return DoPreview(p1
, p2
);
497 bool wxRichTextPrinting::PrintFile(const wxString
& richTextFile
)
499 SetRichTextBufferPrinting(new wxRichTextBuffer
);
501 if (!m_richTextBufferPrinting
->LoadFile(richTextFile
))
503 SetRichTextBufferPrinting(NULL
);
507 wxRichTextPrintout
*p
= CreatePrintout();
508 p
->SetRichTextBuffer(m_richTextBufferPrinting
);
510 bool ret
= DoPrint(p
);
515 bool wxRichTextPrinting::PrintBuffer(const wxRichTextBuffer
& buffer
)
517 SetRichTextBufferPrinting(new wxRichTextBuffer(buffer
));
519 wxRichTextPrintout
*p
= CreatePrintout();
520 p
->SetRichTextBuffer(m_richTextBufferPrinting
);
522 bool ret
= DoPrint(p
);
527 bool wxRichTextPrinting::DoPreview(wxRichTextPrintout
*printout1
, wxRichTextPrintout
*printout2
)
529 // Pass two printout objects: for preview, and possible printing.
530 wxPrintDialogData
printDialogData(*GetPrintData());
531 wxPrintPreview
*preview
= new wxPrintPreview(printout1
, printout2
, &printDialogData
);
538 wxPreviewFrame
*frame
= new wxPreviewFrame(preview
, m_parentWindow
,
539 m_title
+ _(" Preview"),
540 m_previewRect
.GetPosition(), m_previewRect
.GetSize());
541 frame
->Centre(wxBOTH
);
547 bool wxRichTextPrinting::DoPrint(wxRichTextPrintout
*printout
)
549 wxPrintDialogData
printDialogData(*GetPrintData());
550 wxPrinter
printer(&printDialogData
);
552 if (!printer
.Print(m_parentWindow
, printout
, true))
557 (*GetPrintData()) = printer
.GetPrintDialogData().GetPrintData();
561 void wxRichTextPrinting::PageSetup()
563 if (!GetPrintData()->Ok())
565 wxLogError(_("There was a problem during page setup: you may need to set a default printer."));
569 m_pageSetupData
->SetPrintData(*GetPrintData());
570 wxPageSetupDialog
pageSetupDialog(m_parentWindow
, m_pageSetupData
);
572 if (pageSetupDialog
.ShowModal() == wxID_OK
)
574 (*GetPrintData()) = pageSetupDialog
.GetPageSetupData().GetPrintData();
575 (*m_pageSetupData
) = pageSetupDialog
.GetPageSetupData();
579 wxRichTextPrintout
*wxRichTextPrinting::CreatePrintout()
581 wxRichTextPrintout
*p
= new wxRichTextPrintout(m_title
);
583 p
->SetHeaderFooterData(GetHeaderFooterData());
584 p
->SetMargins(10*m_pageSetupData
->GetMarginTopLeft().y
,
585 10*m_pageSetupData
->GetMarginBottomRight().y
,
586 10*m_pageSetupData
->GetMarginTopLeft().x
,
587 10*m_pageSetupData
->GetMarginBottomRight().x
);
592 /// Set/get header text, e.g. wxRICHTEXT_PAGE_ODD, wxRICHTEXT_PAGE_LEFT
593 void wxRichTextPrinting::SetHeaderText(const wxString
& text
, wxRichTextOddEvenPage page
, wxRichTextPageLocation location
)
595 m_headerFooterData
.SetHeaderText(text
, page
, location
);
598 wxString
wxRichTextPrinting::GetHeaderText(wxRichTextOddEvenPage page
, wxRichTextPageLocation location
) const
600 return m_headerFooterData
.GetHeaderText(page
, location
);
603 /// Set/get footer text, e.g. wxRICHTEXT_PAGE_ODD, wxRICHTEXT_PAGE_LEFT
604 void wxRichTextPrinting::SetFooterText(const wxString
& text
, wxRichTextOddEvenPage page
, wxRichTextPageLocation location
)
606 m_headerFooterData
.SetFooterText(text
, page
, location
);
609 wxString
wxRichTextPrinting::GetFooterText(wxRichTextOddEvenPage page
, wxRichTextPageLocation location
) const
611 return m_headerFooterData
.GetFooterText(page
, location
);
618 IMPLEMENT_CLASS(wxRichTextHeaderFooterData
, wxObject
)
621 void wxRichTextHeaderFooterData::Copy(const wxRichTextHeaderFooterData
& data
)
624 for (i
= 0; i
< 12; i
++)
625 m_text
[i
] = data
.m_text
[i
];
626 m_font
= data
.m_font
;
627 m_colour
= data
.m_colour
;
628 m_headerMargin
= data
.m_headerMargin
;
629 m_footerMargin
= data
.m_footerMargin
;
630 m_showOnFirstPage
= data
.m_showOnFirstPage
;
634 void wxRichTextHeaderFooterData::SetText(const wxString
& text
, int headerFooter
, wxRichTextOddEvenPage page
, wxRichTextPageLocation location
)
636 int idx
= headerFooter
+ (2 * (int) page
) + (4 * (int) location
);
637 wxASSERT( idx
>= 0 && idx
< 12 );
639 if (idx
>= 0 && idx
< 12)
643 wxString
wxRichTextHeaderFooterData::GetText(int headerFooter
, wxRichTextOddEvenPage page
, wxRichTextPageLocation location
) const
645 int idx
= headerFooter
+ (2 * (int) page
) + (4 * (int) location
);
646 wxASSERT( idx
>= 0 && idx
< 12 );
648 if (idx
>= 0 && idx
< 12)
651 return wxEmptyString
;
654 /// Set/get header text, e.g. wxRICHTEXT_PAGE_ODD, wxRICHTEXT_PAGE_LEFT
655 void wxRichTextHeaderFooterData::SetHeaderText(const wxString
& text
, wxRichTextOddEvenPage page
, wxRichTextPageLocation location
)
657 if (page
== wxRICHTEXT_PAGE_ALL
)
659 SetText(text
, 0, wxRICHTEXT_PAGE_ODD
, location
);
660 SetText(text
, 0, wxRICHTEXT_PAGE_EVEN
, location
);
663 SetText(text
, 0, page
, location
);
666 wxString
wxRichTextHeaderFooterData::GetHeaderText(wxRichTextOddEvenPage page
, wxRichTextPageLocation location
) const
668 return GetText(0, page
, location
);
671 /// Set/get footer text, e.g. wxRICHTEXT_PAGE_ODD, wxRICHTEXT_PAGE_LEFT
672 void wxRichTextHeaderFooterData::SetFooterText(const wxString
& text
, wxRichTextOddEvenPage page
, wxRichTextPageLocation location
)
674 if (page
== wxRICHTEXT_PAGE_ALL
)
676 SetText(text
, 1, wxRICHTEXT_PAGE_ODD
, location
);
677 SetText(text
, 1, wxRICHTEXT_PAGE_EVEN
, location
);
680 SetText(text
, 1, page
, location
);
683 wxString
wxRichTextHeaderFooterData::GetFooterText(wxRichTextOddEvenPage page
, wxRichTextPageLocation location
) const
685 return GetText(1, page
, location
);
689 void wxRichTextHeaderFooterData::Clear()
692 for (i
= 0; i
< 12; i
++)
693 m_text
[i
] = wxEmptyString
;
696 #endif // wxUSE_RICHTEXT & wxUSE_PRINTING_ARCHITECTURE