1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/richtext/richtextxml.cpp
3 // Purpose: XML and HTML I/O for wxRichTextCtrl
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
19 #if wxUSE_RICHTEXT && wxUSE_XML
21 #include "wx/richtext/richtextxml.h"
25 #include "wx/module.h"
28 #include "wx/filename.h"
29 #include "wx/clipbrd.h"
30 #include "wx/wfstream.h"
31 #include "wx/sstream.h"
32 #include "wx/txtstrm.h"
33 #include "wx/tokenzr.h"
34 #include "wx/xml/xml.h"
36 IMPLEMENT_DYNAMIC_CLASS(wxRichTextXMLHandler
, wxRichTextFileHandler
)
39 bool wxRichTextXMLHandler::DoLoadFile(wxRichTextBuffer
*buffer
, wxInputStream
& stream
)
46 wxXmlDocument
* xmlDoc
= new wxXmlDocument
;
49 // This is the encoding to convert to (memory encoding rather than file encoding)
50 wxString
encoding(wxT("UTF-8"));
52 #if !wxUSE_UNICODE && wxUSE_INTL
53 encoding
= wxLocale::GetSystemEncodingName();
56 if (!xmlDoc
->Load(stream
, encoding
))
62 if (xmlDoc
->GetRoot() && xmlDoc
->GetRoot()->GetType() == wxXML_ELEMENT_NODE
&& xmlDoc
->GetRoot()->GetName() == wxT("richtext"))
64 wxXmlNode
* child
= xmlDoc
->GetRoot()->GetChildren();
67 if (child
->GetType() == wxXML_ELEMENT_NODE
)
69 wxString name
= child
->GetName();
70 if (name
== wxT("richtext-version"))
74 ImportXML(buffer
, child
);
77 child
= child
->GetNext();
88 buffer
->UpdateRanges();
93 /// Recursively import an object
94 bool wxRichTextXMLHandler::ImportXML(wxRichTextBuffer
* buffer
, wxXmlNode
* node
)
96 wxString name
= node
->GetName();
98 bool doneChildren
= false;
100 if (name
== wxT("paragraphlayout"))
102 wxString partial
= node
->GetPropVal(wxT("partialparagraph"), wxEmptyString
);
103 if (partial
== wxT("true"))
104 buffer
->SetPartialParagraph(true);
106 else if (name
== wxT("paragraph"))
108 wxRichTextParagraph
* para
= new wxRichTextParagraph(buffer
);
109 buffer
->AppendChild(para
);
111 GetStyle(para
->GetAttributes(), node
, true);
113 wxXmlNode
* child
= node
->GetChildren();
116 wxString childName
= child
->GetName();
117 if (childName
== wxT("text"))
120 wxXmlNode
* textChild
= child
->GetChildren();
123 if (textChild
->GetType() == wxXML_TEXT_NODE
||
124 textChild
->GetType() == wxXML_CDATA_SECTION_NODE
)
126 wxString text2
= textChild
->GetContent();
128 // Strip whitespace from end
129 if (!text2
.empty() && text2
[text2
.length()-1] == wxT('\n'))
130 text2
= text2
.Mid(0, text2
.length()-1);
132 if (!text2
.empty() && text2
[0] == wxT('"'))
133 text2
= text2
.Mid(1);
134 if (!text2
.empty() && text2
[text2
.length()-1] == wxT('"'))
135 text2
= text2
.Mid(0, text2
.length() - 1);
139 textChild
= textChild
->GetNext();
142 wxRichTextPlainText
* textObject
= new wxRichTextPlainText(text
, para
);
143 GetStyle(textObject
->GetAttributes(), child
, false);
145 para
->AppendChild(textObject
);
147 else if (childName
== wxT("symbol"))
149 // This is a symbol that XML can't read in the normal way
151 wxXmlNode
* textChild
= child
->GetChildren();
154 if (textChild
->GetType() == wxXML_TEXT_NODE
||
155 textChild
->GetType() == wxXML_CDATA_SECTION_NODE
)
157 wxString text2
= textChild
->GetContent();
160 textChild
= textChild
->GetNext();
164 actualText
<< (wxChar
) wxAtoi(text
);
166 wxRichTextPlainText
* textObject
= new wxRichTextPlainText(actualText
, para
);
167 GetStyle(textObject
->GetAttributes(), child
, false);
169 para
->AppendChild(textObject
);
171 else if (childName
== wxT("image"))
173 int imageType
= wxBITMAP_TYPE_PNG
;
174 wxString value
= node
->GetPropVal(wxT("imagetype"), wxEmptyString
);
176 imageType
= wxAtoi(value
);
180 wxXmlNode
* imageChild
= child
->GetChildren();
183 wxString childName
= imageChild
->GetName();
184 if (childName
== wxT("data"))
186 wxXmlNode
* dataChild
= imageChild
->GetChildren();
189 data
= dataChild
->GetContent();
191 dataChild
= dataChild
->GetNext();
195 imageChild
= imageChild
->GetNext();
200 wxRichTextImage
* imageObj
= new wxRichTextImage(para
);
201 para
->AppendChild(imageObj
);
203 wxStringInputStream
strStream(data
);
205 imageObj
->GetImageBlock().ReadHex(strStream
, data
.length(), imageType
);
208 child
= child
->GetNext();
216 wxXmlNode
* child
= node
->GetChildren();
219 ImportXML(buffer
, child
);
220 child
= child
->GetNext();
228 //-----------------------------------------------------------------------------
229 // xml support routines
230 //-----------------------------------------------------------------------------
232 bool wxRichTextXMLHandler::HasParam(wxXmlNode
* node
, const wxString
& param
)
234 return (GetParamNode(node
, param
) != NULL
);
237 wxXmlNode
*wxRichTextXMLHandler::GetParamNode(wxXmlNode
* node
, const wxString
& param
)
239 wxCHECK_MSG(node
, NULL
, wxT("You can't access node data before it was initialized!"));
241 wxXmlNode
*n
= node
->GetChildren();
245 if (n
->GetType() == wxXML_ELEMENT_NODE
&& n
->GetName() == param
)
253 wxString
wxRichTextXMLHandler::GetNodeContent(wxXmlNode
*node
)
256 if (n
== NULL
) return wxEmptyString
;
257 n
= n
->GetChildren();
261 if (n
->GetType() == wxXML_TEXT_NODE
||
262 n
->GetType() == wxXML_CDATA_SECTION_NODE
)
263 return n
->GetContent();
266 return wxEmptyString
;
270 wxString
wxRichTextXMLHandler::GetParamValue(wxXmlNode
*node
, const wxString
& param
)
273 return GetNodeContent(node
);
275 return GetNodeContent(GetParamNode(node
, param
));
278 wxString
wxRichTextXMLHandler::GetText(wxXmlNode
*node
, const wxString
& param
, bool WXUNUSED(translate
))
280 wxXmlNode
*parNode
= GetParamNode(node
, param
);
283 wxString
str1(GetNodeContent(parNode
));
287 // For use with earlier versions of wxWidgets
288 #ifndef WXUNUSED_IN_UNICODE
290 #define WXUNUSED_IN_UNICODE(x) WXUNUSED(x)
292 #define WXUNUSED_IN_UNICODE(x) x
296 // write string to output:
297 inline static void OutputString(wxOutputStream
& stream
, const wxString
& str
,
298 wxMBConv
*WXUNUSED_IN_UNICODE(convMem
) = NULL
, wxMBConv
*convFile
= NULL
)
300 if (str
.empty()) return;
304 const wxWX2MBbuf
buf(str
.mb_str(*convFile
));
305 stream
.Write((const char*)buf
, strlen((const char*)buf
));
309 const wxWX2MBbuf
buf(str
.mb_str(wxConvUTF8
));
310 stream
.Write((const char*)buf
, strlen((const char*)buf
));
313 if ( convFile
== NULL
)
314 stream
.Write(str
.mb_str(), str
.Len());
317 wxString
str2(str
.wc_str(*convMem
), *convFile
);
318 stream
.Write(str2
.mb_str(), str2
.Len());
323 // Same as above, but create entities first.
324 // Translates '<' to "<", '>' to ">" and '&' to "&"
325 static void OutputStringEnt(wxOutputStream
& stream
, const wxString
& str
,
326 wxMBConv
*convMem
= NULL
, wxMBConv
*convFile
= NULL
)
334 for (i
= 0; i
< len
; i
++)
338 // Original code excluded "&" but we _do_ want to convert
339 // the ampersand beginning & because otherwise when read in,
340 // the original "&" becomes "&".
342 if (c
== wxT('<') || c
== wxT('>') || c
== wxT('"') ||
343 (c
== wxT('&') /* && (str.Mid(i+1, 4) != wxT("amp;")) */ ))
345 OutputString(stream
, str
.Mid(last
, i
- last
), convMem
, convFile
);
349 OutputString(stream
, wxT("<"), NULL
, NULL
);
352 OutputString(stream
, wxT(">"), NULL
, NULL
);
355 OutputString(stream
, wxT("&"), NULL
, NULL
);
358 OutputString(stream
, wxT("""), NULL
, NULL
);
364 else if (wxUChar(c
) > 127)
366 OutputString(stream
, str
.Mid(last
, i
- last
), convMem
, convFile
);
368 wxString
s(wxT("&#"));
371 OutputString(stream
, s
, NULL
, NULL
);
375 OutputString(stream
, str
.Mid(last
, i
- last
), convMem
, convFile
);
378 inline static void OutputIndentation(wxOutputStream
& stream
, int indent
)
380 wxString str
= wxT("\n");
381 for (int i
= 0; i
< indent
; i
++)
382 str
<< wxT(' ') << wxT(' ');
383 OutputString(stream
, str
, NULL
, NULL
);
386 // Convert a colour to a 6-digit hex string
387 static wxString
ColourToHexString(const wxColour
& col
)
391 hex
+= wxDecToHex(col
.Red());
392 hex
+= wxDecToHex(col
.Green());
393 hex
+= wxDecToHex(col
.Blue());
398 // Convert 6-digit hex string to a colour
399 static wxColour
HexStringToColour(const wxString
& hex
)
401 unsigned char r
= (unsigned char)wxHexToDec(hex
.Mid(0, 2));
402 unsigned char g
= (unsigned char)wxHexToDec(hex
.Mid(2, 2));
403 unsigned char b
= (unsigned char)wxHexToDec(hex
.Mid(4, 2));
405 return wxColour(r
, g
, b
);
408 bool wxRichTextXMLHandler::DoSaveFile(wxRichTextBuffer
*buffer
, wxOutputStream
& stream
)
413 wxString
version(wxT("1.0") ) ;
415 bool deleteConvFile
= false;
416 wxString fileEncoding
;
417 wxMBConv
* convFile
= NULL
;
420 fileEncoding
= wxT("UTF-8");
421 convFile
= & wxConvUTF8
;
423 fileEncoding
= wxT("ISO-8859-1");
424 convFile
= & wxConvISO8859_1
;
427 // If SetEncoding has been called, change the output encoding.
428 if (!m_encoding
.empty() && m_encoding
.Lower() != fileEncoding
.Lower())
430 if (m_encoding
== wxT("<System>"))
432 fileEncoding
= wxLocale::GetSystemEncodingName();
436 fileEncoding
= m_encoding
;
439 // GetSystemEncodingName may not have returned a name
440 if (fileEncoding
.empty())
442 fileEncoding
= wxT("UTF-8");
444 fileEncoding
= wxT("ISO-8859-1");
446 convFile
= new wxCSConv(fileEncoding
);
447 deleteConvFile
= true;
451 wxMBConv
* convMem
= wxConvCurrent
;
453 wxMBConv
* convMem
= NULL
;
457 s
.Printf(wxT("<?xml version=\"%s\" encoding=\"%s\"?>\n"),
458 (const wxChar
*) version
, (const wxChar
*) fileEncoding
);
459 OutputString(stream
, s
, NULL
, NULL
);
460 OutputString(stream
, wxT("<richtext version=\"1.0.0.0\" xmlns=\"http://www.wxwidgets.org\">") , NULL
, NULL
);
463 bool success
= ExportXML(stream
, convMem
, convFile
, *buffer
, level
);
465 OutputString(stream
, wxT("\n</richtext>") , NULL
, NULL
);
466 OutputString(stream
, wxT("\n"), NULL
, NULL
);
474 /// Recursively export an object
475 bool wxRichTextXMLHandler::ExportXML(wxOutputStream
& stream
, wxMBConv
* convMem
, wxMBConv
* convFile
, wxRichTextObject
& obj
, int indent
)
478 if (obj
.IsKindOf(CLASSINFO(wxRichTextParagraphLayoutBox
)))
479 objectName
= wxT("paragraphlayout");
480 else if (obj
.IsKindOf(CLASSINFO(wxRichTextParagraph
)))
481 objectName
= wxT("paragraph");
482 else if (obj
.IsKindOf(CLASSINFO(wxRichTextPlainText
)))
483 objectName
= wxT("text");
484 else if (obj
.IsKindOf(CLASSINFO(wxRichTextImage
)))
485 objectName
= wxT("image");
487 objectName
= wxT("object");
489 bool terminateTag
= true;
491 if (obj
.IsKindOf(CLASSINFO(wxRichTextPlainText
)))
493 wxRichTextPlainText
& textObj
= (wxRichTextPlainText
&) obj
;
495 wxString style
= CreateStyle(obj
.GetAttributes(), false);
499 const wxString
& text
= textObj
.GetText();
500 int len
= (int) text
.Length();
501 for (i
= 0; i
< len
; i
++)
503 int c
= (int) text
[i
];
504 if (c
< 32 && c
!= 9 && c
!= 10 && c
!= 13)
508 OutputIndentation(stream
, indent
);
509 OutputString(stream
, wxT("<") + objectName
, convMem
, convFile
);
511 OutputString(stream
, style
+ wxT(">"), convMem
, convFile
);
513 wxString
fragment(text
.Mid(last
, i
-last
));
514 if (!fragment
.empty() && (fragment
[0] == wxT(' ') || fragment
[fragment
.length()-1] == wxT(' ')))
516 OutputString(stream
, wxT("\""), convMem
, convFile
);
517 OutputStringEnt(stream
, fragment
, convMem
, convFile
);
518 OutputString(stream
, wxT("\""), convMem
, convFile
);
521 OutputStringEnt(stream
, fragment
, convMem
, convFile
);
523 OutputString(stream
, wxT("</text>"), convMem
, convFile
);
527 // Output this character as a number in a separate tag, because XML can't cope
528 // with entities below 32 except for 9, 10 and 13
530 OutputIndentation(stream
, indent
);
531 OutputString(stream
, wxT("<symbol"), convMem
, convFile
);
533 OutputString(stream
, style
+ wxT(">"), convMem
, convFile
);
534 OutputString(stream
, wxString::Format(wxT("%d"), c
), convMem
, convFile
);
536 OutputString(stream
, wxT("</symbol>"), convMem
, convFile
);
544 fragment
= text
.Mid(last
, i
-last
);
548 OutputIndentation(stream
, indent
);
549 OutputString(stream
, wxT("<") + objectName
, convMem
, convFile
);
551 OutputString(stream
, style
+ wxT(">"), convMem
, convFile
);
553 if (!fragment
.empty() && (fragment
[0] == wxT(' ') || fragment
[fragment
.length()-1] == wxT(' ')))
555 OutputString(stream
, wxT("\""), convMem
, convFile
);
556 OutputStringEnt(stream
, fragment
, convMem
, convFile
);
557 OutputString(stream
, wxT("\""), convMem
, convFile
);
560 OutputStringEnt(stream
, fragment
, convMem
, convFile
);
563 terminateTag
= false;
565 else if (obj
.IsKindOf(CLASSINFO(wxRichTextImage
)))
567 wxRichTextImage
& imageObj
= (wxRichTextImage
&) obj
;
569 if (imageObj
.GetImage().Ok() && !imageObj
.GetImageBlock().Ok())
570 imageObj
.MakeBlock();
572 OutputIndentation(stream
, indent
);
573 OutputString(stream
, wxT("<") + objectName
, convMem
, convFile
);
574 if (!imageObj
.GetImageBlock().Ok())
577 OutputString(stream
, wxT(">"), convMem
, convFile
);
581 OutputString(stream
, wxString::Format(wxT(" imagetype=\"%d\">"), (int) imageObj
.GetImageBlock().GetImageType()));
584 OutputIndentation(stream
, indent
+1);
585 OutputString(stream
, wxT("<data>"), convMem
, convFile
);
587 imageObj
.GetImageBlock().WriteHex(stream
);
589 OutputString(stream
, wxT("</data>"), convMem
, convFile
);
591 else if (obj
.IsKindOf(CLASSINFO(wxRichTextCompositeObject
)))
593 OutputIndentation(stream
, indent
);
594 OutputString(stream
, wxT("<") + objectName
, convMem
, convFile
);
597 if (objectName
== wxT("paragraph") || objectName
== wxT("paragraphlayout"))
600 wxString style
= CreateStyle(obj
.GetAttributes(), isPara
);
602 if (objectName
== wxT("paragraphlayout") && ((wxRichTextParagraphLayoutBox
&) obj
).GetPartialParagraph())
603 style
<< wxT(" partialparagraph=\"true\"");
605 OutputString(stream
, style
+ wxT(">"), convMem
, convFile
);
607 wxRichTextCompositeObject
& composite
= (wxRichTextCompositeObject
&) obj
;
609 for (i
= 0; i
< composite
.GetChildCount(); i
++)
611 wxRichTextObject
* child
= composite
.GetChild(i
);
612 ExportXML(stream
, convMem
, convFile
, *child
, indent
+1);
616 if (objectName
!= wxT("text"))
617 OutputIndentation(stream
, indent
);
620 OutputString(stream
, wxT("</") + objectName
+ wxT(">"), convMem
, convFile
);
625 /// Create style parameters
626 wxString
wxRichTextXMLHandler::CreateStyle(const wxTextAttrEx
& attr
, bool isPara
)
629 if (attr
.HasTextColour() && attr
.GetTextColour().Ok())
631 str
<< wxT(" textcolor=\"#") << ColourToHexString(attr
.GetTextColour()) << wxT("\"");
633 if (attr
.HasBackgroundColour() && attr
.GetBackgroundColour().Ok())
635 str
<< wxT(" bgcolor=\"#") << ColourToHexString(attr
.GetBackgroundColour()) << wxT("\"");
638 if (attr
.GetFont().Ok())
641 str
<< wxT(" fontsize=\"") << attr
.GetFont().GetPointSize() << wxT("\"");
643 //if (attr.HasFamily())
644 // str << wxT(" fontfamily=\"") << attr.GetFont().GetFamily() << wxT("\"");
646 if (attr
.HasItalic())
647 str
<< wxT(" fontstyle=\"") << attr
.GetFont().GetStyle() << wxT("\"");
649 if (attr
.HasWeight())
650 str
<< wxT(" fontweight=\"") << attr
.GetFont().GetWeight() << wxT("\"");
652 if (attr
.HasUnderlined())
653 str
<< wxT(" fontunderlined=\"") << (int) attr
.GetFont().GetUnderlined() << wxT("\"");
655 if (attr
.HasFaceName())
656 str
<< wxT(" fontface=\"") << attr
.GetFont().GetFaceName() << wxT("\"");
659 if (!attr
.GetCharacterStyleName().empty())
660 str
<< wxT(" charactertyle=\"") << wxString(attr
.GetCharacterStyleName()) << wxT("\"");
664 if (attr
.HasAlignment())
665 str
<< wxT(" alignment=\"") << (int) attr
.GetAlignment() << wxT("\"");
667 if (attr
.HasLeftIndent())
669 str
<< wxT(" leftindent=\"") << (int) attr
.GetLeftIndent() << wxT("\"");
670 str
<< wxT(" leftsubindent=\"") << (int) attr
.GetLeftSubIndent() << wxT("\"");
673 if (attr
.HasRightIndent())
674 str
<< wxT(" rightindent=\"") << (int) attr
.GetRightIndent() << wxT("\"");
676 if (attr
.HasParagraphSpacingAfter())
677 str
<< wxT(" parspacingafter=\"") << (int) attr
.GetParagraphSpacingAfter() << wxT("\"");
679 if (attr
.HasParagraphSpacingBefore())
680 str
<< wxT(" parspacingbefore=\"") << (int) attr
.GetParagraphSpacingBefore() << wxT("\"");
682 if (attr
.HasLineSpacing())
683 str
<< wxT(" linespacing=\"") << (int) attr
.GetLineSpacing() << wxT("\"");
685 if (attr
.HasBulletStyle())
686 str
<< wxT(" bulletstyle=\"") << (int) attr
.GetBulletStyle() << wxT("\"");
688 if (attr
.HasBulletNumber())
689 str
<< wxT(" bulletnumber=\"") << (int) attr
.GetBulletNumber() << wxT("\"");
691 if (attr
.HasBulletSymbol())
693 str
<< wxT(" bulletsymbol=\"") << (int) (attr
.GetBulletSymbol()) << wxT("\"");
694 str
<< wxT(" bulletfont=\"") << attr
.GetBulletFont() << wxT("\"");
697 if (!attr
.GetParagraphStyleName().empty())
698 str
<< wxT(" parstyle=\"") << wxString(attr
.GetParagraphStyleName()) << wxT("\"");
702 str
<< wxT(" tabs=\"");
704 for (i
= 0; i
< attr
.GetTabs().GetCount(); i
++)
708 str
<< attr
.GetTabs()[i
];
717 /// Get style parameters
718 bool wxRichTextXMLHandler::GetStyle(wxTextAttrEx
& attr
, wxXmlNode
* node
, bool isPara
)
720 wxString fontFacename
;
722 int fontFamily
= wxDEFAULT
;
723 int fontWeight
= wxNORMAL
;
724 int fontStyle
= wxNORMAL
;
725 bool fontUnderlined
= false;
729 fontFacename
= node
->GetPropVal(wxT("fontface"), wxEmptyString
);
730 if (!fontFacename
.IsEmpty())
731 fontFlags
|= wxTEXT_ATTR_FONT_FACE
;
734 //value = node->GetPropVal(wxT("fontfamily"), wxEmptyString);
735 //if (!value.empty())
736 // fontFamily = wxAtoi(value);
738 value
= node
->GetPropVal(wxT("fontstyle"), wxEmptyString
);
741 fontStyle
= wxAtoi(value
);
742 fontFlags
|= wxTEXT_ATTR_FONT_ITALIC
;
745 value
= node
->GetPropVal(wxT("fontsize"), wxEmptyString
);
748 fontSize
= wxAtoi(value
);
749 fontFlags
|= wxTEXT_ATTR_FONT_SIZE
;
752 value
= node
->GetPropVal(wxT("fontweight"), wxEmptyString
);
755 fontWeight
= wxAtoi(value
);
756 fontFlags
|= wxTEXT_ATTR_FONT_WEIGHT
;
759 value
= node
->GetPropVal(wxT("fontunderlined"), wxEmptyString
);
762 fontUnderlined
= wxAtoi(value
) != 0;
763 fontFlags
|= wxTEXT_ATTR_FONT_UNDERLINE
;
766 attr
.SetFlags(fontFlags
);
768 if (attr
.HasFlag(wxTEXT_ATTR_FONT
))
769 attr
.SetFont(* wxTheFontList
->FindOrCreateFont(fontSize
, fontFamily
, fontStyle
, fontWeight
, fontUnderlined
, fontFacename
));
771 // Restore correct font flags
772 attr
.SetFlags(fontFlags
);
774 value
= node
->GetPropVal(wxT("textcolor"), wxEmptyString
);
777 if (value
[0] == wxT('#'))
778 attr
.SetTextColour(HexStringToColour(value
.Mid(1)));
780 attr
.SetTextColour(value
);
783 value
= node
->GetPropVal(wxT("backgroundcolor"), wxEmptyString
);
786 if (value
[0] == wxT('#'))
787 attr
.SetBackgroundColour(HexStringToColour(value
.Mid(1)));
789 attr
.SetBackgroundColour(value
);
792 value
= node
->GetPropVal(wxT("characterstyle"), wxEmptyString
);
794 attr
.SetCharacterStyleName(value
);
796 // Set paragraph attributes
799 value
= node
->GetPropVal(wxT("alignment"), wxEmptyString
);
801 attr
.SetAlignment((wxTextAttrAlignment
) wxAtoi(value
));
803 int leftSubIndent
= 0;
805 bool hasLeftIndent
= false;
807 value
= node
->GetPropVal(wxT("leftindent"), wxEmptyString
);
810 leftIndent
= wxAtoi(value
);
811 hasLeftIndent
= true;
814 value
= node
->GetPropVal(wxT("leftsubindent"), wxEmptyString
);
817 leftSubIndent
= wxAtoi(value
);
818 hasLeftIndent
= true;
822 attr
.SetLeftIndent(leftIndent
, leftSubIndent
);
824 value
= node
->GetPropVal(wxT("rightindent"), wxEmptyString
);
826 attr
.SetRightIndent(wxAtoi(value
));
828 value
= node
->GetPropVal(wxT("parspacingbefore"), wxEmptyString
);
830 attr
.SetParagraphSpacingBefore(wxAtoi(value
));
832 value
= node
->GetPropVal(wxT("parspacingafter"), wxEmptyString
);
834 attr
.SetParagraphSpacingAfter(wxAtoi(value
));
836 value
= node
->GetPropVal(wxT("linespacing"), wxEmptyString
);
838 attr
.SetLineSpacing(wxAtoi(value
));
840 value
= node
->GetPropVal(wxT("bulletstyle"), wxEmptyString
);
842 attr
.SetBulletStyle(wxAtoi(value
));
844 value
= node
->GetPropVal(wxT("bulletnumber"), wxEmptyString
);
846 attr
.SetBulletNumber(wxAtoi(value
));
848 value
= node
->GetPropVal(wxT("bulletsymbol"), wxEmptyString
);
850 attr
.SetBulletSymbol(wxAtoi(value
));
852 value
= node
->GetPropVal(wxT("bulletfont"), wxEmptyString
);
854 attr
.SetBulletFont(value
);
856 value
= node
->GetPropVal(wxT("parstyle"), wxEmptyString
);
858 attr
.SetParagraphStyleName(value
);
860 value
= node
->GetPropVal(wxT("tabs"), wxEmptyString
);
864 wxStringTokenizer
tkz(value
, wxT(","));
865 while (tkz
.HasMoreTokens())
867 wxString token
= tkz
.GetNextToken();
868 tabs
.Add(wxAtoi(token
));
881 // wxUSE_RICHTEXT && wxUSE_XML