Kaydet (Commit) 54ad8ad0 authored tarafından Miklos Vajna's avatar Miklos Vajna

EPUB export: initial table support

Focusing on just not loosing plain text content, no actual formatting
yet.

Change-Id: Ic242f849730e1eb174f621f2235fa04563024e4e
üst 15253417
......@@ -81,6 +81,7 @@ $(eval $(call gb_Library_add_exception_objects,wpftwriter,\
writerperfect/source/writer/exp/xmlictxt \
writerperfect/source/writer/exp/xmlimp \
writerperfect/source/writer/exp/xmlmetai \
writerperfect/source/writer/exp/xmltbli \
writerperfect/source/writer/exp/xmltext \
))
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "xmltbli.hxx"
#include "txtparai.hxx"
#include "xmlimp.hxx"
using namespace com::sun::star;
namespace writerperfect
{
namespace exp
{
/// Handler for <table:cell>.
class XMLTableCellContext : public XMLImportContext
{
public:
XMLTableCellContext(XMLImport &rImport);
XMLImportContext *CreateChildContext(const OUString &rName, const css::uno::Reference<css::xml::sax::XAttributeList> &xAttribs) override;
void SAL_CALL startElement(const OUString &rName, const css::uno::Reference<css::xml::sax::XAttributeList> &xAttribs) override;
void SAL_CALL endElement(const OUString &rName) override;
};
XMLTableCellContext::XMLTableCellContext(XMLImport &rImport)
: XMLImportContext(rImport)
{
}
XMLImportContext *XMLTableCellContext::CreateChildContext(const OUString &rName, const css::uno::Reference<css::xml::sax::XAttributeList> &/*xAttribs*/)
{
if (rName == "text:p" || rName == "text:h")
return new XMLParaContext(mrImport);
if (rName == "table:table")
return new XMLTableContext(mrImport);
return nullptr;
}
void XMLTableCellContext::startElement(const OUString &/*rName*/, const css::uno::Reference<css::xml::sax::XAttributeList> &/*xAttribs*/)
{
mrImport.GetGenerator().openTableCell(librevenge::RVNGPropertyList());
}
void XMLTableCellContext::endElement(const OUString &/*rName*/)
{
mrImport.GetGenerator().closeTableCell();
}
/// Handler for <table:row>.
class XMLTableRowContext : public XMLImportContext
{
public:
XMLTableRowContext(XMLImport &rImport);
XMLImportContext *CreateChildContext(const OUString &rName, const css::uno::Reference<css::xml::sax::XAttributeList> &xAttribs) override;
void SAL_CALL startElement(const OUString &rName, const css::uno::Reference<css::xml::sax::XAttributeList> &xAttribs) override;
void SAL_CALL endElement(const OUString &rName) override;
};
XMLTableRowContext::XMLTableRowContext(XMLImport &rImport)
: XMLImportContext(rImport)
{
}
XMLImportContext *XMLTableRowContext::CreateChildContext(const OUString &rName, const css::uno::Reference<css::xml::sax::XAttributeList> &/*xAttribs*/)
{
if (rName == "table:table-cell")
return new XMLTableCellContext(mrImport);
return nullptr;
}
void XMLTableRowContext::startElement(const OUString &/*rName*/, const css::uno::Reference<css::xml::sax::XAttributeList> &/*xAttribs*/)
{
mrImport.GetGenerator().openTableRow(librevenge::RVNGPropertyList());
}
void XMLTableRowContext::endElement(const OUString &/*rName*/)
{
mrImport.GetGenerator().closeTableRow();
}
XMLTableContext::XMLTableContext(XMLImport &rImport)
: XMLImportContext(rImport)
{
}
XMLImportContext *XMLTableContext::CreateChildContext(const OUString &rName, const css::uno::Reference<css::xml::sax::XAttributeList> &/*xAttribs*/)
{
if (rName == "table:table-row")
return new XMLTableRowContext(mrImport);
return nullptr;
}
void XMLTableContext::startElement(const OUString &/*rName*/, const css::uno::Reference<css::xml::sax::XAttributeList> &/*xAttribs*/)
{
mrImport.GetGenerator().openTable(librevenge::RVNGPropertyList());
}
void XMLTableContext::endElement(const OUString &/*rName*/)
{
mrImport.GetGenerator().closeTable();
}
} // namespace exp
} // namespace writerperfect
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_WRITERPERFECT_SOURCE_WRITER_EXP_XMLTBLI_HXX
#define INCLUDED_WRITERPERFECT_SOURCE_WRITER_EXP_XMLTBLI_HXX
#include "xmlictxt.hxx"
namespace writerperfect
{
namespace exp
{
/// Handler for <table:table>.
class XMLTableContext : public XMLImportContext
{
public:
XMLTableContext(XMLImport &rImport);
XMLImportContext *CreateChildContext(const OUString &rName, const css::uno::Reference<css::xml::sax::XAttributeList> &xAttribs) override;
void SAL_CALL startElement(const OUString &rName, const css::uno::Reference<css::xml::sax::XAttributeList> &xAttribs) override;
void SAL_CALL endElement(const OUString &rName) override;
};
} // namespace exp
} // namespace writerperfect
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -10,6 +10,7 @@
#include "xmltext.hxx"
#include "txtparai.hxx"
#include "xmltbli.hxx"
using namespace com::sun::star;
......@@ -27,6 +28,8 @@ XMLImportContext *XMLBodyContentContext::CreateChildContext(const OUString &rNam
{
if (rName == "text:p" || rName == "text:h")
return new XMLParaContext(mrImport);
if (rName == "table:table")
return new XMLTableContext(mrImport);
return nullptr;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment