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 if ((lineY
+ line
->GetSize().y
) > rect
.GetBottom())
96 // New page starting at this line
99 // We increase the offset by the difference between new and old positions
101 int increaseOffsetBy
= lineY
- newY
;
102 yOffset
+= increaseOffsetBy
;
104 line
->SetPosition(wxPoint(line
->GetPosition().x
, newY
- child
->GetPosition().y
));
109 m_pageBreaksStart
.Add(lastStartPos
);
110 m_pageBreaksEnd
.Add(lastLine
->GetAbsoluteRange().GetEnd());
112 lastStartPos
= line
->GetAbsoluteRange().GetStart();
119 node2
= node2
->GetNext();
122 node
= node
->GetNext();
125 // Closing page break
126 if (m_pageBreaksStart
.GetCount() > 0 && (m_pageBreaksEnd
[m_pageBreaksEnd
.GetCount()-1] < (GetRichTextBuffer()->GetRange().GetEnd()-1)))
128 m_pageBreaksStart
.Add(lastStartPos
);
129 m_pageBreaksEnd
.Add(GetRichTextBuffer()->GetRange().GetEnd());
135 bool wxRichTextPrintout::OnBeginDocument(int startPage
, int endPage
)
137 if (!wxPrintout::OnBeginDocument(startPage
, endPage
)) return false;
142 bool wxRichTextPrintout::OnPrintPage(int page
)
148 RenderPage(dc
, page
);
154 void wxRichTextPrintout::GetPageInfo(int *minPage
, int *maxPage
, int *selPageFrom
, int *selPageTo
)
157 *maxPage
= m_numPages
;
159 *selPageTo
= m_numPages
;
162 bool wxRichTextPrintout::HasPage(int pageNum
)
164 return pageNum
> 0 && pageNum
<= m_numPages
;
167 void wxRichTextPrintout::RenderPage(wxDC
*dc
, int page
)
169 if (!GetRichTextBuffer())
174 wxRect textRect
, headerRect
, footerRect
;
176 /// Sets the DC scaling and returns important page rectangles
177 CalculateScaling(dc
, textRect
, headerRect
, footerRect
);
179 if (page
> 1 || m_headerFooterData
.GetShowOnFirstPage())
181 if (m_headerFooterData
.GetFont().Ok())
182 dc
->SetFont(m_headerFooterData
.GetFont());
184 dc
->SetFont(*wxNORMAL_FONT
);
185 if (m_headerFooterData
.GetTextColour().Ok())
186 dc
->SetTextForeground(m_headerFooterData
.GetTextColour());
188 dc
->SetTextForeground(*wxBLACK
);
189 dc
->SetBackgroundMode(wxTRANSPARENT
);
191 // Draw header, if any
192 wxRichTextOddEvenPage oddEven
= ((page
% 2) == 1) ? wxRICHTEXT_PAGE_ODD
: wxRICHTEXT_PAGE_EVEN
;
194 wxString headerTextCentre
= m_headerFooterData
.GetHeaderText(oddEven
, wxRICHTEXT_PAGE_CENTRE
);
195 wxString headerTextLeft
= m_headerFooterData
.GetHeaderText(oddEven
, wxRICHTEXT_PAGE_LEFT
);
196 wxString headerTextRight
= m_headerFooterData
.GetHeaderText(oddEven
, wxRICHTEXT_PAGE_RIGHT
);
198 if (!headerTextLeft
.IsEmpty())
200 SubstituteKeywords(headerTextLeft
, GetTitle(), page
, m_numPages
);
203 //dc->GetTextExtent(headerTextLeft, & tx, & ty);
205 int x
= headerRect
.GetLeft();
206 int y
= headerRect
.GetX();
207 dc
->DrawText(headerTextLeft
, x
, y
);
209 if (!headerTextCentre
.IsEmpty())
211 SubstituteKeywords(headerTextCentre
, GetTitle(), page
, m_numPages
);
214 dc
->GetTextExtent(headerTextCentre
, & tx
, & ty
);
216 int x
= headerRect
.GetWidth()/2 - tx
/2 + headerRect
.GetLeft();
217 int y
= headerRect
.GetY();
218 dc
->DrawText(headerTextCentre
, x
, y
);
220 if (!headerTextRight
.IsEmpty())
222 SubstituteKeywords(headerTextRight
, GetTitle(), page
, m_numPages
);
225 dc
->GetTextExtent(headerTextRight
, & tx
, & ty
);
227 int x
= headerRect
.GetRight() - tx
;
228 int y
= headerRect
.GetY();
229 dc
->DrawText(headerTextRight
, x
, y
);
232 // Draw footer, if any
233 wxString footerTextCentre
= m_headerFooterData
.GetFooterText(oddEven
, wxRICHTEXT_PAGE_CENTRE
);
234 wxString footerTextLeft
= m_headerFooterData
.GetFooterText(oddEven
, wxRICHTEXT_PAGE_LEFT
);
235 wxString footerTextRight
= m_headerFooterData
.GetFooterText(oddEven
, wxRICHTEXT_PAGE_RIGHT
);
237 if (!footerTextLeft
.IsEmpty())
239 SubstituteKeywords(footerTextLeft
, GetTitle(), page
, m_numPages
);
242 dc
->GetTextExtent(footerTextLeft
, & tx
, & ty
);
244 int x
= footerRect
.GetLeft();
245 int y
= footerRect
.GetBottom() - ty
;
246 dc
->DrawText(footerTextLeft
, x
, y
);
248 if (!footerTextCentre
.IsEmpty())
250 SubstituteKeywords(footerTextCentre
, GetTitle(), page
, m_numPages
);
253 dc
->GetTextExtent(footerTextCentre
, & tx
, & ty
);
255 int x
= footerRect
.GetWidth()/2 - tx
/2 + footerRect
.GetLeft();
256 int y
= footerRect
.GetBottom() - ty
;
257 dc
->DrawText(footerTextCentre
, x
, y
);
259 if (!footerTextRight
.IsEmpty())
261 SubstituteKeywords(footerTextRight
, GetTitle(), page
, m_numPages
);
264 dc
->GetTextExtent(footerTextRight
, & tx
, & ty
);
266 int x
= footerRect
.GetRight() - tx
;
267 int y
= footerRect
.GetBottom() - ty
;
268 dc
->DrawText(footerTextRight
, x
, y
);
272 wxRichTextRange
rangeToDraw(m_pageBreaksStart
[page
-1], m_pageBreaksEnd
[page
-1]);
274 GetRichTextBuffer()->Draw(*dc
, rangeToDraw
, wxRichTextRange(-1,-1), textRect
, 0 /* descent */, wxRICHTEXT_DRAW_IGNORE_CACHE
/* flags */);
277 void wxRichTextPrintout::SetMargins(int top
, int bottom
, int left
, int right
)
280 m_marginBottom
= bottom
;
282 m_marginRight
= right
;
285 /// Calculate scaling and rectangles, setting the device context scaling
286 void wxRichTextPrintout::CalculateScaling(wxDC
* dc
, wxRect
& textRect
, wxRect
& headerRect
, wxRect
& footerRect
)
288 // Get the logical pixels per inch of screen and printer
289 int ppiScreenX
, ppiScreenY
;
290 GetPPIScreen(&ppiScreenX
, &ppiScreenY
);
291 int ppiPrinterX
, ppiPrinterY
;
292 GetPPIPrinter(&ppiPrinterX
, &ppiPrinterY
);
294 // This scales the DC so that the printout roughly represents the
295 // the screen scaling.
296 float scale
= (float)((float)ppiPrinterX
/(float)ppiScreenX
);
298 // Now we have to check in case our real page size is reduced
299 // (e.g. because we're drawing to a print preview memory DC)
300 int pageWidth
, pageHeight
;
303 GetPageSizePixels(&pageWidth
, &pageHeight
);
305 // If printer pageWidth == current DC width, then this doesn't
306 // change. But w might be the preview bitmap width, so scale down.
307 float previewScale
= (float)(w
/(float)pageWidth
);
308 float overallScale
= scale
* previewScale
;
310 // The dimensions used for indentation etc. have to be unscaled
311 // during printing to be correct when scaling is applied.
313 m_richTextBuffer
->SetScale(scale
);
316 int marginLeft
= wxRichTextObject::ConvertTenthsMMToPixels(ppiPrinterX
, m_marginLeft
);
317 int marginTop
= wxRichTextObject::ConvertTenthsMMToPixels(ppiPrinterX
, m_marginTop
);
318 int marginRight
= wxRichTextObject::ConvertTenthsMMToPixels(ppiPrinterX
, m_marginRight
);
319 int marginBottom
= wxRichTextObject::ConvertTenthsMMToPixels(ppiPrinterX
, m_marginBottom
);
321 // Header and footer margins
322 int headerMargin
= wxRichTextObject::ConvertTenthsMMToPixels(ppiPrinterX
, m_headerFooterData
.GetHeaderMargin());
323 int footerMargin
= wxRichTextObject::ConvertTenthsMMToPixels(ppiPrinterX
, m_headerFooterData
.GetFooterMargin());
325 dc
->SetUserScale(overallScale
, overallScale
);
327 wxRect
rect((int) (marginLeft
/scale
), (int) (marginTop
/scale
),
328 (int) ((pageWidth
- marginLeft
- marginRight
)/scale
), (int)((pageHeight
- marginTop
- marginBottom
)/scale
));
330 headerRect
= wxRect(0, 0, 0, 0);
332 if (!m_headerFooterData
.GetHeaderText(wxRICHTEXT_PAGE_ODD
, wxRICHTEXT_PAGE_LEFT
).IsEmpty() ||
333 !m_headerFooterData
.GetHeaderText(wxRICHTEXT_PAGE_ODD
, wxRICHTEXT_PAGE_CENTRE
).IsEmpty() ||
334 !m_headerFooterData
.GetHeaderText(wxRICHTEXT_PAGE_ODD
, wxRICHTEXT_PAGE_RIGHT
).IsEmpty() ||
336 !m_headerFooterData
.GetHeaderText(wxRICHTEXT_PAGE_EVEN
, wxRICHTEXT_PAGE_LEFT
).IsEmpty() ||
337 !m_headerFooterData
.GetHeaderText(wxRICHTEXT_PAGE_EVEN
, wxRICHTEXT_PAGE_CENTRE
).IsEmpty() ||
338 !m_headerFooterData
.GetHeaderText(wxRICHTEXT_PAGE_EVEN
, wxRICHTEXT_PAGE_RIGHT
).IsEmpty())
340 if (m_headerFooterData
.GetFont().Ok())
341 dc
->SetFont(m_headerFooterData
.GetFont());
343 dc
->SetFont(*wxNORMAL_FONT
);
345 int charHeight
= dc
->GetCharHeight();
347 int headerHeight
= (int) (charHeight
+ headerMargin
/scale
);
349 headerRect
= wxRect(rect
.x
, rect
.y
, rect
.width
, headerHeight
);
351 rect
.y
+= headerHeight
;
352 rect
.height
-= headerHeight
;
355 footerRect
= wxRect(0, 0, 0, 0);
357 if (!m_headerFooterData
.GetFooterText(wxRICHTEXT_PAGE_ODD
, wxRICHTEXT_PAGE_LEFT
).IsEmpty() ||
358 !m_headerFooterData
.GetFooterText(wxRICHTEXT_PAGE_ODD
, wxRICHTEXT_PAGE_CENTRE
).IsEmpty() ||
359 !m_headerFooterData
.GetFooterText(wxRICHTEXT_PAGE_ODD
, wxRICHTEXT_PAGE_RIGHT
).IsEmpty() ||
361 !m_headerFooterData
.GetFooterText(wxRICHTEXT_PAGE_EVEN
, wxRICHTEXT_PAGE_LEFT
).IsEmpty() ||
362 !m_headerFooterData
.GetFooterText(wxRICHTEXT_PAGE_EVEN
, wxRICHTEXT_PAGE_CENTRE
).IsEmpty() ||
363 !m_headerFooterData
.GetFooterText(wxRICHTEXT_PAGE_EVEN
, wxRICHTEXT_PAGE_RIGHT
).IsEmpty())
365 if (m_headerFooterData
.GetFont().Ok())
366 dc
->SetFont(m_headerFooterData
.GetFont());
368 dc
->SetFont(*wxNORMAL_FONT
);
370 int charHeight
= dc
->GetCharHeight();
372 int footerHeight
= (int) (charHeight
+ footerMargin
/scale
);
374 footerRect
= wxRect(rect
.x
, rect
.y
+ rect
.height
, rect
.width
, footerHeight
);
376 rect
.height
-= footerHeight
;
382 bool wxRichTextPrintout::SubstituteKeywords(wxString
& str
, const wxString
& title
, int pageNum
, int pageCount
)
386 num
.Printf(wxT("%i"), pageNum
);
387 str
.Replace(wxT("@PAGENUM@"), num
);
389 num
.Printf(wxT("%lu"), (unsigned long) pageCount
);
390 str
.Replace(wxT("@PAGESCNT@"), num
);
392 wxDateTime now
= wxDateTime::Now();
394 str
.Replace(wxT("@DATE@"), now
.FormatDate());
395 str
.Replace(wxT("@TIME@"), now
.FormatTime());
397 str
.Replace(wxT("@TITLE@"), title
);
406 wxRichTextPrinting::wxRichTextPrinting(const wxString
& name
, wxWindow
*parentWindow
)
408 m_richTextBufferPrinting
= NULL
;
409 m_richTextBufferPreview
= NULL
;
411 m_parentWindow
= parentWindow
;
415 m_previewRect
= wxRect(wxPoint(100, 100), wxSize(800, 800));
417 m_pageSetupData
= new wxPageSetupDialogData
;
418 m_pageSetupData
->EnableMargins(true);
419 m_pageSetupData
->SetMarginTopLeft(wxPoint(25, 25));
420 m_pageSetupData
->SetMarginBottomRight(wxPoint(25, 25));
423 wxRichTextPrinting::~wxRichTextPrinting()
426 delete m_pageSetupData
;
427 delete m_richTextBufferPrinting
;
428 delete m_richTextBufferPreview
;
431 wxPrintData
*wxRichTextPrinting::GetPrintData()
433 if (m_printData
== NULL
)
434 m_printData
= new wxPrintData();
438 /// Set the rich text buffer pointer, deleting the existing object if present
439 void wxRichTextPrinting::SetRichTextBufferPrinting(wxRichTextBuffer
* buf
)
441 if (m_richTextBufferPrinting
)
443 delete m_richTextBufferPrinting
;
444 m_richTextBufferPrinting
= NULL
;
446 m_richTextBufferPrinting
= buf
;
449 void wxRichTextPrinting::SetRichTextBufferPreview(wxRichTextBuffer
* buf
)
451 if (m_richTextBufferPreview
)
453 delete m_richTextBufferPreview
;
454 m_richTextBufferPreview
= NULL
;
456 m_richTextBufferPreview
= buf
;
459 bool wxRichTextPrinting::PreviewFile(const wxString
& richTextFile
)
461 SetRichTextBufferPreview(new wxRichTextBuffer
);
463 if (!m_richTextBufferPreview
->LoadFile(richTextFile
))
465 SetRichTextBufferPreview(NULL
);
469 SetRichTextBufferPrinting(new wxRichTextBuffer(*m_richTextBufferPreview
));
471 wxRichTextPrintout
*p1
= CreatePrintout();
472 p1
->SetRichTextBuffer(m_richTextBufferPreview
);
474 wxRichTextPrintout
*p2
= CreatePrintout();
475 p2
->SetRichTextBuffer(m_richTextBufferPrinting
);
476 return DoPreview(p1
, p2
);
479 bool wxRichTextPrinting::PreviewBuffer(const wxRichTextBuffer
& buffer
)
481 SetRichTextBufferPreview(new wxRichTextBuffer(buffer
));
482 SetRichTextBufferPrinting(new wxRichTextBuffer(buffer
));
484 wxRichTextPrintout
*p1
= CreatePrintout();
485 p1
->SetRichTextBuffer(m_richTextBufferPreview
);
487 wxRichTextPrintout
*p2
= CreatePrintout();
488 p2
->SetRichTextBuffer(m_richTextBufferPrinting
);
490 return DoPreview(p1
, p2
);
493 bool wxRichTextPrinting::PrintFile(const wxString
& richTextFile
)
495 SetRichTextBufferPrinting(new wxRichTextBuffer
);
497 if (!m_richTextBufferPrinting
->LoadFile(richTextFile
))
499 SetRichTextBufferPrinting(NULL
);
503 wxRichTextPrintout
*p
= CreatePrintout();
504 p
->SetRichTextBuffer(m_richTextBufferPrinting
);
506 bool ret
= DoPrint(p
);
511 bool wxRichTextPrinting::PrintBuffer(const wxRichTextBuffer
& buffer
)
513 SetRichTextBufferPrinting(new wxRichTextBuffer(buffer
));
515 wxRichTextPrintout
*p
= CreatePrintout();
516 p
->SetRichTextBuffer(m_richTextBufferPrinting
);
518 bool ret
= DoPrint(p
);
523 bool wxRichTextPrinting::DoPreview(wxRichTextPrintout
*printout1
, wxRichTextPrintout
*printout2
)
525 // Pass two printout objects: for preview, and possible printing.
526 wxPrintDialogData
printDialogData(*GetPrintData());
527 wxPrintPreview
*preview
= new wxPrintPreview(printout1
, printout2
, &printDialogData
);
534 wxPreviewFrame
*frame
= new wxPreviewFrame(preview
, m_parentWindow
,
535 m_title
+ _(" Preview"),
536 m_previewRect
.GetPosition(), m_previewRect
.GetSize());
537 frame
->Centre(wxBOTH
);
543 bool wxRichTextPrinting::DoPrint(wxRichTextPrintout
*printout
)
545 wxPrintDialogData
printDialogData(*GetPrintData());
546 wxPrinter
printer(&printDialogData
);
548 if (!printer
.Print(m_parentWindow
, printout
, true))
553 (*GetPrintData()) = printer
.GetPrintDialogData().GetPrintData();
557 void wxRichTextPrinting::PageSetup()
559 if (!GetPrintData()->Ok())
561 wxLogError(_("There was a problem during page setup: you may need to set a default printer."));
565 m_pageSetupData
->SetPrintData(*GetPrintData());
566 wxPageSetupDialog
pageSetupDialog(m_parentWindow
, m_pageSetupData
);
568 if (pageSetupDialog
.ShowModal() == wxID_OK
)
570 (*GetPrintData()) = pageSetupDialog
.GetPageSetupData().GetPrintData();
571 (*m_pageSetupData
) = pageSetupDialog
.GetPageSetupData();
575 wxRichTextPrintout
*wxRichTextPrinting::CreatePrintout()
577 wxRichTextPrintout
*p
= new wxRichTextPrintout(m_title
);
579 p
->SetHeaderFooterData(GetHeaderFooterData());
580 p
->SetMargins(10*m_pageSetupData
->GetMarginTopLeft().y
,
581 10*m_pageSetupData
->GetMarginBottomRight().y
,
582 10*m_pageSetupData
->GetMarginTopLeft().x
,
583 10*m_pageSetupData
->GetMarginBottomRight().x
);
588 /// Set/get header text, e.g. wxRICHTEXT_PAGE_ODD, wxRICHTEXT_PAGE_LEFT
589 void wxRichTextPrinting::SetHeaderText(const wxString
& text
, wxRichTextOddEvenPage page
, wxRichTextPageLocation location
)
591 m_headerFooterData
.SetHeaderText(text
, page
, location
);
594 wxString
wxRichTextPrinting::GetHeaderText(wxRichTextOddEvenPage page
, wxRichTextPageLocation location
) const
596 return m_headerFooterData
.GetHeaderText(page
, location
);
599 /// Set/get footer text, e.g. wxRICHTEXT_PAGE_ODD, wxRICHTEXT_PAGE_LEFT
600 void wxRichTextPrinting::SetFooterText(const wxString
& text
, wxRichTextOddEvenPage page
, wxRichTextPageLocation location
)
602 m_headerFooterData
.SetFooterText(text
, page
, location
);
605 wxString
wxRichTextPrinting::GetFooterText(wxRichTextOddEvenPage page
, wxRichTextPageLocation location
) const
607 return m_headerFooterData
.GetFooterText(page
, location
);
614 IMPLEMENT_CLASS(wxRichTextHeaderFooterData
, wxObject
)
617 void wxRichTextHeaderFooterData::Copy(const wxRichTextHeaderFooterData
& data
)
620 for (i
= 0; i
< 12; i
++)
621 m_text
[i
] = data
.m_text
[i
];
622 m_font
= data
.m_font
;
623 m_colour
= data
.m_colour
;
624 m_headerMargin
= data
.m_headerMargin
;
625 m_footerMargin
= data
.m_footerMargin
;
626 m_showOnFirstPage
= data
.m_showOnFirstPage
;
630 void wxRichTextHeaderFooterData::SetText(const wxString
& text
, int headerFooter
, wxRichTextOddEvenPage page
, wxRichTextPageLocation location
)
632 int idx
= headerFooter
+ (2 * (int) page
) + (4 * (int) location
);
633 wxASSERT( idx
>= 0 && idx
< 12 );
635 if (idx
>= 0 && idx
< 12)
639 wxString
wxRichTextHeaderFooterData::GetText(int headerFooter
, wxRichTextOddEvenPage page
, wxRichTextPageLocation location
) const
641 int idx
= headerFooter
+ (2 * (int) page
) + (4 * (int) location
);
642 wxASSERT( idx
>= 0 && idx
< 12 );
644 if (idx
>= 0 && idx
< 12)
647 return wxEmptyString
;
650 /// Set/get header text, e.g. wxRICHTEXT_PAGE_ODD, wxRICHTEXT_PAGE_LEFT
651 void wxRichTextHeaderFooterData::SetHeaderText(const wxString
& text
, wxRichTextOddEvenPage page
, wxRichTextPageLocation location
)
653 if (page
== wxRICHTEXT_PAGE_ALL
)
655 SetText(text
, 0, wxRICHTEXT_PAGE_ODD
, location
);
656 SetText(text
, 0, wxRICHTEXT_PAGE_EVEN
, location
);
659 SetText(text
, 0, page
, location
);
662 wxString
wxRichTextHeaderFooterData::GetHeaderText(wxRichTextOddEvenPage page
, wxRichTextPageLocation location
) const
664 return GetText(0, page
, location
);
667 /// Set/get footer text, e.g. wxRICHTEXT_PAGE_ODD, wxRICHTEXT_PAGE_LEFT
668 void wxRichTextHeaderFooterData::SetFooterText(const wxString
& text
, wxRichTextOddEvenPage page
, wxRichTextPageLocation location
)
670 if (page
== wxRICHTEXT_PAGE_ALL
)
672 SetText(text
, 1, wxRICHTEXT_PAGE_ODD
, location
);
673 SetText(text
, 1, wxRICHTEXT_PAGE_EVEN
, location
);
676 SetText(text
, 1, page
, location
);
679 wxString
wxRichTextHeaderFooterData::GetFooterText(wxRichTextOddEvenPage page
, wxRichTextPageLocation location
) const
681 return GetText(1, page
, location
);
685 void wxRichTextHeaderFooterData::Clear()
688 for (i
= 0; i
< 12; i
++)
689 m_text
[i
] = wxEmptyString
;
692 #endif // wxUSE_RICHTEXT & wxUSE_PRINTING_ARCHITECTURE