X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7fe8059f5825e58af0864e5933e43e5f0526bc76..e15f0a5ea372e3a6c693fb6aa4fe73893a9af797:/src/richtext/richtextxml.cpp?ds=sidebyside diff --git a/src/richtext/richtextxml.cpp b/src/richtext/richtextxml.cpp index 516fb41a28..555ceac23c 100644 --- a/src/richtext/richtextxml.cpp +++ b/src/richtext/richtextxml.cpp @@ -16,14 +16,14 @@ #pragma hdrstop #endif +#if wxUSE_RICHTEXT && wxUSE_XML + +#include "wx/richtext/richtextxml.h" + #ifndef WX_PRECOMP #include "wx/wx.h" #endif -#include "wx/image.h" - -#if wxUSE_RICHTEXT - #include "wx/filename.h" #include "wx/clipbrd.h" #include "wx/wfstream.h" @@ -32,8 +32,6 @@ #include "wx/txtstrm.h" #include "wx/xml/xml.h" -#include "wx/richtext/richtextxml.h" - IMPLEMENT_DYNAMIC_CLASS(wxRichTextXMLHandler, wxRichTextFileHandler) #if wxUSE_STREAMS @@ -257,14 +255,31 @@ wxString wxRichTextXMLHandler::GetText(wxXmlNode *node, const wxString& param, b return str1; } +// For use with earlier versions of wxWidgets +#ifndef WXUNUSED_IN_UNICODE +#if wxUSE_UNICODE +#define WXUNUSED_IN_UNICODE(x) WXUNUSED(x) +#else +#define WXUNUSED_IN_UNICODE(x) x +#endif +#endif + // write string to output: inline static void OutputString(wxOutputStream& stream, const wxString& str, wxMBConv *WXUNUSED_IN_UNICODE(convMem) = NULL, wxMBConv *convFile = NULL) { if (str.empty()) return; #if wxUSE_UNICODE - const wxWX2MBbuf buf(str.mb_str(convFile ? *convFile : wxConvUTF8)); - stream.Write((const char*)buf, strlen((const char*)buf)); + if (convFile) + { + const wxWX2MBbuf buf(str.mb_str(*convFile)); + stream.Write((const char*)buf, strlen((const char*)buf)); + } + else + { + const wxWX2MBbuf buf(str.mb_str(wxConvUTF8)); + stream.Write((const char*)buf, strlen((const char*)buf)); + } #else if ( convFile == NULL ) stream.Write(str.mb_str(), str.Len()); @@ -330,6 +345,7 @@ static wxOutputStream& operator <<(wxOutputStream& stream, const wxString& s) return stream; } +#if 0 static wxOutputStream& operator <<(wxOutputStream& stream, long l) { wxString str; @@ -343,6 +359,7 @@ static wxOutputStream& operator <<(wxOutputStream& stream, const char c) str.Printf(wxT("%c"), c); return stream << str; } +#endif // Convert a colour to a 6-digit hex string static wxString ColourToHexString(const wxColour& col) @@ -801,4 +818,4 @@ void wxRichTextHTMLHandler::OutputParagraphFormatting(const wxTextAttrEx& WXUNUS #endif #endif - // wxUSE_RICHTEXT + // wxUSE_RICHTEXT && wxUSE_XML