]> git.saurik.com Git - wxWidgets.git/blobdiff - src/richtext/richtextxml.cpp
generate size event when the dialog is shown for consistency with frames and other...
[wxWidgets.git] / src / richtext / richtextxml.cpp
index c09d3342976be19dc3e1891fb0450fa574613d4a..74d6bbf9d70103bc042ae2e3abc434fb65965175 100644 (file)
@@ -23,6 +23,7 @@
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
     #include "wx/module.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/filename.h"
@@ -172,10 +173,18 @@ bool wxRichTextXMLHandler::ImportXML(wxRichTextBuffer* buffer, wxXmlNode* node)
             }
             else if (childName == wxT("image"))
             {
-                int imageType = wxBITMAP_TYPE_PNG;
+                wxBitmapType imageType = wxBITMAP_TYPE_PNG;
                 wxString value = node->GetAttribute(wxT("imagetype"), wxEmptyString);
                 if (!value.empty())
-                    imageType = wxAtoi(value);
+                {
+                    int type = wxAtoi(value);
+
+                    // note: 0 == wxBITMAP_TYPE_INVALID
+                    if (type <= 0 || type >= wxBITMAP_TYPE_MAX)
+                        wxLogWarning("Invalid bitmap type specified for <image> tag: %d", type);
+                    else
+                        imageType = (wxBitmapType)type;
+                }
 
                 wxString data;
 
@@ -718,7 +727,7 @@ bool wxRichTextXMLHandler::ExportXML(wxOutputStream& stream, wxMBConv* convMem,
         else for (i = 0; i < len; i++)
         {
             int c = (int) text[i];
-            if (c < 32 && c != 9 && c != 10 && c != 13)
+            if ((c < 32 || c == 34) && c != 9 && c != 10 && c != 13)
             {
                 if (i > 0)
                 {