[Libreoffice-commits] core.git: writerperfect/Library_wpftwriter.mk writerperfect/source
writerperfect/Library_wpftwriter.mk |2 ++ writerperfect/source/writer/EPUBExportDialog.cxx | 17 + 2 files changed, 19 insertions(+) New commits: commit cd2c076f6478c6f06f9834f599f6c65354039d60 Author: Miklos VajnaDate: Fri Jan 19 11:39:01 2018 +0100 EPUB export UI: show remaining metadata from the doc model Title is not special in any way, showing author/language/date has the same benefits. Change-Id: Ie05071b88d7fa53ad0e39927904ea5e122a66c9a Reviewed-on: https://gerrit.libreoffice.org/48183 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/writerperfect/Library_wpftwriter.mk b/writerperfect/Library_wpftwriter.mk index 34e85770d699..2ac6bd141cf2 100644 --- a/writerperfect/Library_wpftwriter.mk +++ b/writerperfect/Library_wpftwriter.mk @@ -32,8 +32,10 @@ $(eval $(call gb_Library_use_libraries,wpftwriter,\ comphelper \ cppu \ cppuhelper \ + i18nlangtag \ vcl \ sal \ + sax \ sfx \ sot \ svt \ diff --git a/writerperfect/source/writer/EPUBExportDialog.cxx b/writerperfect/source/writer/EPUBExportDialog.cxx index 09ab58499a26..59e5cb4bf469 100644 --- a/writerperfect/source/writer/EPUBExportDialog.cxx +++ b/writerperfect/source/writer/EPUBExportDialog.cxx @@ -16,6 +16,7 @@ #include #include #include +#include #include "EPUBExportFilter.hxx" @@ -136,8 +137,24 @@ EPUBExportDialog::EPUBExportDialog(vcl::Window *pParent, comphelper::SequenceAsH m_pTitle->SetText(xDP->getTitle()); get(m_pInitialCreator, "author"); +if (xDP.is()) +m_pInitialCreator->SetText(xDP->getAuthor()); + get(m_pLanguage, "language"); +if (xDP.is()) +{ +OUString aLanguage(LanguageTag::convertToBcp47(xDP->getLanguage(), false)); +m_pLanguage->SetText(aLanguage); +} + get(m_pDate, "date"); +if (xDP.is()) +{ +OUStringBuffer aBuffer; +util::DateTime aDate(xDP->getModificationDate()); +sax::Converter::convertDateTime(aBuffer, aDate, nullptr, true); +m_pDate->SetText(aBuffer.makeStringAndClear()); +} get(m_pOKButton, "ok"); m_pOKButton->SetClickHdl(LINK(this, EPUBExportDialog, OKClickHdl)); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: writerperfect/Library_wpftwriter.mk writerperfect/source writerperfect/uiconfig writerperfect/UIConfig_writerperfect.mk
writerperfect/Library_wpftwriter.mk |1 writerperfect/UIConfig_writerperfect.mk |1 writerperfect/source/writer/EPUBExportDialog.cxx | 121 +++ writerperfect/source/writer/EPUBExportDialog.hxx | 41 +++ writerperfect/source/writer/EPUBExportFilter.cxx | 14 + writerperfect/source/writer/EPUBExportFilter.hxx |5 writerperfect/source/writer/EPUBExportUIComponent.cxx |9 writerperfect/uiconfig/ui/exportepub.ui | 194 ++ 8 files changed, 383 insertions(+), 3 deletions(-) New commits: commit 1f582e38dd8f2f9c556720e5d66d0d17318b095a Author: Miklos VajnaDate: Wed Sep 13 14:13:46 2017 +0200 EPUB export: add options dialog It just exposes the two options available at libepubgen level already. Change-Id: I428919ffe495b6d7ec2773f542e2fea6733d0a1c Reviewed-on: https://gerrit.libreoffice.org/42241 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/writerperfect/Library_wpftwriter.mk b/writerperfect/Library_wpftwriter.mk index d3d2cc9a209b..bf605e718dc1 100644 --- a/writerperfect/Library_wpftwriter.mk +++ b/writerperfect/Library_wpftwriter.mk @@ -68,6 +68,7 @@ $(eval $(call gb_Library_use_externals,wpftwriter,\ $(eval $(call gb_Library_add_exception_objects,wpftwriter,\ writerperfect/source/writer/AbiWordImportFilter \ writerperfect/source/writer/EBookImportFilter \ + writerperfect/source/writer/EPUBExportDialog \ writerperfect/source/writer/EPUBExportFilter \ writerperfect/source/writer/EPUBExportUIComponent \ writerperfect/source/writer/EPUBPackage \ diff --git a/writerperfect/UIConfig_writerperfect.mk b/writerperfect/UIConfig_writerperfect.mk index d0d8ef5030fb..8599babf7bde 100644 --- a/writerperfect/UIConfig_writerperfect.mk +++ b/writerperfect/UIConfig_writerperfect.mk @@ -21,6 +21,7 @@ $(eval $(call gb_UIConfig_UIConfig,writerperfect)) $(eval $(call gb_UIConfig_add_uifiles,writerperfect,\ writerperfect/uiconfig/ui/wpftencodingdialog \ + writerperfect/uiconfig/ui/exportepub \ )) # vim: set noet sw=4 ts=4: diff --git a/writerperfect/source/writer/EPUBExportDialog.cxx b/writerperfect/source/writer/EPUBExportDialog.cxx new file mode 100644 index ..50bad98b4281 --- /dev/null +++ b/writerperfect/source/writer/EPUBExportDialog.cxx @@ -0,0 +1,121 @@ +/* -*- 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 "EPUBExportDialog.hxx" + +#include "EPUBExportFilter.hxx" + +using namespace com::sun::star; + +namespace +{ +/// Converts version value to a listbox entry position. +sal_Int32 VersionToPosition(sal_Int32 nVersion) +{ +sal_Int32 nPosition = 0; + +switch (nVersion) +{ +case 30: +nPosition = 0; +break; +case 20: +nPosition = 1; +break; +default: +assert(false); +break; +} + +return nPosition; +} + +/// Converts listbox entry position to a version value. +sal_Int32 PositionToVersion(sal_Int32 nPosition) +{ +sal_Int32 nVersion = 0; + +switch (nPosition) +{ +case 0: +nVersion = 30; +break; +case 1: +nVersion = 20; +break; +default: +assert(false); +break; +} + +return nVersion; +} +} + +namespace writerperfect +{ + +EPUBExportDialog::EPUBExportDialog(vcl::Window *pParent, comphelper::SequenceAsHashMap ) +: ModalDialog(pParent, "EpubDialog", "writerperfect/ui/exportepub.ui"), + mrFilterData(rFilterData) +{ +get(m_pVersion, "versionlb"); +assert(PositionToVersion(m_pVersion->GetSelectEntryPos()) == EPUBExportFilter::GetDefaultVersion()); + +auto it = rFilterData.find("EPUBVersion"); +if (it != rFilterData.end()) +{ +sal_Int32 nVersion = 0; +if (it->second >>= nVersion) +m_pVersion->SelectEntryPos(VersionToPosition(nVersion)); +} +m_pVersion->SetSelectHdl(LINK(this, EPUBExportDialog, VersionSelectHdl)); + +get(m_pSplit, "splitlb"); +it = rFilterData.find("EPUBSplitMethod"); +if (it != rFilterData.end()) +{ +sal_Int32 nSplitMethod = 0; +if (it->second >>= nSplitMethod) +// No conversion, 1:1 mapping between libepubgen::EPUBSplitMethod +// and entry positions. +m_pVersion->SelectEntryPos(nSplitMethod); +} +else +m_pSplit->SelectEntryPos(EPUBExportFilter::GetDefaultSplitMethod()); +m_pSplit->SetSelectHdl(LINK(this, EPUBExportDialog, SplitSelectHdl)); +} + +IMPL_LINK_NOARG(EPUBExportDialog, VersionSelectHdl,
[Libreoffice-commits] core.git: writerperfect/Library_wpftwriter.mk writerperfect/source
writerperfect/Library_wpftwriter.mk |2 writerperfect/source/writer/exp/txtparai.cxx | 17 - writerperfect/source/writer/exp/txtstyli.cxx | 90 +++ writerperfect/source/writer/exp/txtstyli.hxx | 44 + writerperfect/source/writer/exp/xmlfmt.cxx | 37 +++ writerperfect/source/writer/exp/xmlfmt.hxx | 36 ++ writerperfect/source/writer/exp/xmlimp.cxx |8 ++ writerperfect/source/writer/exp/xmlimp.hxx |4 - 8 files changed, 235 insertions(+), 3 deletions(-) New commits: commit bb4e52096db668533bae40f5155749a9986108a2 Author: Miklos VajnaDate: Fri Aug 25 16:12:03 2017 +0200 EPUB export: add support for page breaks EPUB_SPLIT_METHOD is still hardcoded to HEADING, so while we send the page break info to librevenge now, it's ignored on that end. This requies basic infrastructure for automatic styles. Change-Id: Ibafead0dedd9dbfa6223a9c701a62611ba2671fd Reviewed-on: https://gerrit.libreoffice.org/41573 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/writerperfect/Library_wpftwriter.mk b/writerperfect/Library_wpftwriter.mk index 9cbef7f31309..67c1d999f887 100644 --- a/writerperfect/Library_wpftwriter.mk +++ b/writerperfect/Library_wpftwriter.mk @@ -78,6 +78,8 @@ $(eval $(call gb_Library_add_exception_objects,wpftwriter,\ writerperfect/source/writer/exp/XMLBase64ImportContext \ writerperfect/source/writer/exp/XMLTextFrameContext \ writerperfect/source/writer/exp/txtparai \ + writerperfect/source/writer/exp/txtstyli \ + writerperfect/source/writer/exp/xmlfmt \ writerperfect/source/writer/exp/xmlictxt \ writerperfect/source/writer/exp/xmlimp \ writerperfect/source/writer/exp/xmlmetai \ diff --git a/writerperfect/source/writer/exp/txtparai.cxx b/writerperfect/source/writer/exp/txtparai.cxx index 600709d9fec8..e669cf89edf8 100644 --- a/writerperfect/source/writer/exp/txtparai.cxx +++ b/writerperfect/source/writer/exp/txtparai.cxx @@ -124,10 +124,23 @@ void XMLParaContext::startElement(const OUString &/*rName*/, const css::uno::Ref for (sal_Int16 i = 0; i < xAttribs->getLength(); ++i) { const OUString = xAttribs->getNameByIndex(i); -if (rAttributeName != "text:style-name") +const OUString = xAttribs->getValueByIndex(i); +if (rAttributeName == "text:style-name") +{ +// Reference to an automatic style, try to look it up. +auto itStyle = mrImport.GetAutomaticStyles().find(rAttributeValue); +if (itStyle == mrImport.GetAutomaticStyles().end()) +continue; + +// Apply properties directly, librevenge has no notion of automatic styles. +librevenge::RVNGPropertyList::Iter itProp(itStyle->second); +for (itProp.rewind(); itProp.next();) +aPropertyList.insert(itProp.key(), itProp()); +} +else { OString sName = OUStringToOString(rAttributeName, RTL_TEXTENCODING_UTF8); -OString sValue = OUStringToOString(xAttribs->getValueByIndex(i), RTL_TEXTENCODING_UTF8); +OString sValue = OUStringToOString(rAttributeValue, RTL_TEXTENCODING_UTF8); aPropertyList.insert(sName.getStr(), sValue.getStr()); } } diff --git a/writerperfect/source/writer/exp/txtstyli.cxx b/writerperfect/source/writer/exp/txtstyli.cxx new file mode 100644 index ..a7460a47c1b6 --- /dev/null +++ b/writerperfect/source/writer/exp/txtstyli.cxx @@ -0,0 +1,90 @@ +/* -*- 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 "txtstyli.hxx" + +#include "xmlimp.hxx" + +using namespace com::sun::star; + +namespace writerperfect +{ +namespace exp +{ + +/// Handler for . +class XMLParagraphPropertiesContext : public XMLImportContext +{ +public: +XMLParagraphPropertiesContext(XMLImport , XMLStyleContext ); + +void SAL_CALL startElement(const OUString , const css::uno::Reference ) override; + +private: +XMLStyleContext +}; + +XMLParagraphPropertiesContext::XMLParagraphPropertiesContext(XMLImport , XMLStyleContext ) +: XMLImportContext(rImport) +, mrStyle(rStyle) +{ +} + +void XMLParagraphPropertiesContext::startElement(const OUString &/*rName*/, const css::uno::Reference ) +{ +for (sal_Int16 i = 0; i < xAttribs->getLength(); ++i) +{ +OString sName = OUStringToOString(xAttribs->getNameByIndex(i), RTL_TEXTENCODING_UTF8); +OString sValue = OUStringToOString(xAttribs->getValueByIndex(i),
[Libreoffice-commits] core.git: writerperfect/Library_wpftwriter.mk writerperfect/source
writerperfect/Library_wpftwriter.mk |1 writerperfect/source/writer/exp/xmltbli.cxx | 117 writerperfect/source/writer/exp/xmltbli.hxx | 37 writerperfect/source/writer/exp/xmltext.cxx |3 4 files changed, 158 insertions(+) New commits: commit 54ad8ad0f0ce22299d28b4ec09eea26ad2691642 Author: Miklos VajnaDate: Tue Aug 22 17:53:33 2017 +0200 EPUB export: initial table support Focusing on just not loosing plain text content, no actual formatting yet. Change-Id: Ic242f849730e1eb174f621f2235fa04563024e4e diff --git a/writerperfect/Library_wpftwriter.mk b/writerperfect/Library_wpftwriter.mk index 1f28b440b05b..9cbef7f31309 100644 --- a/writerperfect/Library_wpftwriter.mk +++ b/writerperfect/Library_wpftwriter.mk @@ -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 \ )) diff --git a/writerperfect/source/writer/exp/xmltbli.cxx b/writerperfect/source/writer/exp/xmltbli.cxx new file mode 100644 index ..bcdc4cb46220 --- /dev/null +++ b/writerperfect/source/writer/exp/xmltbli.cxx @@ -0,0 +1,117 @@ +/* -*- 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 . +class XMLTableCellContext : public XMLImportContext +{ +public: +XMLTableCellContext(XMLImport ); + +XMLImportContext *CreateChildContext(const OUString , const css::uno::Reference ) override; + +void SAL_CALL startElement(const OUString , const css::uno::Reference ) override; +void SAL_CALL endElement(const OUString ) override; +}; + +XMLTableCellContext::XMLTableCellContext(XMLImport ) +: XMLImportContext(rImport) +{ +} + +XMLImportContext *XMLTableCellContext::CreateChildContext(const OUString , const css::uno::Reference &/*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 &/*xAttribs*/) +{ +mrImport.GetGenerator().openTableCell(librevenge::RVNGPropertyList()); +} + +void XMLTableCellContext::endElement(const OUString &/*rName*/) +{ +mrImport.GetGenerator().closeTableCell(); +} + +/// Handler for . +class XMLTableRowContext : public XMLImportContext +{ +public: +XMLTableRowContext(XMLImport ); + +XMLImportContext *CreateChildContext(const OUString , const css::uno::Reference ) override; + +void SAL_CALL startElement(const OUString , const css::uno::Reference ) override; +void SAL_CALL endElement(const OUString ) override; +}; + +XMLTableRowContext::XMLTableRowContext(XMLImport ) +: XMLImportContext(rImport) +{ +} + +XMLImportContext *XMLTableRowContext::CreateChildContext(const OUString , const css::uno::Reference &/*xAttribs*/) +{ +if (rName == "table:table-cell") +return new XMLTableCellContext(mrImport); +return nullptr; +} + +void XMLTableRowContext::startElement(const OUString &/*rName*/, const css::uno::Reference &/*xAttribs*/) +{ +mrImport.GetGenerator().openTableRow(librevenge::RVNGPropertyList()); +} + +void XMLTableRowContext::endElement(const OUString &/*rName*/) +{ +mrImport.GetGenerator().closeTableRow(); +} + +XMLTableContext::XMLTableContext(XMLImport ) +: XMLImportContext(rImport) +{ +} + +XMLImportContext *XMLTableContext::CreateChildContext(const OUString , const css::uno::Reference &/*xAttribs*/) +{ +if (rName == "table:table-row") +return new XMLTableRowContext(mrImport); +return nullptr; +} + +void XMLTableContext::startElement(const OUString &/*rName*/, const css::uno::Reference &/*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: */ diff --git a/writerperfect/source/writer/exp/xmltbli.hxx b/writerperfect/source/writer/exp/xmltbli.hxx new file mode 100644 index ..ceeb098c1f9c --- /dev/null +++ b/writerperfect/source/writer/exp/xmltbli.hxx @@ -0,0 +1,37 @@ +/*
[Libreoffice-commits] core.git: writerperfect/Library_wpftwriter.mk writerperfect/source
writerperfect/Library_wpftwriter.mk|2 writerperfect/source/writer/EPUBPackage.cxx| 21 ++ writerperfect/source/writer/exp/XMLBase64ImportContext.cxx | 46 ++ writerperfect/source/writer/exp/XMLBase64ImportContext.hxx | 43 + writerperfect/source/writer/exp/XMLTextFrameContext.cxx| 99 + writerperfect/source/writer/exp/XMLTextFrameContext.hxx| 41 + writerperfect/source/writer/exp/txtparai.cxx | 10 + 7 files changed, 258 insertions(+), 4 deletions(-) New commits: commit 28102e471d3cb6b6976380ca84b1094078ac1af1 Author: Miklos VajnaDate: Thu Aug 17 18:03:53 2017 +0200 EPUB export: handle inline images Just the bare minimum, so that the binary file-related member functions of the package interface are triggered, so I can implement them. Change-Id: I996659126667423fded1f89f8097ac726418fa00 Reviewed-on: https://gerrit.libreoffice.org/41261 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/writerperfect/Library_wpftwriter.mk b/writerperfect/Library_wpftwriter.mk index ba2172100f00..1f28b440b05b 100644 --- a/writerperfect/Library_wpftwriter.mk +++ b/writerperfect/Library_wpftwriter.mk @@ -75,6 +75,8 @@ $(eval $(call gb_Library_add_exception_objects,wpftwriter,\ writerperfect/source/writer/PagesImportFilter \ writerperfect/source/writer/StarOfficeWriterImportFilter \ writerperfect/source/writer/WordPerfectImportFilter \ + writerperfect/source/writer/exp/XMLBase64ImportContext \ + writerperfect/source/writer/exp/XMLTextFrameContext \ writerperfect/source/writer/exp/txtparai \ writerperfect/source/writer/exp/xmlictxt \ writerperfect/source/writer/exp/xmlimp \ diff --git a/writerperfect/source/writer/EPUBPackage.cxx b/writerperfect/source/writer/EPUBPackage.cxx index 7818f584b76f..3a33dedac3eb 100644 --- a/writerperfect/source/writer/EPUBPackage.cxx +++ b/writerperfect/source/writer/EPUBPackage.cxx @@ -140,17 +140,30 @@ void EPUBPackage::closeCSSFile() void EPUBPackage::openBinaryFile(const char *pName) { -SAL_WARN("writerperfect", "EPUBPackage::openBinaryFile, " << pName << ": implement me"); +assert(pName); +assert(!mxOutputStream.is()); + + mxOutputStream.set(mxStorage->openStreamElementByHierarchicalName(OUString::fromUtf8(pName), embed::ElementModes::READWRITE), uno::UNO_QUERY); } -void EPUBPackage::insertBinaryData(const librevenge::RVNGBinaryData &/*rData*/) +void EPUBPackage::insertBinaryData(const librevenge::RVNGBinaryData ) { -SAL_WARN("writerperfect", "EPUBPackage::insertBinaryData: implement me"); +assert(mxOutputStream.is()); + +if (rData.empty()) +return; + +uno::Sequence aData(reinterpret_cast(rData.getDataBuffer()), rData.size()); +mxOutputStream->writeBytes(aData); } void EPUBPackage::closeBinaryFile() { -SAL_WARN("writerperfect", "EPUBPackage::closeBinaryFile: implement me"); +assert(mxOutputStream.is()); + +uno::Reference xTransactedObject(mxOutputStream, uno::UNO_QUERY); +xTransactedObject->commit(); +mxOutputStream.clear(); } void EPUBPackage::openTextFile(const char *pName) diff --git a/writerperfect/source/writer/exp/XMLBase64ImportContext.cxx b/writerperfect/source/writer/exp/XMLBase64ImportContext.cxx new file mode 100644 index ..c073d8fc19bd --- /dev/null +++ b/writerperfect/source/writer/exp/XMLBase64ImportContext.cxx @@ -0,0 +1,46 @@ +/* -*- 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 "XMLBase64ImportContext.hxx" + +using namespace com::sun::star; + +namespace writerperfect +{ +namespace exp +{ + +XMLBase64ImportContext::XMLBase64ImportContext(XMLImport ) +: XMLImportContext(rImport) +{ +} + +void XMLBase64ImportContext::startElement(const OUString &/*rName*/, const css::uno::Reference &/*xAttribs*/) +{ +} + +void XMLBase64ImportContext::endElement(const OUString &/*rName*/) +{ +} + +void XMLBase64ImportContext::characters(const OUString ) +{ +OString sCharU8 = OUStringToOString(rChars, RTL_TEXTENCODING_UTF8); +m_aBinaryData.appendBase64Data(librevenge::RVNGString(sCharU8.getStr())); +} + +const librevenge::RVNGBinaryData ::getBinaryData() const +{ +return m_aBinaryData; +} + +} // namespace exp +} // namespace writerperfect + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/writer/exp/XMLBase64ImportContext.hxx b/writerperfect/source/writer/exp/XMLBase64ImportContext.hxx new file mode 100644 index ..f60122b61382 --- /dev/null +++
[Libreoffice-commits] core.git: writerperfect/Library_wpftwriter.mk writerperfect/source
writerperfect/Library_wpftwriter.mk |2 writerperfect/source/writer/EPUBExportFilter.cxx |4 writerperfect/source/writer/EPUBPackage.cxx | 103 +++ writerperfect/source/writer/EPUBPackage.hxx | 68 +++ 4 files changed, 177 insertions(+) New commits: commit 15d0dd662c79c24944689f9fa7396d85ce4f33e2 Author: Miklos VajnaDate: Thu Aug 3 11:04:07 2017 +0200 EPUB export: add initial package implementation Just a skeleton, doesn't use comphelper::OStorageHelper yet. Change-Id: Ic83e05b3a041c0c572e294eacd5b9dcb6eeae897 Reviewed-on: https://gerrit.libreoffice.org/40703 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/writerperfect/Library_wpftwriter.mk b/writerperfect/Library_wpftwriter.mk index 5d9b6b47ed1d..953f00c3e0d9 100644 --- a/writerperfect/Library_wpftwriter.mk +++ b/writerperfect/Library_wpftwriter.mk @@ -49,6 +49,7 @@ $(eval $(call gb_Library_use_externals,wpftwriter,\ abw \ boost_headers \ ebook \ + epubgen \ etonyek \ icu_headers \ icui18n \ @@ -68,6 +69,7 @@ $(eval $(call gb_Library_add_exception_objects,wpftwriter,\ writerperfect/source/writer/AbiWordImportFilter \ writerperfect/source/writer/EBookImportFilter \ writerperfect/source/writer/EPUBExportFilter \ + writerperfect/source/writer/EPUBPackage \ writerperfect/source/writer/MSWorksImportFilter \ writerperfect/source/writer/MWAWImportFilter \ writerperfect/source/writer/PagesImportFilter \ diff --git a/writerperfect/source/writer/EPUBExportFilter.cxx b/writerperfect/source/writer/EPUBExportFilter.cxx index 3e4bd6198de1..75032cae6ada 100644 --- a/writerperfect/source/writer/EPUBExportFilter.cxx +++ b/writerperfect/source/writer/EPUBExportFilter.cxx @@ -16,6 +16,7 @@ #include #include "exp/xmlimp.hxx" +#include "EPUBPackage.hxx" using namespace com::sun::star; @@ -29,6 +30,9 @@ EPUBExportFilter::EPUBExportFilter(const uno::Reference sal_Bool EPUBExportFilter::filter(const uno::Sequence ) { +// The package writes to the output file. +EPUBPackage aPackage(mxContext, rDescriptor); + // Create ODT exporter, this will feed our document handler. uno::Reference xInitialization(mxContext->getServiceManager()->createInstanceWithContext("com.sun.star.comp.Writer.XMLOasisExporter", mxContext), uno::UNO_QUERY); diff --git a/writerperfect/source/writer/EPUBPackage.cxx b/writerperfect/source/writer/EPUBPackage.cxx new file mode 100644 index ..0296b183327c --- /dev/null +++ b/writerperfect/source/writer/EPUBPackage.cxx @@ -0,0 +1,103 @@ +/* -*- 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 "EPUBPackage.hxx" + +using namespace com::sun::star; + +namespace writerperfect +{ + +EPUBPackage::EPUBPackage(const uno::Reference , const uno::Sequence &/*rDescriptor*/) +: mxContext(xContext) +{ +} + +EPUBPackage::~EPUBPackage() +{ +} + +void EPUBPackage::openXMLFile(const char *pName) +{ +SAL_WARN("writerperfect", "EPUBPackage::openXMLFile, " << pName << ": implement me"); +} + +void EPUBPackage::openElement(const char *pName, const librevenge::RVNGPropertyList &/*rAttributes*/) +{ +SAL_WARN("writerperfect", "EPUBPackage::openElement, " << pName << ": implement me"); +} + +void EPUBPackage::closeElement(const char *pName) +{ +SAL_WARN("writerperfect", "EPUBPackage::closeElement, " << pName << ": implement me"); +} + +void EPUBPackage::insertCharacters(const librevenge::RVNGString &/*rCharacters*/) +{ +SAL_WARN("writerperfect", "EPUBPackage::insertCharacters: implement me"); +} + +void EPUBPackage::closeXMLFile() +{ +SAL_WARN("writerperfect", "EPUBPackage::closeXMLFile: implement me"); +} + +void EPUBPackage::openCSSFile(const char *pName) +{ +SAL_WARN("writerperfect", "EPUBPackage::openCSSFile, " << pName << ": implement me"); +} + +void EPUBPackage::insertRule(const librevenge::RVNGString &/*rSelector*/, const librevenge::RVNGPropertyList &/*rProperties*/) +{ +SAL_WARN("writerperfect", "EPUBPackage::insertRule: implement me"); +} + +void EPUBPackage::closeCSSFile() +{ +SAL_WARN("writerperfect", "EPUBPackage::closeCSSFile: implement me"); +} + +void EPUBPackage::openBinaryFile(const char *pName) +{ +SAL_WARN("writerperfect", "EPUBPackage::openBinaryFile, " << pName << ": implement me"); +} + +void EPUBPackage::insertBinaryData(const librevenge::RVNGBinaryData &/*rData*/) +{ +SAL_WARN("writerperfect", "EPUBPackage::insertBinaryData: implement me"); +} + +void
[Libreoffice-commits] core.git: writerperfect/Library_wpftwriter.mk writerperfect/source
writerperfect/Library_wpftwriter.mk |1 writerperfect/source/writer/EPUBExportFilter.cxx |4 + writerperfect/source/writer/exp/xmlimp.cxx | 60 +++ writerperfect/source/writer/exp/xmlimp.hxx | 47 ++ 4 files changed, 111 insertions(+), 1 deletion(-) New commits: commit c90e9ca50300c7f59558095c2716c098632c8d37 Author: Miklos VajnaDate: Tue Aug 1 16:45:44 2017 +0200 EPUB export: add initial document handler It doesn't do anything useful yet, though. Change-Id: Ic881a9aec92981306aa815d9d10b6aa0ea949237 Reviewed-on: https://gerrit.libreoffice.org/40639 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/writerperfect/Library_wpftwriter.mk b/writerperfect/Library_wpftwriter.mk index 85ede9a89f74..5d9b6b47ed1d 100644 --- a/writerperfect/Library_wpftwriter.mk +++ b/writerperfect/Library_wpftwriter.mk @@ -73,6 +73,7 @@ $(eval $(call gb_Library_add_exception_objects,wpftwriter,\ writerperfect/source/writer/PagesImportFilter \ writerperfect/source/writer/StarOfficeWriterImportFilter \ writerperfect/source/writer/WordPerfectImportFilter \ + writerperfect/source/writer/exp/xmlimp \ )) # vim: set noet sw=4 ts=4: diff --git a/writerperfect/source/writer/EPUBExportFilter.cxx b/writerperfect/source/writer/EPUBExportFilter.cxx index 36cff7ab9dd6..3e4bd6198de1 100644 --- a/writerperfect/source/writer/EPUBExportFilter.cxx +++ b/writerperfect/source/writer/EPUBExportFilter.cxx @@ -15,6 +15,8 @@ #include +#include "exp/xmlimp.hxx" + using namespace com::sun::star; namespace writerperfect @@ -31,7 +33,7 @@ sal_Bool EPUBExportFilter::filter(const uno::Sequence uno::Reference xInitialization(mxContext->getServiceManager()->createInstanceWithContext("com.sun.star.comp.Writer.XMLOasisExporter", mxContext), uno::UNO_QUERY); // The document handler will make the calls on the text interface provided by the EPUB export. -uno::Reference xExportHandler; +uno::Reference xExportHandler(new exp::XMLImport); // Let the ODT exporter read the doc model and invoke the doc handler. xInitialization->initialize({uno::makeAny(xExportHandler)}); diff --git a/writerperfect/source/writer/exp/xmlimp.cxx b/writerperfect/source/writer/exp/xmlimp.cxx new file mode 100644 index ..1c915857413e --- /dev/null +++ b/writerperfect/source/writer/exp/xmlimp.cxx @@ -0,0 +1,60 @@ +/* -*- 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 "xmlimp.hxx" + +using namespace com::sun::star; + +namespace writerperfect +{ +namespace exp +{ + +XMLImport::XMLImport() +{ +} + +void XMLImport::startDocument() +{ +} + +void XMLImport::endDocument() +{ +} + +void XMLImport::startElement(const OUString &/*rName*/, const css::uno::Reference &/*xAttribs*/) +{ +} + +void XMLImport::endElement(const OUString &/*rName*/) +{ +} + +void XMLImport::characters(const OUString &/*rChars*/) +{ +} + +void XMLImport::ignorableWhitespace(const OUString &/*rWhitespaces*/) +{ +} + +void XMLImport::processingInstruction(const OUString &/*rTarget*/, const OUString &/*rData*/) +{ +SAL_WARN("writerperfect", "XMLImport::processingInstruction: implement me"); +} + +void XMLImport::setDocumentLocator(const css::uno::Reference &/*xLocator*/) +{ +SAL_WARN("writerperfect", "XMLImport::setDocumentLocator: implement me"); +} + +} // namespace exp +} // namespace writerperfect + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/writer/exp/xmlimp.hxx b/writerperfect/source/writer/exp/xmlimp.hxx new file mode 100644 index ..9d6d1eb4c0c6 --- /dev/null +++ b/writerperfect/source/writer/exp/xmlimp.hxx @@ -0,0 +1,47 @@ +/* -*- 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_XMLIMP_HXX +#define INCLUDED_WRITERPERFECT_SOURCE_WRITER_EXP_XMLIMP_HXX + +#include + +#include + +namespace writerperfect +{ +namespace exp +{ + +/// ODT export feeds this class to make librevenge calls. +class XMLImport : public cppu::WeakImplHelper +< +css::xml::sax::XDocumentHandler +> +{ +public: +XMLImport(); + +// XDocumentHandler +void SAL_CALL startDocument() override; +void SAL_CALL endDocument() override; +void
[Libreoffice-commits] core.git: writerperfect/Library_wpftwriter.mk writerperfect/source
writerperfect/Library_wpftwriter.mk |6 writerperfect/source/writer/AbiWordImportFilter.cxx |2 writerperfect/source/writer/AbiWordImportFilter.hxx | 10 writerperfect/source/writer/DocumentHandlerForOdt.hxx | 31 +++ writerperfect/source/writer/EBookImportFilter.cxx |2 writerperfect/source/writer/EBookImportFilter.hxx | 10 writerperfect/source/writer/ImportFilterBase.cxx | 183 -- writerperfect/source/writer/ImportFilterBase.hxx | 114 --- writerperfect/source/writer/MSWorksImportFilter.cxx |2 writerperfect/source/writer/MSWorksImportFilter.hxx | 10 writerperfect/source/writer/MWAWImportFilter.cxx |2 writerperfect/source/writer/MWAWImportFilter.hxx | 10 12 files changed, 64 insertions(+), 318 deletions(-) New commits: commit d19f950dc49ee4b635bfecfd1ff8f1b1b5f4358a Author: Takeshi Abe t...@fixedpoint.jp Date: Sun Oct 19 22:00:59 2014 +0900 fdo#84168 change writerperfect filters to use a new base class template in writerperfect/source/writer. Change-Id: I8840f13b44aa1060dab9383583bdb1db4db70aaa Reviewed-on: https://gerrit.libreoffice.org/12038 Reviewed-by: David Tardon dtar...@redhat.com Tested-by: David Tardon dtar...@redhat.com diff --git a/writerperfect/Library_wpftwriter.mk b/writerperfect/Library_wpftwriter.mk index db6afdf..b47c271 100644 --- a/writerperfect/Library_wpftwriter.mk +++ b/writerperfect/Library_wpftwriter.mk @@ -19,6 +19,11 @@ $(eval $(call gb_Library_Library,wpftwriter)) +$(eval $(call gb_Library_set_include,wpftwriter,\ + -I$(SRCDIR)/writerperfect/inc \ + $$(INCLUDE) \ +)) + $(eval $(call gb_Library_set_componentfile,wpftwriter,writerperfect/source/writer/wpftwriter)) $(eval $(call gb_Library_use_sdk_api,wpftwriter)) @@ -58,7 +63,6 @@ $(eval $(call gb_Library_use_externals,wpftwriter,\ $(eval $(call gb_Library_add_exception_objects,wpftwriter,\ writerperfect/source/writer/AbiWordImportFilter \ writerperfect/source/writer/EBookImportFilter \ - writerperfect/source/writer/ImportFilterBase \ writerperfect/source/writer/MSWorksImportFilter \ writerperfect/source/writer/MWAWImportFilter \ writerperfect/source/writer/WordPerfectImportFilter \ diff --git a/writerperfect/source/writer/AbiWordImportFilter.cxx b/writerperfect/source/writer/AbiWordImportFilter.cxx index 87a2a6e..11b3e18 100644 --- a/writerperfect/source/writer/AbiWordImportFilter.cxx +++ b/writerperfect/source/writer/AbiWordImportFilter.cxx @@ -24,7 +24,7 @@ using com::sun::star::uno::RuntimeException; using com::sun::star::uno::XComponentContext; using com::sun::star::uno::XInterface; -bool AbiWordImportFilter::doImportDocument(librevenge::RVNGInputStream rInput, librevenge::RVNGTextInterface rGenerator, utl::MediaDescriptor ) +bool AbiWordImportFilter::doImportDocument(librevenge::RVNGInputStream rInput, OdtGenerator rGenerator, utl::MediaDescriptor ) { return libabw::AbiDocument::parse(rInput, rGenerator); } diff --git a/writerperfect/source/writer/AbiWordImportFilter.hxx b/writerperfect/source/writer/AbiWordImportFilter.hxx index b0ea57e..2cee47b 100644 --- a/writerperfect/source/writer/AbiWordImportFilter.hxx +++ b/writerperfect/source/writer/AbiWordImportFilter.hxx @@ -13,16 +13,18 @@ #include com/sun/star/lang/XServiceInfo.hpp #include com/sun/star/uno/XComponentContext.hpp -#include ImportFilterBase.hxx +#include writerperfect/ImportFilter.hxx + +#include DocumentHandlerForOdt.hxx /* This component will be instantiated for both import or export. Whether it calls * setSourceDocument or setTargetDocument determines which Impl function the filter * member calls */ -class AbiWordImportFilter : public writerperfect::writer::ImportFilterBase +class AbiWordImportFilter : public writerperfect::ImportFilterOdtGenerator { public: AbiWordImportFilter(const ::com::sun::star::uno::Reference ::com::sun::star::uno::XComponentContext rxContext) -: writerperfect::writer::ImportFilterBase(rxContext) {} +: writerperfect::ImportFilterOdtGenerator(rxContext) {} // XServiceInfo virtual OUString SAL_CALL getImplementationName() @@ -34,7 +36,7 @@ public: private: virtual bool doDetectFormat(librevenge::RVNGInputStream rInput, OUString rTypeName) SAL_OVERRIDE; -virtual bool doImportDocument(librevenge::RVNGInputStream rInput, librevenge::RVNGTextInterface rGenerator, utl::MediaDescriptor ) SAL_OVERRIDE; +virtual bool doImportDocument(librevenge::RVNGInputStream rInput, OdtGenerator rGenerator, utl::MediaDescriptor ) SAL_OVERRIDE; }; OUString AbiWordImportFilter_getImplementationName() diff --git a/writerperfect/source/writer/DocumentHandlerForOdt.hxx b/writerperfect/source/writer/DocumentHandlerForOdt.hxx new file mode 100644 index 000..baf1462 --- /dev/null +++ b/writerperfect/source/writer/DocumentHandlerForOdt.hxx @@
[Libreoffice-commits] core.git: writerperfect/Library_wpftwriter.mk writerperfect/source writerperfect/util
writerperfect/Library_wpftwriter.mk |3 writerperfect/source/writer/MSWorksImportFilter.cxx |1 writerperfect/source/writer/MWAWImportFilter.cxx | 1012 +++ writerperfect/source/writer/MWAWImportFilter.hxx | 91 + writerperfect/source/writer/WordPerfectImportFilter.cxx |2 writerperfect/source/writer/wpftwriter_genericfilter.cxx |4 writerperfect/util/wpftwriter.component |4 7 files changed, 1114 insertions(+), 3 deletions(-) New commits: commit 23a2f5fce5844b6590e474939f2e3f5f87aa5256 Author: Fridrich Å trba fridrich.st...@bluewin.ch Date: Thu Mar 14 15:55:12 2013 +0100 First step for a MWAWImportFilter Change-Id: I03f48d26a4bafcd82cb96b1b90a7f49f3ea433ce diff --git a/writerperfect/Library_wpftwriter.mk b/writerperfect/Library_wpftwriter.mk index c3d1dde..00d8107 100644 --- a/writerperfect/Library_wpftwriter.mk +++ b/writerperfect/Library_wpftwriter.mk @@ -52,10 +52,13 @@ $(eval $(call gb_Library_use_externals,wpftwriter,\ wpd \ wpg \ wps \ + mwaw \ + zlib \ )) $(eval $(call gb_Library_add_exception_objects,wpftwriter,\ writerperfect/source/writer/MSWorksImportFilter \ + writerperfect/source/writer/MWAWImportFilter \ writerperfect/source/writer/WordPerfectImportFilter \ writerperfect/source/writer/wpftwriter_genericfilter \ )) diff --git a/writerperfect/source/writer/MSWorksImportFilter.cxx b/writerperfect/source/writer/MSWorksImportFilter.cxx index 6c37a36..11b294d 100644 --- a/writerperfect/source/writer/MSWorksImportFilter.cxx +++ b/writerperfect/source/writer/MSWorksImportFilter.cxx @@ -55,7 +55,6 @@ using com::sun::star::xml::sax::XAttributeList; using com::sun::star::xml::sax::XDocumentHandler; using com::sun::star::xml::sax::XParser; -void callHandler(Reference XDocumentHandler xDocHandler); sal_Bool SAL_CALL MSWorksImportFilter::importImpl( const Sequence ::com::sun::star::beans::PropertyValue aDescriptor ) throw (RuntimeException) diff --git a/writerperfect/source/writer/MWAWImportFilter.cxx b/writerperfect/source/writer/MWAWImportFilter.cxx new file mode 100644 index 000..c282a33 --- /dev/null +++ b/writerperfect/source/writer/MWAWImportFilter.cxx @@ -0,0 +1,1012 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* MWAWImportFilter: Sets up the filter, and calls DocumentCollector + * to do the actual filtering + * + * 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 osl/diagnose.h +#include rtl/tencinfo.h + +#include com/sun/star/io/XInputStream.hpp +#include com/sun/star/xml/sax/XAttributeList.hpp +#include com/sun/star/xml/sax/XDocumentHandler.hpp +#include com/sun/star/xml/sax/InputSource.hpp +#include com/sun/star/xml/sax/XParser.hpp +#include com/sun/star/io/XSeekable.hpp +#include com/sun/star/uno/Reference.h + +#include comphelper/componentcontext.hxx +#include xmloff/attrlist.hxx +#include ucbhelper/content.hxx + +#include libmwaw/libmwaw.hxx + +#include filter/FilterInternal.hxx +#include filter/DocumentHandler.hxx +#include filter/OdtGenerator.hxx +#include MWAWImportFilter.hxx +#include stream/WPXSvStream.h + +#include iostream + +using namespace ::com::sun::star::uno; +using rtl::OUString; +using com::sun::star::uno::Sequence; +using com::sun::star::uno::Reference; +using com::sun::star::uno::Any; +using com::sun::star::uno::UNO_QUERY; +using com::sun::star::uno::XInterface; +using com::sun::star::uno::Exception; +using com::sun::star::uno::RuntimeException; +using com::sun::star::beans::PropertyValue; +using com::sun::star::document::XFilter; +using com::sun::star::document::XExtendedFilterDetection; +using com::sun::star::ucb::XCommandEnvironment; + +using com::sun::star::io::XInputStream; +using com::sun::star::document::XImporter; +using com::sun::star::xml::sax::InputSource; +using com::sun::star::xml::sax::XAttributeList; +using com::sun::star::xml::sax::XDocumentHandler; +using com::sun::star::xml::sax::XParser; + +namespace +{ + +//! Internal: creates the string f pt +static std::string getStringPt(double f) +{ +std::stringstream s; +s float(f) pt; +return s.str(); +} + +static double getSizeInPt(WPXProperty const prop) +{ +WPXString str = prop.getStr(); +if (!str.len()) return 0.0; + +// we have a string, so we can not use getDouble +std::istringstream iss(str.cstr()); +double res = 0.0; +iss res; + +// try to guess the type +// point-pt, twip-*, inch - in +char c = str.len() ? str.cstr()[str.len()-1] : ' '; +if (c == '*') res /= 1440.; +else if (c == 't') res /= 72.; +else if (c == 'n') ; +else if (c == '%') +{ +