]> git.saurik.com Git - wxWidgets.git/blame - src/richtext/richtexthtml.cpp
guard code for mac / quickdraw
[wxWidgets.git] / src / richtext / richtexthtml.cpp
CommitLineData
b71e9aa4 1/////////////////////////////////////////////////////////////////////////////
40989e46 2// Name: src/richtext/richtexthtml.cpp
b71e9aa4
JS
3// Purpose: HTML I/O for wxRichTextCtrl
4// Author: Julian Smart
5// Modified by:
6// Created: 2005-09-30
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12// For compilers that support precompilation, includes "wx.h".
13#include "wx/wxprec.h"
14
15#ifdef __BORLANDC__
40989e46 16 #pragma hdrstop
b71e9aa4
JS
17#endif
18
19#if wxUSE_RICHTEXT
20
21#include "wx/richtext/richtexthtml.h"
50f65288 22#include "wx/richtext/richtextstyles.h"
b71e9aa4
JS
23
24#ifndef WX_PRECOMP
b71e9aa4
JS
25#endif
26
27#include "wx/filename.h"
28#include "wx/wfstream.h"
29#include "wx/txtstrm.h"
30
d2d0adc7
JS
31#if wxUSE_FILESYSTEM
32#include "wx/filesys.h"
33#include "wx/fs_mem.h"
34#endif
35
b71e9aa4
JS
36IMPLEMENT_DYNAMIC_CLASS(wxRichTextHTMLHandler, wxRichTextFileHandler)
37
d2d0adc7
JS
38int wxRichTextHTMLHandler::sm_fileCounter = 1;
39
50f65288
WS
40wxRichTextHTMLHandler::wxRichTextHTMLHandler(const wxString& name, const wxString& ext, int type)
41 : wxRichTextFileHandler(name, ext, type), m_buffer(NULL), m_font(false), m_inTable(false)
42{
43 m_fontSizeMapping.Add(8);
44 m_fontSizeMapping.Add(10);
45 m_fontSizeMapping.Add(13);
46 m_fontSizeMapping.Add(17);
47 m_fontSizeMapping.Add(22);
48 m_fontSizeMapping.Add(30);
49 m_fontSizeMapping.Add(100);
50}
51
b71e9aa4
JS
52/// Can we handle this filename (if using files)? By default, checks the extension.
53bool wxRichTextHTMLHandler::CanHandle(const wxString& filename) const
54{
55 wxString path, file, ext;
56 wxSplitPath(filename, & path, & file, & ext);
57
58 return (ext.Lower() == wxT("html") || ext.Lower() == wxT("htm"));
59}
60
61
62#if wxUSE_STREAMS
63bool wxRichTextHTMLHandler::DoLoadFile(wxRichTextBuffer *WXUNUSED(buffer), wxInputStream& WXUNUSED(stream))
64{
65 return false;
66}
67
68/*
69 * We need to output only _changes_ in character formatting.
70 */
71
72bool wxRichTextHTMLHandler::DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream)
73{
50f65288
WS
74 m_buffer = buffer;
75
d2d0adc7
JS
76 ClearTemporaryImageLocations();
77
b71e9aa4 78 buffer->Defragment();
b72812a6 79
b71e9aa4 80 wxTextOutputStream str(stream);
40989e46 81
44cc96a8
JS
82 wxTextAttr currentParaStyle = buffer->GetAttributes();
83 wxTextAttr currentCharStyle = buffer->GetAttributes();
40989e46 84
b774c698
JS
85 if ((GetFlags() & wxRICHTEXT_HANDLER_NO_HEADER_FOOTER) == 0)
86 str << wxT("<html><head></head><body>\n");
40989e46 87
50f65288 88 str << wxT("<table border=0 cellpadding=0 cellspacing=0><tr><td width=\"100%\">");
40989e46 89
50f65288 90 OutputFont(currentParaStyle, str);
b72812a6 91
2dec6761 92 m_font = false;
50f65288 93 m_inTable = false;
b72812a6 94
50f65288
WS
95 m_indents.Clear();
96 m_listTypes.Clear();
40989e46 97
b71e9aa4
JS
98 wxRichTextObjectList::compatibility_iterator node = buffer->GetChildren().GetFirst();
99 while (node)
100 {
101 wxRichTextParagraph* para = wxDynamicCast(node->GetData(), wxRichTextParagraph);
102 wxASSERT (para != NULL);
40989e46 103
b71e9aa4
JS
104 if (para)
105 {
44cc96a8 106 wxTextAttr paraStyle(para->GetCombinedAttributes());
b72812a6 107
50f65288 108 BeginParagraphFormatting(currentParaStyle, paraStyle, str);
40989e46 109
b71e9aa4
JS
110 wxRichTextObjectList::compatibility_iterator node2 = para->GetChildren().GetFirst();
111 while (node2)
112 {
113 wxRichTextObject* obj = node2->GetData();
114 wxRichTextPlainText* textObj = wxDynamicCast(obj, wxRichTextPlainText);
115 if (textObj && !textObj->IsEmpty())
116 {
44cc96a8 117 wxTextAttr charStyle(para->GetCombinedAttributes(obj->GetAttributes()));
50f65288 118 BeginCharacterFormatting(currentCharStyle, charStyle, paraStyle, str);
b72812a6 119
42688aea 120 wxString text = textObj->GetText();
40989e46 121
42688aea
JS
122 if (charStyle.HasTextEffects() && (charStyle.GetTextEffects() & wxTEXT_ATTR_EFFECT_CAPITALS))
123 text.MakeUpper();
124
50f65288
WS
125 wxString toReplace = wxRichTextLineBreakChar;
126 text.Replace(toReplace, wxT("<br>"));
127
42688aea 128 str << text;
40989e46 129
50f65288 130 EndCharacterFormatting(currentCharStyle, charStyle, paraStyle, str);
b71e9aa4 131 }
40989e46 132
2dec6761
JS
133 wxRichTextImage* image = wxDynamicCast(obj, wxRichTextImage);
134 if( image && !image->IsEmpty())
d2d0adc7 135 WriteImage( image, stream );
40989e46 136
b71e9aa4
JS
137 node2 = node2->GetNext();
138 }
50f65288
WS
139
140 EndParagraphFormatting(currentParaStyle, paraStyle, str);
141
d5363f57 142 str << wxT("\n");
b71e9aa4 143 }
b71e9aa4
JS
144 node = node->GetNext();
145 }
b72812a6 146
50f65288 147 CloseLists(-1, str);
40989e46 148
50f65288 149 str << wxT("</font>");
b72812a6 150
50f65288 151 str << wxT("</td></tr></table><p>");
b774c698
JS
152
153 if ((GetFlags() & wxRICHTEXT_HANDLER_NO_HEADER_FOOTER) == 0)
154 str << wxT("</body></html>");
b72812a6 155
b774c698 156 str << wxT("\n");
40989e46 157
50f65288
WS
158 m_buffer = NULL;
159
b71e9aa4
JS
160 return true;
161}
162
44cc96a8 163void wxRichTextHTMLHandler::BeginCharacterFormatting(const wxTextAttr& currentStyle, const wxTextAttr& thisStyle, const wxTextAttr& WXUNUSED(paraStyle), wxTextOutputStream& str)
b71e9aa4 164{
2dec6761 165 wxString style;
40989e46 166
d2d0adc7 167 // Is there any change in the font properties of the item?
44cc96a8 168 if (thisStyle.GetFontFaceName() != currentStyle.GetFontFaceName())
d2d0adc7 169 {
44cc96a8 170 wxString faceName(thisStyle.GetFontFaceName());
d2d0adc7
JS
171 style += wxString::Format(wxT(" face=\"%s\""), faceName.c_str());
172 }
44cc96a8
JS
173 if (thisStyle.GetFontSize() != currentStyle.GetFontSize())
174 style += wxString::Format(wxT(" size=\"%ld\""), PtToSize(thisStyle.GetFontSize()));
d2d0adc7
JS
175 if (thisStyle.GetTextColour() != currentStyle.GetTextColour() )
176 {
177 wxString color(thisStyle.GetTextColour().GetAsString(wxC2S_HTML_SYNTAX));
178 style += wxString::Format(wxT(" color=\"%s\""), color.c_str());
179 }
40989e46 180
d2d0adc7 181 if (style.size())
21e354f1
JS
182 {
183 str << wxString::Format(wxT("<font %s >"), style.c_str());
184 m_font = true;
185 }
40989e46 186
44cc96a8 187 if (thisStyle.GetFontWeight() == wxBOLD)
2dec6761 188 str << wxT("<b>");
44cc96a8 189 if (thisStyle.GetFontStyle() == wxITALIC)
2dec6761 190 str << wxT("<i>");
44cc96a8 191 if (thisStyle.GetFontUnderlined())
2dec6761 192 str << wxT("<u>");
b72812a6 193
d2d0adc7
JS
194 if (thisStyle.HasURL())
195 str << wxT("<a href=\"") << thisStyle.GetURL() << wxT("\">");
b71e9aa4
JS
196}
197
44cc96a8 198void wxRichTextHTMLHandler::EndCharacterFormatting(const wxTextAttr& WXUNUSED(currentStyle), const wxTextAttr& thisStyle, const wxTextAttr& WXUNUSED(paraStyle), wxTextOutputStream& stream)
b71e9aa4 199{
d2d0adc7 200 if (thisStyle.HasURL())
50f65288 201 stream << wxT("</a>");
d2d0adc7 202
44cc96a8 203 if (thisStyle.GetFontUnderlined())
50f65288 204 stream << wxT("</u>");
44cc96a8 205 if (thisStyle.GetFontStyle() == wxITALIC)
50f65288 206 stream << wxT("</i>");
44cc96a8 207 if (thisStyle.GetFontWeight() == wxBOLD)
50f65288 208 stream << wxT("</b>");
40989e46 209
d2d0adc7 210 if (m_font)
2dec6761
JS
211 {
212 m_font = false;
50f65288 213 stream << wxT("</font>");
2dec6761
JS
214 }
215}
b71e9aa4 216
50f65288 217/// Begin paragraph formatting
44cc96a8 218void wxRichTextHTMLHandler::BeginParagraphFormatting(const wxTextAttr& WXUNUSED(currentStyle), const wxTextAttr& thisStyle, wxTextOutputStream& str)
2dec6761 219{
42688aea
JS
220 if (thisStyle.HasPageBreak())
221 {
50f65288 222 str << wxT("</tr></td></table>");
42688aea 223 str << wxT("<div style=\"page-break-after:always\"></div>\n");
50f65288 224 str << wxT("<table border=0 cellpadding=0 cellspacing=0><tr><td width=\"100%\">");
42688aea 225 }
40989e46 226
7947a11d 227 if (thisStyle.HasLeftIndent() && thisStyle.GetLeftIndent() != 0)
2dec6761 228 {
50f65288 229 if (thisStyle.HasBulletStyle())
2dec6761 230 {
50f65288
WS
231 int indent = thisStyle.GetLeftIndent();
232
233 // Close levels high than this
234 CloseLists(indent, str);
b72812a6 235
50f65288
WS
236 if (m_indents.GetCount() > 0 && indent == m_indents.Last())
237 {
238 // Same level, no need to start a new list
239 }
240 else if (m_indents.GetCount() == 0 || indent > m_indents.Last())
241 {
242 m_indents.Add(indent);
b72812a6 243
50f65288
WS
244 wxString tag;
245 int listType = TypeOfList(thisStyle, tag);
246 m_listTypes.Add(listType);
b72812a6 247
50f65288
WS
248 wxString align = GetAlignment(thisStyle);
249 str << wxString::Format(wxT("<p align=\"%s\">"), align.c_str());
b72812a6 250
50f65288
WS
251 str << tag;
252 }
b72812a6 253
50f65288 254 str << wxT("<li> ");
2dec6761 255 }
2dec6761
JS
256 else
257 {
50f65288 258 CloseLists(-1, str);
b72812a6 259
50f65288
WS
260 wxString align = GetAlignment(thisStyle);
261 str << wxString::Format(wxT("<p align=\"%s\">"), align.c_str());
40989e46 262
50f65288
WS
263 // Use a table
264 int indentTenthsMM = thisStyle.GetLeftIndent() + thisStyle.GetLeftSubIndent();
265 // TODO: convert to pixels
266 int indentPixels = indentTenthsMM/4;
267 str << wxString::Format(wxT("<table border=0 cellpadding=0 cellspacing=0><tr><td width=\"%d\"></td><td>"), indentPixels);
268
269 OutputFont(thisStyle, str);
40989e46 270
50f65288 271 if (thisStyle.GetLeftSubIndent() < 0)
d2d0adc7 272 {
50f65288 273 str << SymbolicIndent( - thisStyle.GetLeftSubIndent());
d2d0adc7 274 }
50f65288 275
b72812a6 276 m_inTable = true;
2dec6761
JS
277 }
278 }
50f65288
WS
279 else
280 {
281 CloseLists(-1, str);
282
283 wxString align = GetAlignment(thisStyle);
284 str << wxString::Format(wxT("<p align=\"%s\">"), align.c_str());
b72812a6 285 }
2dec6761 286}
50f65288
WS
287
288/// End paragraph formatting
44cc96a8 289void wxRichTextHTMLHandler::EndParagraphFormatting(const wxTextAttr& WXUNUSED(currentStyle), const wxTextAttr& thisStyle, wxTextOutputStream& stream)
2dec6761 290{
50f65288 291 if (m_inTable)
2dec6761 292 {
50f65288
WS
293 if (thisStyle.HasFont())
294 stream << wxT("</font>");
b72812a6 295
50f65288
WS
296 stream << wxT("</td></tr></table>\n");
297 m_inTable = false;
2dec6761
JS
298 }
299}
300
50f65288
WS
301/// Closes lists to level (-1 means close all)
302void wxRichTextHTMLHandler::CloseLists(int level, wxTextOutputStream& str)
303{
304 // Close levels high than this
305 int i = m_indents.GetCount()-1;
306 while (i >= 0)
307 {
308 int l = m_indents[i];
309 if (l > level)
310 {
311 if (m_listTypes[i] == 0)
312 str << wxT("</ol>");
313 else
314 str << wxT("</ul>");
315 m_indents.RemoveAt(i);
316 m_listTypes.RemoveAt(i);
317 }
318 else
319 break;
320 i --;
321 }
322}
323
324/// Output font tag
44cc96a8 325void wxRichTextHTMLHandler::OutputFont(const wxTextAttr& style, wxTextOutputStream& stream)
2dec6761 326{
50f65288
WS
327 if (style.HasFont())
328 {
44cc96a8 329 stream << wxString::Format(wxT("<font face=\"%s\" size=\"%ld\""), style.GetFontFaceName().c_str(), PtToSize(style.GetFontSize()));
b72812a6
JS
330 if (style.HasTextColour())
331 stream << wxString::Format(wxT(" color=\"%s\""), style.GetTextColour().GetAsString(wxC2S_HTML_SYNTAX).c_str());
332 stream << wxT(" >");
50f65288 333 }
2dec6761
JS
334}
335
44cc96a8 336int wxRichTextHTMLHandler::TypeOfList( const wxTextAttr& thisStyle, wxString& tag )
2dec6761 337{
d2d0adc7
JS
338 // We can use number attribute of li tag but not all the browsers support it.
339 // also wxHtmlWindow doesn't support type attribute.
40989e46 340
50f65288 341 bool m_is_ul = false;
d2d0adc7 342 if (thisStyle.GetBulletStyle() == (wxTEXT_ATTR_BULLET_STYLE_ARABIC|wxTEXT_ATTR_BULLET_STYLE_PERIOD))
2dec6761 343 tag = wxT("<ol type=\"1\">");
d2d0adc7 344 else if (thisStyle.GetBulletStyle() == wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER)
2dec6761 345 tag = wxT("<ol type=\"A\">");
d2d0adc7 346 else if (thisStyle.GetBulletStyle() == wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER)
2dec6761 347 tag = wxT("<ol type=\"a\">");
d2d0adc7 348 else if (thisStyle.GetBulletStyle() == wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER)
2dec6761 349 tag = wxT("<ol type=\"I\">");
d2d0adc7 350 else if (thisStyle.GetBulletStyle() == wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER)
2dec6761 351 tag = wxT("<ol type=\"i\">");
b71e9aa4
JS
352 else
353 {
2dec6761
JS
354 tag = wxT("<ul>");
355 m_is_ul = true;
b71e9aa4 356 }
b72812a6 357
50f65288
WS
358 if (m_is_ul)
359 return 1;
360 else
361 return 0;
b71e9aa4
JS
362}
363
44cc96a8 364wxString wxRichTextHTMLHandler::GetAlignment( const wxTextAttr& thisStyle )
2dec6761
JS
365{
366 switch( thisStyle.GetAlignment() )
367 {
368 case wxTEXT_ALIGNMENT_LEFT:
369 return wxT("left");
370 case wxTEXT_ALIGNMENT_RIGHT:
371 return wxT("right");
372 case wxTEXT_ALIGNMENT_CENTER:
373 return wxT("center");
374 case wxTEXT_ALIGNMENT_JUSTIFIED:
375 return wxT("justify");
376 default:
377 return wxT("left");
378 }
379}
380
d2d0adc7 381void wxRichTextHTMLHandler::WriteImage(wxRichTextImage* image, wxOutputStream& stream)
2dec6761
JS
382{
383 wxTextOutputStream str(stream);
40989e46 384
2dec6761 385 str << wxT("<img src=\"");
40989e46 386
d2d0adc7
JS
387#if wxUSE_FILESYSTEM
388 if (GetFlags() & wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_MEMORY)
389 {
390 if (!image->GetImage().Ok() && image->GetImageBlock().GetData())
391 image->LoadFromBlock();
392 if (image->GetImage().Ok() && !image->GetImageBlock().GetData())
393 image->MakeBlock();
394
395 if (image->GetImage().Ok())
b72812a6 396 {
d2d0adc7 397 wxString ext(image->GetImageBlock().GetExtension());
86501081 398 wxString tempFilename(wxString::Format(wxT("image%d.%s"), sm_fileCounter, ext));
d2d0adc7 399 wxMemoryFSHandler::AddFile(tempFilename, image->GetImage(), image->GetImageBlock().GetImageType());
b72812a6 400
d2d0adc7 401 m_imageLocations.Add(tempFilename);
b72812a6 402
d2d0adc7
JS
403 str << wxT("memory:") << tempFilename;
404 }
405 else
406 str << wxT("memory:?");
40989e46 407
d2d0adc7
JS
408 sm_fileCounter ++;
409 }
410 else if (GetFlags() & wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_FILES)
411 {
412 if (!image->GetImage().Ok() && image->GetImageBlock().GetData())
413 image->LoadFromBlock();
414 if (image->GetImage().Ok() && !image->GetImageBlock().GetData())
415 image->MakeBlock();
416
417 if (image->GetImage().Ok())
b72812a6 418 {
d2d0adc7
JS
419 wxString tempDir(GetTempDir());
420 if (tempDir.IsEmpty())
421 tempDir = wxFileName::GetTempDir();
b72812a6 422
d2d0adc7 423 wxString ext(image->GetImageBlock().GetExtension());
86501081 424 wxString tempFilename(wxString::Format(wxT("%s/image%d.%s"), tempDir, sm_fileCounter, ext));
d2d0adc7 425 image->GetImageBlock().Write(tempFilename);
b72812a6 426
d2d0adc7 427 m_imageLocations.Add(tempFilename);
b72812a6
JS
428
429 str << wxFileSystem::FileNameToURL(tempFilename);
d2d0adc7
JS
430 }
431 else
432 str << wxT("file:?");
40989e46 433
d2d0adc7
JS
434 sm_fileCounter ++;
435 }
436 else // if (GetFlags() & wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_BASE64) // this is implied
437#endif
438 {
439 str << wxT("data:");
440 str << GetMimeType(image->GetImageBlock().GetImageType());
441 str << wxT(";base64,");
442
443 if (image->GetImage().Ok() && !image->GetImageBlock().GetData())
444 image->MakeBlock();
445
446 wxChar* data = b64enc( image->GetImageBlock().GetData(), image->GetImageBlock().GetDataSize() );
447 str << data;
448
449 delete[] data;
450 }
40989e46 451
2dec6761
JS
452 str << wxT("\" />");
453}
454
d2d0adc7 455long wxRichTextHTMLHandler::PtToSize(long size)
2dec6761 456{
50f65288
WS
457 int i;
458 int len = m_fontSizeMapping.GetCount();
459 for (i = 0; i < len; i++)
460 if (size <= m_fontSizeMapping[i])
461 return i+1;
b72812a6 462 return 7;
2dec6761
JS
463}
464
465wxString wxRichTextHTMLHandler::SymbolicIndent(long indent)
466{
467 wxString in;
468 for(;indent > 0; indent -= 20)
469 in.Append( wxT("&nbsp;") );
470 return in;
471}
472
21e354f1 473const wxChar* wxRichTextHTMLHandler::GetMimeType(int imageType)
2dec6761
JS
474{
475 switch(imageType)
476 {
477 case wxBITMAP_TYPE_BMP:
478 return wxT("image/bmp");
479 case wxBITMAP_TYPE_TIF:
480 return wxT("image/tiff");
481 case wxBITMAP_TYPE_GIF:
482 return wxT("image/gif");
483 case wxBITMAP_TYPE_PNG:
484 return wxT("image/png");
485 case wxBITMAP_TYPE_JPEG:
486 return wxT("image/jpeg");
487 default:
488 return wxT("image/unknown");
489 }
490}
491
d2d0adc7 492// exim-style base64 encoder
2dec6761
JS
493wxChar* wxRichTextHTMLHandler::b64enc( unsigned char* input, size_t in_len )
494{
d2d0adc7
JS
495 // elements of enc64 array must be 8 bit values
496 // otherwise encoder will fail
497 // hmmm.. Does wxT macro define a char as 16 bit value
498 // when compiling with UNICODE option?
21e354f1 499 static const wxChar enc64[] = wxT("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");
2dec6761
JS
500 wxChar* output = new wxChar[4*((in_len+2)/3)+1];
501 wxChar* p = output;
40989e46 502
2dec6761
JS
503 while( in_len-- > 0 )
504 {
505 register wxChar a, b;
40989e46 506
2dec6761 507 a = *input++;
40989e46 508
2dec6761 509 *p++ = enc64[ (a >> 2) & 0x3f ];
40989e46 510
07854e5e 511 if( in_len-- == 0 )
2dec6761
JS
512 {
513 *p++ = enc64[ (a << 4 ) & 0x30 ];
514 *p++ = '=';
515 *p++ = '=';
516 break;
517 }
40989e46 518
2dec6761 519 b = *input++;
40989e46 520
2dec6761 521 *p++ = enc64[(( a << 4 ) | ((b >> 4) &0xf )) & 0x3f];
40989e46 522
07854e5e 523 if( in_len-- == 0 )
2dec6761
JS
524 {
525 *p++ = enc64[ (b << 2) & 0x3f ];
526 *p++ = '=';
527 break;
528 }
40989e46 529
2dec6761 530 a = *input++;
40989e46 531
2dec6761 532 *p++ = enc64[ ((( b << 2 ) & 0x3f ) | ((a >> 6)& 0x3)) & 0x3f ];
40989e46 533
2dec6761
JS
534 *p++ = enc64[ a & 0x3f ];
535 }
536 *p = 0;
40989e46 537
2dec6761
JS
538 return output;
539}
b71e9aa4 540#endif
2dec6761 541// wxUSE_STREAMS
b71e9aa4 542
d2d0adc7
JS
543/// Delete the in-memory or temporary files generated by the last operation
544bool wxRichTextHTMLHandler::DeleteTemporaryImages()
545{
546 return DeleteTemporaryImages(GetFlags(), m_imageLocations);
547}
548
549/// Delete the in-memory or temporary files generated by the last operation
550bool wxRichTextHTMLHandler::DeleteTemporaryImages(int flags, const wxArrayString& imageLocations)
551{
552 size_t i;
553 for (i = 0; i < imageLocations.GetCount(); i++)
554 {
555 wxString location = imageLocations[i];
b72812a6 556
d2d0adc7
JS
557 if (flags & wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_MEMORY)
558 {
559#if wxUSE_FILESYSTEM
560 wxMemoryFSHandler::RemoveFile(location);
561#endif
562 }
563 else if (flags & wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_FILES)
564 {
565 if (wxFileExists(location))
566 wxRemoveFile(location);
567 }
568 }
b72812a6 569
d2d0adc7
JS
570 return true;
571}
572
573
b71e9aa4 574#endif
2dec6761 575// wxUSE_RICHTEXT
d2d0adc7 576