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(" characterstyle=\"") << 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
.HasBulletName())
698 str
<< wxT(" bulletname=\"") << attr
.GetBulletName() << wxT("\"");
700 if (!attr
.GetParagraphStyleName().empty())
701 str
<< wxT(" parstyle=\"") << wxString(attr
.GetParagraphStyleName()) << wxT("\"");
703 if (!attr
.GetListStyleName().empty())
704 str
<< wxT(" liststyle=\"") << wxString(attr
.GetListStyleName()) << wxT("\"");
708 str
<< wxT(" tabs=\"");
710 for (i
= 0; i
< attr
.GetTabs().GetCount(); i
++)
714 str
<< attr
.GetTabs()[i
];
723 /// Get style parameters
724 bool wxRichTextXMLHandler::GetStyle(wxTextAttrEx
& attr
, wxXmlNode
* node
, bool isPara
)
726 wxString fontFacename
;
728 int fontFamily
= wxDEFAULT
;
729 int fontWeight
= wxNORMAL
;
730 int fontStyle
= wxNORMAL
;
731 bool fontUnderlined
= false;
735 fontFacename
= node
->GetPropVal(wxT("fontface"), wxEmptyString
);
736 if (!fontFacename
.IsEmpty())
737 fontFlags
|= wxTEXT_ATTR_FONT_FACE
;
740 //value = node->GetPropVal(wxT("fontfamily"), wxEmptyString);
741 //if (!value.empty())
742 // fontFamily = wxAtoi(value);
744 value
= node
->GetPropVal(wxT("fontstyle"), wxEmptyString
);
747 fontStyle
= wxAtoi(value
);
748 fontFlags
|= wxTEXT_ATTR_FONT_ITALIC
;
751 value
= node
->GetPropVal(wxT("fontsize"), wxEmptyString
);
754 fontSize
= wxAtoi(value
);
755 fontFlags
|= wxTEXT_ATTR_FONT_SIZE
;
758 value
= node
->GetPropVal(wxT("fontweight"), wxEmptyString
);
761 fontWeight
= wxAtoi(value
);
762 fontFlags
|= wxTEXT_ATTR_FONT_WEIGHT
;
765 value
= node
->GetPropVal(wxT("fontunderlined"), wxEmptyString
);
768 fontUnderlined
= wxAtoi(value
) != 0;
769 fontFlags
|= wxTEXT_ATTR_FONT_UNDERLINE
;
772 attr
.SetFlags(fontFlags
);
774 if (attr
.HasFlag(wxTEXT_ATTR_FONT
))
775 attr
.SetFont(* wxTheFontList
->FindOrCreateFont(fontSize
, fontFamily
, fontStyle
, fontWeight
, fontUnderlined
, fontFacename
));
777 // Restore correct font flags
778 attr
.SetFlags(fontFlags
);
780 value
= node
->GetPropVal(wxT("textcolor"), wxEmptyString
);
783 if (value
[0] == wxT('#'))
784 attr
.SetTextColour(HexStringToColour(value
.Mid(1)));
786 attr
.SetTextColour(value
);
789 value
= node
->GetPropVal(wxT("backgroundcolor"), wxEmptyString
);
792 if (value
[0] == wxT('#'))
793 attr
.SetBackgroundColour(HexStringToColour(value
.Mid(1)));
795 attr
.SetBackgroundColour(value
);
798 value
= node
->GetPropVal(wxT("characterstyle"), wxEmptyString
);
800 attr
.SetCharacterStyleName(value
);
802 // Set paragraph attributes
805 value
= node
->GetPropVal(wxT("alignment"), wxEmptyString
);
807 attr
.SetAlignment((wxTextAttrAlignment
) wxAtoi(value
));
809 int leftSubIndent
= 0;
811 bool hasLeftIndent
= false;
813 value
= node
->GetPropVal(wxT("leftindent"), wxEmptyString
);
816 leftIndent
= wxAtoi(value
);
817 hasLeftIndent
= true;
820 value
= node
->GetPropVal(wxT("leftsubindent"), wxEmptyString
);
823 leftSubIndent
= wxAtoi(value
);
824 hasLeftIndent
= true;
828 attr
.SetLeftIndent(leftIndent
, leftSubIndent
);
830 value
= node
->GetPropVal(wxT("rightindent"), wxEmptyString
);
832 attr
.SetRightIndent(wxAtoi(value
));
834 value
= node
->GetPropVal(wxT("parspacingbefore"), wxEmptyString
);
836 attr
.SetParagraphSpacingBefore(wxAtoi(value
));
838 value
= node
->GetPropVal(wxT("parspacingafter"), wxEmptyString
);
840 attr
.SetParagraphSpacingAfter(wxAtoi(value
));
842 value
= node
->GetPropVal(wxT("linespacing"), wxEmptyString
);
844 attr
.SetLineSpacing(wxAtoi(value
));
846 value
= node
->GetPropVal(wxT("bulletstyle"), wxEmptyString
);
848 attr
.SetBulletStyle(wxAtoi(value
));
850 value
= node
->GetPropVal(wxT("bulletnumber"), wxEmptyString
);
852 attr
.SetBulletNumber(wxAtoi(value
));
854 value
= node
->GetPropVal(wxT("bulletsymbol"), wxEmptyString
);
856 attr
.SetBulletSymbol(wxChar(wxAtoi(value
)));
858 value
= node
->GetPropVal(wxT("bulletfont"), wxEmptyString
);
860 attr
.SetBulletFont(value
);
862 value
= node
->GetPropVal(wxT("bulletname"), wxEmptyString
);
864 attr
.SetBulletName(value
);
866 value
= node
->GetPropVal(wxT("parstyle"), wxEmptyString
);
868 attr
.SetParagraphStyleName(value
);
870 value
= node
->GetPropVal(wxT("liststyle"), wxEmptyString
);
872 attr
.SetListStyleName(value
);
874 value
= node
->GetPropVal(wxT("tabs"), wxEmptyString
);
878 wxStringTokenizer
tkz(value
, wxT(","));
879 while (tkz
.HasMoreTokens())
881 wxString token
= tkz
.GetNextToken();
882 tabs
.Add(wxAtoi(token
));
895 // wxUSE_RICHTEXT && wxUSE_XML