summaryrefslogtreecommitdiff
path: root/writerperfect
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2007-01-23 11:12:19 +0000
committerOliver Bolte <obo@openoffice.org>2007-01-23 11:12:19 +0000
commite31ab06bdebd646ed1d3f40b82c2a9ed1ba6343b (patch)
tree7f370828dce1efa14feaec5729855ec72733e882 /writerperfect
parent82c89d0bf14c894193306f88bb437c6c11ea7c4b (diff)
INTEGRATION: CWS fs08 (1.1.2); FILE ADDED
2006/12/22 16:18:35 fridrich_strba 1.1.2.4: trying to put belts and braces around the stream class 2006/12/22 12:50:56 fridrich_strba 1.1.2.3: oops 2006/12/22 11:38:35 fridrich_strba 1.1.2.2: small fix for filtering properties from libwpd: xml namespace out of the sax messages fed to the css.comp.Writer.XMLImporter 2006/12/18 09:28:24 fridrich_strba 1.1.2.1: convert writerperfect into a framework where converter libraries based on libwpd's api can simply plug themselves
Diffstat (limited to 'writerperfect')
-rw-r--r--writerperfect/source/filter/DocumentHandler.cxx89
1 files changed, 89 insertions, 0 deletions
diff --git a/writerperfect/source/filter/DocumentHandler.cxx b/writerperfect/source/filter/DocumentHandler.cxx
new file mode 100644
index 000000000000..ab26689174ca
--- /dev/null
+++ b/writerperfect/source/filter/DocumentHandler.cxx
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2004 William Lachance (william.lachance@sympatico.ca)
+ * Copyright (C) 2004 Net Integration Technologies (http://www.net-itech.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * For further information visit http://libwpd.sourceforge.net
+ *
+ */
+#include "DocumentHandler.hxx"
+#include "FilterInternal.hxx"
+
+#include <string.h>
+
+#ifndef _COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_XML_SAX_XATTRIBUTELIST_HPP_
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#endif
+
+#ifndef _ATTRLIST_HPP_
+#include <xmloff/attrlist.hxx>
+#endif
+
+using namespace ::rtl;
+using rtl::OUString;
+
+using com::sun::star::xml::sax::XAttributeList;
+
+DocumentHandler::DocumentHandler(Reference < XDocumentHandler > &xHandler) :
+ mxHandler(xHandler)
+{
+}
+
+void DocumentHandler::startDocument()
+{
+ WRITER_DEBUG_MSG(("DocumentHandler::startDocument"));
+ mxHandler->startDocument();
+}
+
+void DocumentHandler::endDocument()
+{
+ WRITER_DEBUG_MSG(("DocumentHandler::endDocument"));
+ mxHandler->endDocument();
+}
+
+void DocumentHandler::startElement(const char *psName, const WPXPropertyList &xPropList)
+{
+ WRITER_DEBUG_MSG(("DocumentHandler::startElement"));
+ SvXMLAttributeList *pAttrList = new SvXMLAttributeList();
+ Reference < XAttributeList > xAttrList(pAttrList);
+ WPXPropertyList::Iter i(xPropList);
+ for (i.rewind(); i.next(); )
+ {
+ // filter out libwpd elements
+ if (strlen(i.key()) > 6 && strncmp(i.key(), "libwpd", 6) != 0)
+ pAttrList->AddAttribute(OUString::createFromAscii(i.key()),
+ OUString::createFromAscii(i()->getStr().cstr()));
+ }
+
+ mxHandler->startElement(OUString::createFromAscii(psName), xAttrList);
+}
+
+void DocumentHandler::endElement(const char *psName)
+{
+ WRITER_DEBUG_MSG(("DocumentHandler::endElement"));
+ mxHandler->endElement(OUString::createFromAscii(psName));
+}
+
+void DocumentHandler::characters(const WPXString &sCharacters)
+{
+ WRITER_DEBUG_MSG(("DocumentHandler::characters"));
+ OUString sCharU16(sCharacters.cstr(), strlen(sCharacters.cstr()), RTL_TEXTENCODING_UTF8);
+ mxHandler->characters(sCharU16);
+}