Separated XML and HTML rich text I/O handlers

Cleaned up XML I/O
Added HTML handler to build system
Added encoding member for saving files output


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36427 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 2005-12-18 12:31:07 +00:00
parent 63886f6d98
commit b71e9aa4e2
13 changed files with 452 additions and 245 deletions

View File

@ -4224,6 +4224,7 @@ COND_WXUNIV_0___ADVANCED_SRC_OBJECTS = \
monodll_richtextbuffer.o \
monodll_richtextstyles.o \
monodll_richtextxml.o \
monodll_richtexthtml.o \
$(__ADVANCED_PLATFORM_SRC_OBJECTS) \
$(__ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS)
@COND_WXUNIV_0@__ADVANCED_SRC_OBJECTS = $(COND_WXUNIV_0___ADVANCED_SRC_OBJECTS)
@ -4244,6 +4245,7 @@ COND_WXUNIV_1___ADVANCED_SRC_OBJECTS = \
monodll_richtextbuffer.o \
monodll_richtextstyles.o \
monodll_richtextxml.o \
monodll_richtexthtml.o \
$(__ADVANCED_PLATFORM_SRC_OBJECTS)
@COND_WXUNIV_1@__ADVANCED_SRC_OBJECTS = $(COND_WXUNIV_1___ADVANCED_SRC_OBJECTS)
@COND_TOOLKIT_MSW@__ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS \
@ -5706,6 +5708,7 @@ COND_WXUNIV_0___ADVANCED_SRC_OBJECTS_1 = \
monolib_richtextbuffer.o \
monolib_richtextstyles.o \
monolib_richtextxml.o \
monolib_richtexthtml.o \
$(__ADVANCED_PLATFORM_SRC_OBJECTS_0) \
$(__ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_1)
@COND_WXUNIV_0@__ADVANCED_SRC_OBJECTS_1 = $(COND_WXUNIV_0___ADVANCED_SRC_OBJECTS_1)
@ -5726,6 +5729,7 @@ COND_WXUNIV_1___ADVANCED_SRC_OBJECTS_1 = \
monolib_richtextbuffer.o \
monolib_richtextstyles.o \
monolib_richtextxml.o \
monolib_richtexthtml.o \
$(__ADVANCED_PLATFORM_SRC_OBJECTS_0)
@COND_WXUNIV_1@__ADVANCED_SRC_OBJECTS_1 = $(COND_WXUNIV_1___ADVANCED_SRC_OBJECTS_1)
@COND_TOOLKIT_MSW@__ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_1 \
@ -8656,6 +8660,7 @@ COND_WXUNIV_0___ADVANCED_SRC_OBJECTS_2 = \
advdll_richtextbuffer.o \
advdll_richtextstyles.o \
advdll_richtextxml.o \
advdll_richtexthtml.o \
$(__ADVANCED_PLATFORM_SRC_OBJECTS_8) \
$(__ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_2)
@COND_WXUNIV_0@__ADVANCED_SRC_OBJECTS_2 = $(COND_WXUNIV_0___ADVANCED_SRC_OBJECTS_2)
@ -8676,6 +8681,7 @@ COND_WXUNIV_1___ADVANCED_SRC_OBJECTS_2 = \
advdll_richtextbuffer.o \
advdll_richtextstyles.o \
advdll_richtextxml.o \
advdll_richtexthtml.o \
$(__ADVANCED_PLATFORM_SRC_OBJECTS_8)
@COND_WXUNIV_1@__ADVANCED_SRC_OBJECTS_2 = $(COND_WXUNIV_1___ADVANCED_SRC_OBJECTS_2)
@COND_TOOLKIT_MSW@__ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_2 \
@ -8709,6 +8715,7 @@ COND_WXUNIV_0___ADVANCED_SRC_OBJECTS_3 = \
advlib_richtextbuffer.o \
advlib_richtextstyles.o \
advlib_richtextxml.o \
advlib_richtexthtml.o \
$(__ADVANCED_PLATFORM_SRC_OBJECTS_9) \
$(__ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_3)
@COND_WXUNIV_0@__ADVANCED_SRC_OBJECTS_3 = $(COND_WXUNIV_0___ADVANCED_SRC_OBJECTS_3)
@ -8729,6 +8736,7 @@ COND_WXUNIV_1___ADVANCED_SRC_OBJECTS_3 = \
advlib_richtextbuffer.o \
advlib_richtextstyles.o \
advlib_richtextxml.o \
advlib_richtexthtml.o \
$(__ADVANCED_PLATFORM_SRC_OBJECTS_9)
@COND_WXUNIV_1@__ADVANCED_SRC_OBJECTS_3 = $(COND_WXUNIV_1___ADVANCED_SRC_OBJECTS_3)
@COND_TOOLKIT_MSW@__ADVANCED_PLATFORM_NATIVE_SRC_OBJECTS_3 \
@ -13786,6 +13794,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
@COND_USE_GUI_1@monodll_richtextxml.o: $(srcdir)/src/richtext/richtextxml.cpp $(MONODLL_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/richtext/richtextxml.cpp
@COND_USE_GUI_1@monodll_richtexthtml.o: $(srcdir)/src/richtext/richtexthtml.cpp $(MONODLL_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/richtext/richtexthtml.cpp
@COND_TOOLKIT_MSW_USE_GUI_1@monodll_taskbarcmn.o: $(srcdir)/src/common/taskbarcmn.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/taskbarcmn.cpp
@ -17278,6 +17289,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
@COND_USE_GUI_1@monolib_richtextxml.o: $(srcdir)/src/richtext/richtextxml.cpp $(MONOLIB_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/richtext/richtextxml.cpp
@COND_USE_GUI_1@monolib_richtexthtml.o: $(srcdir)/src/richtext/richtexthtml.cpp $(MONOLIB_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/richtext/richtexthtml.cpp
@COND_TOOLKIT_MSW_USE_GUI_1@monolib_taskbarcmn.o: $(srcdir)/src/common/taskbarcmn.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/taskbarcmn.cpp
@ -23683,6 +23697,9 @@ advdll_richtextstyles.o: $(srcdir)/src/richtext/richtextstyles.cpp $(ADVDLL_ODEP
advdll_richtextxml.o: $(srcdir)/src/richtext/richtextxml.cpp $(ADVDLL_ODEP)
$(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/richtext/richtextxml.cpp
advdll_richtexthtml.o: $(srcdir)/src/richtext/richtexthtml.cpp $(ADVDLL_ODEP)
$(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/richtext/richtexthtml.cpp
@COND_TOOLKIT_MSW@advdll_taskbarcmn.o: $(srcdir)/src/common/taskbarcmn.cpp $(ADVDLL_ODEP)
@COND_TOOLKIT_MSW@ $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/common/taskbarcmn.cpp
@ -23833,6 +23850,9 @@ advlib_richtextstyles.o: $(srcdir)/src/richtext/richtextstyles.cpp $(ADVLIB_ODEP
advlib_richtextxml.o: $(srcdir)/src/richtext/richtextxml.cpp $(ADVLIB_ODEP)
$(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/richtext/richtextxml.cpp
advlib_richtexthtml.o: $(srcdir)/src/richtext/richtexthtml.cpp $(ADVLIB_ODEP)
$(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/richtext/richtexthtml.cpp
@COND_TOOLKIT_MSW@advlib_taskbarcmn.o: $(srcdir)/src/common/taskbarcmn.cpp $(ADVLIB_ODEP)
@COND_TOOLKIT_MSW@ $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/common/taskbarcmn.cpp

View File

@ -2360,6 +2360,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/richtext/richtextbuffer.cpp
src/richtext/richtextstyles.cpp
src/richtext/richtextxml.cpp
src/richtext/richtexthtml.cpp
</set>
<set var="ADVANCED_CMN_HDR" hints="files">

View File

@ -1543,6 +1543,7 @@ ____ADVANCED_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_richtextbuffer.obj \
$(OBJS)\monodll_richtextstyles.obj \
$(OBJS)\monodll_richtextxml.obj \
$(OBJS)\monodll_richtexthtml.obj \
$(OBJS)\monodll_taskbarcmn.obj \
$(OBJS)\monodll_sound.obj \
$(OBJS)\monodll_taskbar.obj \
@ -1567,6 +1568,7 @@ ____ADVANCED_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_richtextbuffer.obj \
$(OBJS)\monodll_richtextstyles.obj \
$(OBJS)\monodll_richtextxml.obj \
$(OBJS)\monodll_richtexthtml.obj \
$(OBJS)\monodll_taskbarcmn.obj \
$(OBJS)\monodll_sound.obj \
$(OBJS)\monodll_taskbar.obj \
@ -2067,6 +2069,7 @@ ____ADVANCED_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_richtextbuffer.obj \
$(OBJS)\monolib_richtextstyles.obj \
$(OBJS)\monolib_richtextxml.obj \
$(OBJS)\monolib_richtexthtml.obj \
$(OBJS)\monolib_taskbarcmn.obj \
$(OBJS)\monolib_sound.obj \
$(OBJS)\monolib_taskbar.obj \
@ -2091,6 +2094,7 @@ ____ADVANCED_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_richtextbuffer.obj \
$(OBJS)\monolib_richtextstyles.obj \
$(OBJS)\monolib_richtextxml.obj \
$(OBJS)\monolib_richtexthtml.obj \
$(OBJS)\monolib_taskbarcmn.obj \
$(OBJS)\monolib_sound.obj \
$(OBJS)\monolib_taskbar.obj \
@ -2928,6 +2932,7 @@ ____ADVANCED_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\advdll_richtextbuffer.obj \
$(OBJS)\advdll_richtextstyles.obj \
$(OBJS)\advdll_richtextxml.obj \
$(OBJS)\advdll_richtexthtml.obj \
$(OBJS)\advdll_taskbarcmn.obj \
$(OBJS)\advdll_sound.obj \
$(OBJS)\advdll_taskbar.obj \
@ -2952,6 +2957,7 @@ ____ADVANCED_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\advdll_richtextbuffer.obj \
$(OBJS)\advdll_richtextstyles.obj \
$(OBJS)\advdll_richtextxml.obj \
$(OBJS)\advdll_richtexthtml.obj \
$(OBJS)\advdll_taskbarcmn.obj \
$(OBJS)\advdll_sound.obj \
$(OBJS)\advdll_taskbar.obj \
@ -2979,6 +2985,7 @@ ____ADVANCED_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\advlib_richtextbuffer.obj \
$(OBJS)\advlib_richtextstyles.obj \
$(OBJS)\advlib_richtextxml.obj \
$(OBJS)\advlib_richtexthtml.obj \
$(OBJS)\advlib_taskbarcmn.obj \
$(OBJS)\advlib_sound.obj \
$(OBJS)\advlib_taskbar.obj \
@ -3003,6 +3010,7 @@ ____ADVANCED_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\advlib_richtextbuffer.obj \
$(OBJS)\advlib_richtextstyles.obj \
$(OBJS)\advlib_richtextxml.obj \
$(OBJS)\advlib_richtexthtml.obj \
$(OBJS)\advlib_taskbarcmn.obj \
$(OBJS)\advlib_sound.obj \
$(OBJS)\advlib_taskbar.obj \
@ -5684,6 +5692,11 @@ $(OBJS)\monodll_richtextxml.obj: ..\..\src\richtext\richtextxml.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $**
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monodll_richtexthtml.obj: ..\..\src\richtext\richtexthtml.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $**
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monodll_taskbarcmn.obj: ..\..\src\common\taskbarcmn.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $**
@ -7403,6 +7416,11 @@ $(OBJS)\monolib_richtextxml.obj: ..\..\src\richtext\richtextxml.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $**
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monolib_richtexthtml.obj: ..\..\src\richtext\richtexthtml.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $**
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monolib_taskbarcmn.obj: ..\..\src\common\taskbarcmn.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $**
@ -10313,6 +10331,9 @@ $(OBJS)\advdll_richtextstyles.obj: ..\..\src\richtext\richtextstyles.cpp
$(OBJS)\advdll_richtextxml.obj: ..\..\src\richtext\richtextxml.cpp
$(CXX) -q -c -P -o$@ $(ADVDLL_CXXFLAGS) $**
$(OBJS)\advdll_richtexthtml.obj: ..\..\src\richtext\richtexthtml.cpp
$(CXX) -q -c -P -o$@ $(ADVDLL_CXXFLAGS) $**
$(OBJS)\advdll_taskbarcmn.obj: ..\..\src\common\taskbarcmn.cpp
$(CXX) -q -c -P -o$@ $(ADVDLL_CXXFLAGS) $**
@ -10379,6 +10400,9 @@ $(OBJS)\advlib_richtextstyles.obj: ..\..\src\richtext\richtextstyles.cpp
$(OBJS)\advlib_richtextxml.obj: ..\..\src\richtext\richtextxml.cpp
$(CXX) -q -c -P -o$@ $(ADVLIB_CXXFLAGS) $**
$(OBJS)\advlib_richtexthtml.obj: ..\..\src\richtext\richtexthtml.cpp
$(CXX) -q -c -P -o$@ $(ADVLIB_CXXFLAGS) $**
$(OBJS)\advlib_taskbarcmn.obj: ..\..\src\common\taskbarcmn.cpp
$(CXX) -q -c -P -o$@ $(ADVLIB_CXXFLAGS) $**

View File

@ -1556,6 +1556,7 @@ ____ADVANCED_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_richtextbuffer.o \
$(OBJS)\monodll_richtextstyles.o \
$(OBJS)\monodll_richtextxml.o \
$(OBJS)\monodll_richtexthtml.o \
$(OBJS)\monodll_taskbarcmn.o \
$(OBJS)\monodll_sound.o \
$(OBJS)\monodll_taskbar.o \
@ -1580,6 +1581,7 @@ ____ADVANCED_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_richtextbuffer.o \
$(OBJS)\monodll_richtextstyles.o \
$(OBJS)\monodll_richtextxml.o \
$(OBJS)\monodll_richtexthtml.o \
$(OBJS)\monodll_taskbarcmn.o \
$(OBJS)\monodll_sound.o \
$(OBJS)\monodll_taskbar.o \
@ -2086,6 +2088,7 @@ ____ADVANCED_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_richtextbuffer.o \
$(OBJS)\monolib_richtextstyles.o \
$(OBJS)\monolib_richtextxml.o \
$(OBJS)\monolib_richtexthtml.o \
$(OBJS)\monolib_taskbarcmn.o \
$(OBJS)\monolib_sound.o \
$(OBJS)\monolib_taskbar.o \
@ -2110,6 +2113,7 @@ ____ADVANCED_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_richtextbuffer.o \
$(OBJS)\monolib_richtextstyles.o \
$(OBJS)\monolib_richtextxml.o \
$(OBJS)\monolib_richtexthtml.o \
$(OBJS)\monolib_taskbarcmn.o \
$(OBJS)\monolib_sound.o \
$(OBJS)\monolib_taskbar.o \
@ -2975,6 +2979,7 @@ ____ADVANCED_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\advdll_richtextbuffer.o \
$(OBJS)\advdll_richtextstyles.o \
$(OBJS)\advdll_richtextxml.o \
$(OBJS)\advdll_richtexthtml.o \
$(OBJS)\advdll_taskbarcmn.o \
$(OBJS)\advdll_sound.o \
$(OBJS)\advdll_taskbar.o \
@ -2999,6 +3004,7 @@ ____ADVANCED_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\advdll_richtextbuffer.o \
$(OBJS)\advdll_richtextstyles.o \
$(OBJS)\advdll_richtextxml.o \
$(OBJS)\advdll_richtexthtml.o \
$(OBJS)\advdll_taskbarcmn.o \
$(OBJS)\advdll_sound.o \
$(OBJS)\advdll_taskbar.o \
@ -3030,6 +3036,7 @@ ____ADVANCED_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\advlib_richtextbuffer.o \
$(OBJS)\advlib_richtextstyles.o \
$(OBJS)\advlib_richtextxml.o \
$(OBJS)\advlib_richtexthtml.o \
$(OBJS)\advlib_taskbarcmn.o \
$(OBJS)\advlib_sound.o \
$(OBJS)\advlib_taskbar.o \
@ -3054,6 +3061,7 @@ ____ADVANCED_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\advlib_richtextbuffer.o \
$(OBJS)\advlib_richtextstyles.o \
$(OBJS)\advlib_richtextxml.o \
$(OBJS)\advlib_richtexthtml.o \
$(OBJS)\advlib_taskbarcmn.o \
$(OBJS)\advlib_sound.o \
$(OBJS)\advlib_taskbar.o \
@ -5879,6 +5887,11 @@ $(OBJS)\monodll_richtextxml.o: ../../src/richtext/richtextxml.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\monodll_richtexthtml.o: ../../src/richtext/richtexthtml.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\monodll_taskbarcmn.o: ../../src/common/taskbarcmn.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
@ -7698,6 +7711,11 @@ $(OBJS)\monolib_richtextxml.o: ../../src/richtext/richtextxml.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\monolib_richtexthtml.o: ../../src/richtext/richtexthtml.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\monolib_taskbarcmn.o: ../../src/common/taskbarcmn.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
@ -10808,6 +10826,9 @@ $(OBJS)\advdll_richtextstyles.o: ../../src/richtext/richtextstyles.cpp
$(OBJS)\advdll_richtextxml.o: ../../src/richtext/richtextxml.cpp
$(CXX) -c -o $@ $(ADVDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\advdll_richtexthtml.o: ../../src/richtext/richtexthtml.cpp
$(CXX) -c -o $@ $(ADVDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\advdll_taskbarcmn.o: ../../src/common/taskbarcmn.cpp
$(CXX) -c -o $@ $(ADVDLL_CXXFLAGS) $(CPPDEPS) $<
@ -10874,6 +10895,9 @@ $(OBJS)\advlib_richtextstyles.o: ../../src/richtext/richtextstyles.cpp
$(OBJS)\advlib_richtextxml.o: ../../src/richtext/richtextxml.cpp
$(CXX) -c -o $@ $(ADVLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\advlib_richtexthtml.o: ../../src/richtext/richtexthtml.cpp
$(CXX) -c -o $@ $(ADVLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\advlib_taskbarcmn.o: ../../src/common/taskbarcmn.cpp
$(CXX) -c -o $@ $(ADVLIB_CXXFLAGS) $(CPPDEPS) $<

View File

@ -1116,10 +1116,16 @@ WXUNICODEFLAG = u
!if "$(WXUNIV)" == "1"
WXUNIVNAME = univ
!endif
!if "$(TARGET_CPU)" == "AMD64"
!if "$(TARGET_CPU)" == "amd64"
DIR_SUFFIX_CPU = _amd64
!endif
!if "$(TARGET_CPU)" == "IA64"
!if "$(TARGET_CPU)" == "amd64"
DIR_SUFFIX_CPU = _amd64
!endif
!if "$(TARGET_CPU)" == "ia64"
DIR_SUFFIX_CPU = _ia64
!endif
!if "$(TARGET_CPU)" == "ia64"
DIR_SUFFIX_CPU = _ia64
!endif
!if "$(SHARED)" == "1"
@ -1131,10 +1137,16 @@ LIBTYPE_SUFFIX = lib
!if "$(SHARED)" == "1"
LIBTYPE_SUFFIX = dll
!endif
!if "$(TARGET_CPU)" == "AMD64"
!if "$(TARGET_CPU)" == "amd64"
LINK_TARGET_CPU = /MACHINE:AMD64
!endif
!if "$(TARGET_CPU)" == "IA64"
!if "$(TARGET_CPU)" == "amd64"
LINK_TARGET_CPU = /MACHINE:AMD64
!endif
!if "$(TARGET_CPU)" == "ia64"
LINK_TARGET_CPU = /MACHINE:IA64
!endif
!if "$(TARGET_CPU)" == "ia64"
LINK_TARGET_CPU = /MACHINE:IA64
!endif
!if "$(RUNTIME_LIBS)" == "dynamic"
@ -1689,6 +1701,7 @@ ____ADVANCED_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_richtextbuffer.obj \
$(OBJS)\monodll_richtextstyles.obj \
$(OBJS)\monodll_richtextxml.obj \
$(OBJS)\monodll_richtexthtml.obj \
$(OBJS)\monodll_taskbarcmn.obj \
$(OBJS)\monodll_sound.obj \
$(OBJS)\monodll_taskbar.obj \
@ -1713,6 +1726,7 @@ ____ADVANCED_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_richtextbuffer.obj \
$(OBJS)\monodll_richtextstyles.obj \
$(OBJS)\monodll_richtextxml.obj \
$(OBJS)\monodll_richtexthtml.obj \
$(OBJS)\monodll_taskbarcmn.obj \
$(OBJS)\monodll_sound.obj \
$(OBJS)\monodll_taskbar.obj \
@ -2219,6 +2233,7 @@ ____ADVANCED_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_richtextbuffer.obj \
$(OBJS)\monolib_richtextstyles.obj \
$(OBJS)\monolib_richtextxml.obj \
$(OBJS)\monolib_richtexthtml.obj \
$(OBJS)\monolib_taskbarcmn.obj \
$(OBJS)\monolib_sound.obj \
$(OBJS)\monolib_taskbar.obj \
@ -2243,6 +2258,7 @@ ____ADVANCED_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_richtextbuffer.obj \
$(OBJS)\monolib_richtextstyles.obj \
$(OBJS)\monolib_richtextxml.obj \
$(OBJS)\monolib_richtexthtml.obj \
$(OBJS)\monolib_taskbarcmn.obj \
$(OBJS)\monolib_sound.obj \
$(OBJS)\monolib_taskbar.obj \
@ -3122,6 +3138,7 @@ ____ADVANCED_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\advdll_richtextbuffer.obj \
$(OBJS)\advdll_richtextstyles.obj \
$(OBJS)\advdll_richtextxml.obj \
$(OBJS)\advdll_richtexthtml.obj \
$(OBJS)\advdll_taskbarcmn.obj \
$(OBJS)\advdll_sound.obj \
$(OBJS)\advdll_taskbar.obj \
@ -3146,6 +3163,7 @@ ____ADVANCED_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\advdll_richtextbuffer.obj \
$(OBJS)\advdll_richtextstyles.obj \
$(OBJS)\advdll_richtextxml.obj \
$(OBJS)\advdll_richtexthtml.obj \
$(OBJS)\advdll_taskbarcmn.obj \
$(OBJS)\advdll_sound.obj \
$(OBJS)\advdll_taskbar.obj \
@ -3179,6 +3197,7 @@ ____ADVANCED_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\advlib_richtextbuffer.obj \
$(OBJS)\advlib_richtextstyles.obj \
$(OBJS)\advlib_richtextxml.obj \
$(OBJS)\advlib_richtexthtml.obj \
$(OBJS)\advlib_taskbarcmn.obj \
$(OBJS)\advlib_sound.obj \
$(OBJS)\advlib_taskbar.obj \
@ -3203,6 +3222,7 @@ ____ADVANCED_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\advlib_richtextbuffer.obj \
$(OBJS)\advlib_richtextstyles.obj \
$(OBJS)\advlib_richtextxml.obj \
$(OBJS)\advlib_richtexthtml.obj \
$(OBJS)\advlib_taskbarcmn.obj \
$(OBJS)\advlib_sound.obj \
$(OBJS)\advlib_taskbar.obj \
@ -5980,6 +6000,11 @@ $(OBJS)\monodll_richtextxml.obj: ..\..\src\richtext\richtextxml.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $**
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monodll_richtexthtml.obj: ..\..\src\richtext\richtexthtml.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $**
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monodll_taskbarcmn.obj: ..\..\src\common\taskbarcmn.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $**
@ -7699,6 +7724,11 @@ $(OBJS)\monolib_richtextxml.obj: ..\..\src\richtext\richtextxml.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $**
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monolib_richtexthtml.obj: ..\..\src\richtext\richtexthtml.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $**
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monolib_taskbarcmn.obj: ..\..\src\common\taskbarcmn.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $**
@ -10609,6 +10639,9 @@ $(OBJS)\advdll_richtextstyles.obj: ..\..\src\richtext\richtextstyles.cpp
$(OBJS)\advdll_richtextxml.obj: ..\..\src\richtext\richtextxml.cpp
$(CXX) /c /nologo /TP /Fo$@ $(ADVDLL_CXXFLAGS) $**
$(OBJS)\advdll_richtexthtml.obj: ..\..\src\richtext\richtexthtml.cpp
$(CXX) /c /nologo /TP /Fo$@ $(ADVDLL_CXXFLAGS) $**
$(OBJS)\advdll_taskbarcmn.obj: ..\..\src\common\taskbarcmn.cpp
$(CXX) /c /nologo /TP /Fo$@ $(ADVDLL_CXXFLAGS) $**
@ -10675,6 +10708,9 @@ $(OBJS)\advlib_richtextstyles.obj: ..\..\src\richtext\richtextstyles.cpp
$(OBJS)\advlib_richtextxml.obj: ..\..\src\richtext\richtextxml.cpp
$(CXX) /c /nologo /TP /Fo$@ $(ADVLIB_CXXFLAGS) $**
$(OBJS)\advlib_richtexthtml.obj: ..\..\src\richtext\richtexthtml.cpp
$(CXX) /c /nologo /TP /Fo$@ $(ADVLIB_CXXFLAGS) $**
$(OBJS)\advlib_taskbarcmn.obj: ..\..\src\common\taskbarcmn.cpp
$(CXX) /c /nologo /TP /Fo$@ $(ADVLIB_CXXFLAGS) $**

View File

@ -593,6 +593,7 @@ ____ADVANCED_SRC_FILENAMES_OBJECTS = &
$(OBJS)\monodll_richtextbuffer.obj &
$(OBJS)\monodll_richtextstyles.obj &
$(OBJS)\monodll_richtextxml.obj &
$(OBJS)\monodll_richtexthtml.obj &
$(OBJS)\monodll_taskbarcmn.obj &
$(OBJS)\monodll_sound.obj &
$(OBJS)\monodll_taskbar.obj &
@ -617,6 +618,7 @@ ____ADVANCED_SRC_FILENAMES_OBJECTS = &
$(OBJS)\monodll_richtextbuffer.obj &
$(OBJS)\monodll_richtextstyles.obj &
$(OBJS)\monodll_richtextxml.obj &
$(OBJS)\monodll_richtexthtml.obj &
$(OBJS)\monodll_taskbarcmn.obj &
$(OBJS)\monodll_sound.obj &
$(OBJS)\monodll_taskbar.obj &
@ -1127,6 +1129,7 @@ ____ADVANCED_SRC_FILENAMES_1_OBJECTS = &
$(OBJS)\monolib_richtextbuffer.obj &
$(OBJS)\monolib_richtextstyles.obj &
$(OBJS)\monolib_richtextxml.obj &
$(OBJS)\monolib_richtexthtml.obj &
$(OBJS)\monolib_taskbarcmn.obj &
$(OBJS)\monolib_sound.obj &
$(OBJS)\monolib_taskbar.obj &
@ -1151,6 +1154,7 @@ ____ADVANCED_SRC_FILENAMES_1_OBJECTS = &
$(OBJS)\monolib_richtextbuffer.obj &
$(OBJS)\monolib_richtextstyles.obj &
$(OBJS)\monolib_richtextxml.obj &
$(OBJS)\monolib_richtexthtml.obj &
$(OBJS)\monolib_taskbarcmn.obj &
$(OBJS)\monolib_sound.obj &
$(OBJS)\monolib_taskbar.obj &
@ -2026,6 +2030,7 @@ ____ADVANCED_SRC_FILENAMES_2_OBJECTS = &
$(OBJS)\advdll_richtextbuffer.obj &
$(OBJS)\advdll_richtextstyles.obj &
$(OBJS)\advdll_richtextxml.obj &
$(OBJS)\advdll_richtexthtml.obj &
$(OBJS)\advdll_taskbarcmn.obj &
$(OBJS)\advdll_sound.obj &
$(OBJS)\advdll_taskbar.obj &
@ -2050,6 +2055,7 @@ ____ADVANCED_SRC_FILENAMES_2_OBJECTS = &
$(OBJS)\advdll_richtextbuffer.obj &
$(OBJS)\advdll_richtextstyles.obj &
$(OBJS)\advdll_richtextxml.obj &
$(OBJS)\advdll_richtexthtml.obj &
$(OBJS)\advdll_taskbarcmn.obj &
$(OBJS)\advdll_sound.obj &
$(OBJS)\advdll_taskbar.obj &
@ -2083,6 +2089,7 @@ ____ADVANCED_SRC_FILENAMES_3_OBJECTS = &
$(OBJS)\advlib_richtextbuffer.obj &
$(OBJS)\advlib_richtextstyles.obj &
$(OBJS)\advlib_richtextxml.obj &
$(OBJS)\advlib_richtexthtml.obj &
$(OBJS)\advlib_taskbarcmn.obj &
$(OBJS)\advlib_sound.obj &
$(OBJS)\advlib_taskbar.obj &
@ -2107,6 +2114,7 @@ ____ADVANCED_SRC_FILENAMES_3_OBJECTS = &
$(OBJS)\advlib_richtextbuffer.obj &
$(OBJS)\advlib_richtextstyles.obj &
$(OBJS)\advlib_richtextxml.obj &
$(OBJS)\advlib_richtexthtml.obj &
$(OBJS)\advlib_taskbarcmn.obj &
$(OBJS)\advlib_sound.obj &
$(OBJS)\advlib_taskbar.obj &
@ -6079,6 +6087,11 @@ $(OBJS)\monodll_richtextxml.obj : .AUTODEPEND ..\..\src\richtext\richtextxml.cp
$(CXX) -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
!endif
!ifeq USE_GUI 1
$(OBJS)\monodll_richtexthtml.obj : .AUTODEPEND ..\..\src\richtext\richtexthtml.cpp
$(CXX) -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
!endif
!ifeq USE_GUI 1
$(OBJS)\monodll_taskbarcmn.obj : .AUTODEPEND ..\..\src\common\taskbarcmn.cpp
$(CXX) -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
@ -7898,6 +7911,11 @@ $(OBJS)\monolib_richtextxml.obj : .AUTODEPEND ..\..\src\richtext\richtextxml.cp
$(CXX) -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
!endif
!ifeq USE_GUI 1
$(OBJS)\monolib_richtexthtml.obj : .AUTODEPEND ..\..\src\richtext\richtexthtml.cpp
$(CXX) -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
!endif
!ifeq USE_GUI 1
$(OBJS)\monolib_taskbarcmn.obj : .AUTODEPEND ..\..\src\common\taskbarcmn.cpp
$(CXX) -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
@ -11008,6 +11026,9 @@ $(OBJS)\advdll_richtextstyles.obj : .AUTODEPEND ..\..\src\richtext\richtextstyl
$(OBJS)\advdll_richtextxml.obj : .AUTODEPEND ..\..\src\richtext\richtextxml.cpp
$(CXX) -zq -fo=$^@ $(ADVDLL_CXXFLAGS) $<
$(OBJS)\advdll_richtexthtml.obj : .AUTODEPEND ..\..\src\richtext\richtexthtml.cpp
$(CXX) -zq -fo=$^@ $(ADVDLL_CXXFLAGS) $<
$(OBJS)\advdll_taskbarcmn.obj : .AUTODEPEND ..\..\src\common\taskbarcmn.cpp
$(CXX) -zq -fo=$^@ $(ADVDLL_CXXFLAGS) $<
@ -11074,6 +11095,9 @@ $(OBJS)\advlib_richtextstyles.obj : .AUTODEPEND ..\..\src\richtext\richtextstyl
$(OBJS)\advlib_richtextxml.obj : .AUTODEPEND ..\..\src\richtext\richtextxml.cpp
$(CXX) -zq -fo=$^@ $(ADVLIB_CXXFLAGS) $<
$(OBJS)\advlib_richtexthtml.obj : .AUTODEPEND ..\..\src\richtext\richtexthtml.cpp
$(CXX) -zq -fo=$^@ $(ADVLIB_CXXFLAGS) $<
$(OBJS)\advlib_taskbarcmn.obj : .AUTODEPEND ..\..\src\common\taskbarcmn.cpp
$(CXX) -zq -fo=$^@ $(ADVLIB_CXXFLAGS) $<

View File

@ -1241,6 +1241,10 @@ SOURCE=..\..\src\richtext\richtextctrl.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\richtext\richtexthtml.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\richtext\richtextstyles.cpp
# End Source File
# Begin Source File

View File

@ -1822,15 +1822,22 @@ public:
virtual bool IsVisible() const { return m_visible; }
virtual void SetVisible(bool visible) { m_visible = visible; }
/// The name of the nandler
void SetName(const wxString& name) { m_name = name; }
wxString GetName() const { return m_name; }
/// The default extension to recognise
void SetExtension(const wxString& ext) { m_extension = ext; }
wxString GetExtension() const { return m_extension; }
/// The handler type
void SetType(int type) { m_type = type; }
int GetType() const { return m_type; }
/// Encoding to use when saving a file. If empty, a suitable encoding is chosen
void SetEncoding(const wxString& encoding) { m_encoding = encoding; }
const wxString& GetEncoding() const { return m_encoding; }
protected:
#if wxUSE_STREAMS
@ -1839,6 +1846,7 @@ protected:
#endif
wxString m_name;
wxString m_encoding;
wxString m_extension;
int m_type;
bool m_visible;

View File

@ -0,0 +1,58 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/richtext/richedithtml.h
// Purpose: HTML I/O for wxRichTextCtrl
// Author: Julian Smart
// Modified by:
// Created: 2005-09-30
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_RICHTEXTHTML_H_
#define _WX_RICHTEXTHTML_H_
/*!
* Includes
*/
#include "wx/richtext/richtextbuffer.h"
/*!
* wxRichTextHTMLHandler
*/
class WXDLLIMPEXP_ADV wxRichTextHTMLHandler: public wxRichTextFileHandler
{
DECLARE_CLASS(wxRichTextHTMLHandler)
public:
wxRichTextHTMLHandler(const wxString& name = wxT("HTML"), const wxString& ext = wxT("html"), int type = wxRICHTEXT_TYPE_HTML)
: wxRichTextFileHandler(name, ext, type)
{ }
#if wxUSE_STREAMS
virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream);
virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream);
#endif
/// Can we save using this handler?
virtual bool CanSave() const { return true; }
/// Can we load using this handler?
virtual bool CanLoad() const { return false; }
/// Can we handle this filename (if using files)? By default, checks the extension.
virtual bool CanHandle(const wxString& filename) const;
/// Output character formatting
virtual void OutputCharacterFormatting(const wxTextAttrEx& currentStyle, const wxTextAttrEx& thisStyle, wxOutputStream& stream, bool start);
/// Output paragraph formatting
virtual void OutputParagraphFormatting(const wxTextAttrEx& currentStyle, const wxTextAttrEx& thisStyle, wxOutputStream& stream, bool start);
protected:
};
#endif
// _WX_RICHTEXTXML_H_

View File

@ -69,42 +69,6 @@ protected:
};
/*!
* wxRichTextHTMLHandler
*/
class WXDLLIMPEXP_ADV wxRichTextHTMLHandler: public wxRichTextFileHandler
{
DECLARE_CLASS(wxRichTextHTMLHandler)
public:
wxRichTextHTMLHandler(const wxString& name = wxT("HTML"), const wxString& ext = wxT("html"), int type = wxRICHTEXT_TYPE_HTML)
: wxRichTextFileHandler(name, ext, type)
{ }
#if wxUSE_STREAMS
virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream);
virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream);
#endif
/// Can we save using this handler?
virtual bool CanSave() const { return true; }
/// Can we load using this handler?
virtual bool CanLoad() const { return false; }
/// Can we handle this filename (if using files)? By default, checks the extension.
virtual bool CanHandle(const wxString& filename) const;
/// Output character formatting
virtual void OutputCharacterFormatting(const wxTextAttrEx& currentStyle, const wxTextAttrEx& thisStyle, wxOutputStream& stream, bool start);
/// Output paragraph formatting
virtual void OutputParagraphFormatting(const wxTextAttrEx& currentStyle, const wxTextAttrEx& thisStyle, wxOutputStream& stream, bool start);
protected:
};
#endif
// wxUSE_RICHTEXT && wxUSE_XML

View File

@ -61,6 +61,7 @@
#include "wx/richtext/richtextctrl.h"
#include "wx/richtext/richtextstyles.h"
#include "wx/richtext/richtextxml.h"
#include "wx/richtext/richtexthtml.h"
// ----------------------------------------------------------------------------
// resources

View File

@ -0,0 +1,176 @@
/////////////////////////////////////////////////////////////////////////////
// Name: richtext/richtexthtml.cpp
// Purpose: HTML I/O for wxRichTextCtrl
// Author: Julian Smart
// Modified by:
// Created: 2005-09-30
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#if wxUSE_RICHTEXT
#include "wx/richtext/richtexthtml.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "wx/filename.h"
#include "wx/wfstream.h"
#include "wx/txtstrm.h"
IMPLEMENT_DYNAMIC_CLASS(wxRichTextHTMLHandler, wxRichTextFileHandler)
/// Can we handle this filename (if using files)? By default, checks the extension.
bool wxRichTextHTMLHandler::CanHandle(const wxString& filename) const
{
wxString path, file, ext;
wxSplitPath(filename, & path, & file, & ext);
return (ext.Lower() == wxT("html") || ext.Lower() == wxT("htm"));
}
#if wxUSE_STREAMS
bool wxRichTextHTMLHandler::DoLoadFile(wxRichTextBuffer *WXUNUSED(buffer), wxInputStream& WXUNUSED(stream))
{
return false;
}
/*
* We need to output only _changes_ in character formatting.
*/
bool wxRichTextHTMLHandler::DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream)
{
buffer->Defragment();
wxTextOutputStream str(stream);
wxTextAttrEx currentParaStyle = buffer->GetAttributes();
wxTextAttrEx currentCharStyle = buffer->GetAttributes();
str << wxT("<html><head></head><body>\n");
wxRichTextObjectList::compatibility_iterator node = buffer->GetChildren().GetFirst();
while (node)
{
wxRichTextParagraph* para = wxDynamicCast(node->GetData(), wxRichTextParagraph);
wxASSERT (para != NULL);
if (para)
{
OutputParagraphFormatting(currentParaStyle, para->GetAttributes(), stream, true);
wxRichTextObjectList::compatibility_iterator node2 = para->GetChildren().GetFirst();
while (node2)
{
wxRichTextObject* obj = node2->GetData();
wxRichTextPlainText* textObj = wxDynamicCast(obj, wxRichTextPlainText);
if (textObj && !textObj->IsEmpty())
{
OutputCharacterFormatting(currentCharStyle, obj->GetAttributes(), stream, true);
str << textObj->GetText();
OutputCharacterFormatting(currentCharStyle, obj->GetAttributes(), stream, false);
}
node2 = node2->GetNext();
}
OutputParagraphFormatting(currentParaStyle, para->GetAttributes(), stream, false);
str << wxT("<P>\n");
}
node = node->GetNext();
}
str << wxT("</body></html>\n");
return true;
}
/// Output character formatting
void wxRichTextHTMLHandler::OutputCharacterFormatting(const wxTextAttrEx& WXUNUSED(currentStyle), const wxTextAttrEx& thisStyle, wxOutputStream& stream, bool start)
{
wxTextOutputStream str(stream);
bool isBold = false;
bool isItalic = false;
bool isUnderline = false;
wxString faceName;
if (thisStyle.GetFont().Ok())
{
if (thisStyle.GetFont().GetWeight() == wxBOLD)
isBold = true;
if (thisStyle.GetFont().GetStyle() == wxITALIC)
isItalic = true;
if (thisStyle.GetFont().GetUnderlined())
isUnderline = true;
faceName = thisStyle.GetFont().GetFaceName();
}
if (start)
{
if (isBold)
str << wxT("<b>");
if (isItalic)
str << wxT("<i>");
if (isUnderline)
str << wxT("<u>");
}
else
{
if (isUnderline)
str << wxT("</u>");
if (isItalic)
str << wxT("</i>");
if (isBold)
str << wxT("</b>");
}
}
/// Output paragraph formatting
void wxRichTextHTMLHandler::OutputParagraphFormatting(const wxTextAttrEx& WXUNUSED(currentStyle), const wxTextAttrEx& thisStyle, wxOutputStream& stream, bool start)
{
// TODO: lists, indentation (using tables), fonts, right-align, ...
wxTextOutputStream str(stream);
bool isCentered = false;
if (thisStyle.GetAlignment() == wxTEXT_ALIGNMENT_CENTRE)
{
isCentered = true;
}
if (start)
{
if (isCentered)
str << wxT("<center>");
}
else
{
if (isCentered)
str << wxT("</center>");
}
}
#endif
// wxUSE_STREAMS
#endif
// wxUSE_RICHTEXT

View File

@ -31,6 +31,7 @@
#include "wx/module.h"
#include "wx/txtstrm.h"
#include "wx/xml/xml.h"
#include "wx/intl.h"
IMPLEMENT_DYNAMIC_CLASS(wxRichTextXMLHandler, wxRichTextFileHandler)
@ -45,7 +46,14 @@ bool wxRichTextXMLHandler::DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& s
wxXmlDocument* xmlDoc = new wxXmlDocument;
bool success = true;
if (!xmlDoc->Load(stream, wxT("ISO-8859-1")))
// This is the encoding to convert to (memory encoding rather than file encoding)
wxString encoding(wxT("UTF-8"));
#if !wxUSE_UNICODE && wxUSE_INTL
encoding = wxLocale::GetSystemEncodingName();
#endif
if (!xmlDoc->Load(stream, encoding))
{
success = false;
}
@ -123,12 +131,6 @@ bool wxRichTextXMLHandler::ImportXML(wxRichTextBuffer* buffer, wxXmlNode* node)
if (text2.Length() > 0 && text2[text2.Length()-1] == wxT('"'))
text2 = text2.Mid(0, text2.Length() - 1);
// TODO: further entity translation
text2.Replace(wxT("&lt;"), wxT("<"));
text2.Replace(wxT("&gt;"), wxT(">"));
text2.Replace(wxT("&amp;"), wxT("&"));
text2.Replace(wxT("&quot;"), wxT("\""));
text += text2;
}
textChild = textChild->GetNext();
@ -305,8 +307,13 @@ static void OutputStringEnt(wxOutputStream& stream, const wxString& str,
for (i = 0; i < len; i++)
{
c = str.GetChar(i);
// Original code excluded "&amp;" but we _do_ want to convert
// the ampersand beginning &amp; because otherwise when read in,
// the original "&amp;" becomes "&".
if (c == wxT('<') || c == wxT('>') || c == wxT('"') ||
(c == wxT('&') && (str.Mid(i+1, 4) != wxT("amp;"))))
(c == wxT('&') /* && (str.Mid(i+1, 4) != wxT("amp;")) */ ))
{
OutputString(stream, str.Mid(last, i - last), convMem, convFile);
switch (c)
@ -339,28 +346,6 @@ inline static void OutputIndentation(wxOutputStream& stream, int indent)
OutputString(stream, str, NULL, NULL);
}
static wxOutputStream& operator <<(wxOutputStream& stream, const wxString& s)
{
stream.Write(s, s.Length());
return stream;
}
#if 0
static wxOutputStream& operator <<(wxOutputStream& stream, long l)
{
wxString str;
str.Printf(wxT("%ld"), l);
return stream << str;
}
static wxOutputStream& operator <<(wxOutputStream& stream, const char c)
{
wxString str;
str.Printf(wxT("%c"), c);
return stream << str;
}
#endif
// Convert a colour to a 6-digit hex string
static wxString ColourToHexString(const wxColour& col)
{
@ -374,7 +359,7 @@ static wxString ColourToHexString(const wxColour& col)
}
// Convert 6-digit hex string to a colour
wxColour HexStringToColour(const wxString& hex)
static wxColour HexStringToColour(const wxString& hex)
{
unsigned char r = (unsigned char)wxHexToDec(hex.Mid(0, 2));
unsigned char g = (unsigned char)wxHexToDec(hex.Mid(2, 2));
@ -389,41 +374,64 @@ bool wxRichTextXMLHandler::DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream&
return false;
wxString version(wxT("1.0") ) ;
#if wxUSE_UNICODE
wxString fileencoding(wxT("UTF-8")) ;
wxString memencoding(wxT("UTF-8")) ;
#else
wxString fileencoding(wxT("ISO-8859-1")) ;
wxString memencoding(wxT("ISO-8859-1")) ;
#endif
wxString s ;
wxMBConv *convMem = NULL, *convFile = NULL;
bool deleteConvFile = false;
wxString fileEncoding;
wxMBConv* convFile = NULL;
#if wxUSE_UNICODE
convFile = new wxCSConv(fileencoding);
fileEncoding = wxT("UTF-8");
convFile = & wxConvUTF8;
#else
if ( fileencoding != memencoding )
fileEncoding = wxT("ISO-8859-1");
convFile = & wxConvISO8859_1;
#endif
// If SetEncoding has been called, change the output encoding.
if (!m_encoding.IsEmpty() && m_encoding.Lower() != fileEncoding.Lower())
{
convFile = new wxCSConv(fileencoding);
convMem = new wxCSConv(memencoding);
if (m_encoding == wxT("<System>"))
{
fileEncoding = wxLocale::GetSystemEncodingName();
}
else
{
fileEncoding = m_encoding;
}
// GetSystemEncodingName may not have returned a name
if (fileEncoding.IsEmpty())
#if wxUSE_UNICODE
fileEncoding = wxT("UTF-8");
#else
fileEncoding = wxT("ISO-8859-1");
#endif
convFile = new wxCSConv(fileEncoding);
deleteConvFile = true;
}
#if !wxUSE_UNICODE
wxMBConv* convMem = wxConvCurrent;
#else
wxMBConv* convMem = NULL;
#endif
wxString s ;
s.Printf(wxT("<?xml version=\"%s\" encoding=\"%s\"?>\n"),
(const wxChar*) version, (const wxChar*) fileencoding );
(const wxChar*) version, (const wxChar*) fileEncoding );
OutputString(stream, s, NULL, NULL);
OutputString(stream, wxT("<richtext version=\"1.0.0.0\" xmlns=\"http://www.wxwidgets.org\">") , NULL, NULL);
int level = 1;
ExportXML(stream, convMem, convFile, *buffer, level);
bool success = ExportXML(stream, convMem, convFile, *buffer, level);
OutputString(stream, wxT("\n</richtext>") , NULL, NULL);
OutputString(stream, wxT("\n"), NULL, NULL);
delete convFile;
delete convMem;
return true;
if (deleteConvFile)
delete convFile;
return success;
}
/// Recursively export an object
@ -446,18 +454,18 @@ bool wxRichTextXMLHandler::ExportXML(wxOutputStream& stream, wxMBConv* convMem,
wxRichTextPlainText& text = (wxRichTextPlainText&) obj;
OutputIndentation(stream, indent);
stream << wxT("<") << objectName;
OutputString(stream, wxT("<") + objectName, convMem, convFile);
wxString style = CreateStyle(obj.GetAttributes(), false);
stream << style << wxT(">");
OutputString(stream, style + wxT(">"), convMem, convFile);
wxString str = text.GetText();
if (str.Length() > 0 && (str[0] == wxT(' ') || str[str.Length()-1] == wxT(' ')))
{
stream << wxT("\"");
OutputString(stream, wxT("\""), convMem, convFile);
OutputStringEnt(stream, str, convMem, convFile);
stream << wxT("\"");
OutputString(stream, wxT("\""), convMem, convFile);
}
else
OutputStringEnt(stream, str, convMem, convFile);
@ -470,28 +478,28 @@ bool wxRichTextXMLHandler::ExportXML(wxOutputStream& stream, wxMBConv* convMem,
imageObj.MakeBlock();
OutputIndentation(stream, indent);
stream << wxT("<") << objectName;
OutputString(stream, wxT("<") + objectName, convMem, convFile);
if (!imageObj.GetImageBlock().Ok())
{
// No data
stream << wxT(">");
OutputString(stream, wxT(">"), convMem, convFile);
}
else
{
stream << wxString::Format(wxT(" imagetype=\"%d\""), (int) imageObj.GetImageBlock().GetImageType()) << wxT(">");
OutputString(stream, wxString::Format(wxT(" imagetype=\"%d\">"), (int) imageObj.GetImageBlock().GetImageType()));
}
OutputIndentation(stream, indent+1);
stream << wxT("<data>");
OutputString(stream, wxT("<data>"), convMem, convFile);
imageObj.GetImageBlock().WriteHex(stream);
stream << wxT("</data>");
OutputString(stream, wxT("</data>"), convMem, convFile);
}
else if (obj.IsKindOf(CLASSINFO(wxRichTextCompositeObject)))
{
OutputIndentation(stream, indent);
stream << wxT("<") << objectName;
OutputString(stream, wxT("<") + objectName, convMem, convFile);
bool isPara = false;
if (objectName == wxT("paragraph") || objectName == wxT("paragraphlayout"))
@ -499,7 +507,7 @@ bool wxRichTextXMLHandler::ExportXML(wxOutputStream& stream, wxMBConv* convMem,
wxString style = CreateStyle(obj.GetAttributes(), isPara);
stream << style << wxT(">");
OutputString(stream, style + wxT(">"), convMem, convFile);
wxRichTextCompositeObject& composite = (wxRichTextCompositeObject&) obj;
size_t i;
@ -513,7 +521,7 @@ bool wxRichTextXMLHandler::ExportXML(wxOutputStream& stream, wxMBConv* convMem,
if (objectName != wxT("text"))
OutputIndentation(stream, indent);
stream << wxT("</") << objectName << wxT(">");
OutputString(stream, wxT("</") + objectName + wxT(">"), convMem, convFile);
return true;
}
@ -674,148 +682,7 @@ bool wxRichTextXMLHandler::GetStyle(wxTextAttrEx& attr, wxXmlNode* node, bool is
}
#endif
IMPLEMENT_DYNAMIC_CLASS(wxRichTextHTMLHandler, wxRichTextFileHandler)
/// Can we handle this filename (if using files)? By default, checks the extension.
bool wxRichTextHTMLHandler::CanHandle(const wxString& filename) const
{
wxString path, file, ext;
wxSplitPath(filename, & path, & file, & ext);
return (ext.Lower() == wxT("html") || ext.Lower() == wxT("htm"));
}
#if wxUSE_STREAMS
bool wxRichTextHTMLHandler::DoLoadFile(wxRichTextBuffer *WXUNUSED(buffer), wxInputStream& WXUNUSED(stream))
{
return false;
}
/*
* We need to output only _changes_ in character formatting.
*/
bool wxRichTextHTMLHandler::DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream)
{
buffer->Defragment();
wxTextOutputStream str(stream);
wxTextAttrEx currentParaStyle = buffer->GetAttributes();
wxTextAttrEx currentCharStyle = buffer->GetAttributes();
str << wxT("<html><head></head><body>\n");
wxRichTextObjectList::compatibility_iterator node = buffer->GetChildren().GetFirst();
while (node)
{
wxRichTextParagraph* para = wxDynamicCast(node->GetData(), wxRichTextParagraph);
wxASSERT (para != NULL);
if (para)
{
OutputParagraphFormatting(currentParaStyle, para->GetAttributes(), stream, true);
wxRichTextObjectList::compatibility_iterator node2 = para->GetChildren().GetFirst();
while (node2)
{
wxRichTextObject* obj = node2->GetData();
wxRichTextPlainText* textObj = wxDynamicCast(obj, wxRichTextPlainText);
if (textObj && !textObj->IsEmpty())
{
OutputCharacterFormatting(currentCharStyle, obj->GetAttributes(), stream, true);
str << textObj->GetText();
OutputCharacterFormatting(currentCharStyle, obj->GetAttributes(), stream, false);
}
node2 = node2->GetNext();
}
OutputParagraphFormatting(currentParaStyle, para->GetAttributes(), stream, false);
str << wxT("<P>\n");
}
node = node->GetNext();
}
str << wxT("</body></html>\n");
return true;
}
/// Output character formatting
void wxRichTextHTMLHandler::OutputCharacterFormatting(const wxTextAttrEx& WXUNUSED(currentStyle), const wxTextAttrEx& thisStyle, wxOutputStream& stream, bool start)
{
wxTextOutputStream str(stream);
bool isBold = false;
bool isItalic = false;
bool isUnderline = false;
wxString faceName;
if (thisStyle.GetFont().Ok())
{
if (thisStyle.GetFont().GetWeight() == wxBOLD)
isBold = true;
if (thisStyle.GetFont().GetStyle() == wxITALIC)
isItalic = true;
if (thisStyle.GetFont().GetUnderlined())
isUnderline = true;
faceName = thisStyle.GetFont().GetFaceName();
}
if (start)
{
if (isBold)
str << wxT("<b>");
if (isItalic)
str << wxT("<i>");
if (isUnderline)
str << wxT("<u>");
}
else
{
if (isUnderline)
str << wxT("</u>");
if (isItalic)
str << wxT("</i>");
if (isBold)
str << wxT("</b>");
}
}
/// Output paragraph formatting
void wxRichTextHTMLHandler::OutputParagraphFormatting(const wxTextAttrEx& WXUNUSED(currentStyle), const wxTextAttrEx& thisStyle, wxOutputStream& stream, bool start)
{
// TODO: lists, indentation (using tables), fonts, right-align, ...
wxTextOutputStream str(stream);
bool isCentered = false;
if (thisStyle.GetAlignment() == wxTEXT_ALIGNMENT_CENTRE)
{
isCentered = true;
}
if (start)
{
if (isCentered)
str << wxT("<center>");
}
else
{
if (isCentered)
str << wxT("</center>");
}
}
#endif
// wxUSE_STREAMS
#endif
// wxUSE_RICHTEXT && wxUSE_XML