1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* libodfgen
3  * Version: MPL 2.0 / LGPLv2.1+
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * Major Contributor(s):
10  * Copyright (C) 2002-2003 William Lachance (wrlach@gmail.com)
11  *
12  * For minor contributions see the git repository.
13  *
14  * Alternatively, the contents of this file may be used under the terms
15  * of the GNU Lesser General Public License Version 2.1 or later
16  * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
17  * applicable instead of those above.
18  *
19  * For further information visit http://libwpd.sourceforge.net
20  */
21 
22 /* "This product is not manufactured, approved, or supported by
23  * Corel Corporation or Corel Corporation Limited."
24  */
25 
26 #include "DocumentElement.hxx"
27 
28 #include "FilterInternal.hxx"
29 #include <string.h>
30 
print() const31 void TagElement::print() const
32 {
33 	ODFGEN_DEBUG_MSG(("%s\n", msTagName.cstr()));
34 }
35 
write(OdfDocumentHandler * pHandler) const36 void TagOpenElement::write(OdfDocumentHandler *pHandler) const
37 {
38 	pHandler->startElement(getTagName().cstr(), maAttrList);
39 }
40 
print() const41 void TagOpenElement::print() const
42 {
43 	TagElement::print();
44 }
45 
addAttribute(const librevenge::RVNGString & szAttributeName,const librevenge::RVNGString & sAttributeValue,bool forceString)46 void TagOpenElement::addAttribute(const librevenge::RVNGString &szAttributeName,
47                                   const librevenge::RVNGString &sAttributeValue, bool forceString)
48 {
49 	if (forceString)
50 		maAttrList.insert(szAttributeName.cstr(), librevenge::RVNGPropertyFactory::newStringProp(sAttributeValue));
51 	else
52 		maAttrList.insert(szAttributeName.cstr(), sAttributeValue);
53 }
54 
write(OdfDocumentHandler * pHandler) const55 void TagCloseElement::write(OdfDocumentHandler *pHandler) const
56 {
57 	ODFGEN_DEBUG_MSG(("TagCloseElement: write (%s)\n", getTagName().cstr()));
58 
59 	pHandler->endElement(getTagName().cstr());
60 }
61 
write(OdfDocumentHandler * pHandler) const62 void CharDataElement::write(OdfDocumentHandler *pHandler) const
63 {
64 	ODFGEN_DEBUG_MSG(("TextElement: write\n"));
65 	pHandler->characters(msData);
66 }
67 
write(OdfDocumentHandler * pHandler) const68 void TextElement::write(OdfDocumentHandler *pHandler) const
69 {
70 	if (msTextBuf.len() <= 0)
71 		return;
72 	pHandler->characters(msTextBuf);
73 }
74 
75 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
76