[Libreoffice-commits] core.git: writerperfect/source
Miklos Vajna
vmiklos at collabora.co.uk
Wed Aug 9 07:11:32 UTC 2017
writerperfect/source/writer/EPUBPackage.cxx | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
New commits:
commit 758b33f4d5eaa2e81afcb27b61847864a178a597
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Aug 8 17:10:21 2017 +0200
EPUB export: write CSS rules
With this, a hello world writer document is handled correctly.
Change-Id: Ib1efea5aa5ea5049beee719f14f85b41c56d1967
Reviewed-on: https://gerrit.libreoffice.org/40890
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/writerperfect/source/writer/EPUBPackage.cxx b/writerperfect/source/writer/EPUBPackage.cxx
index 520fece6d9ca..d3b51d4848da 100644
--- a/writerperfect/source/writer/EPUBPackage.cxx
+++ b/writerperfect/source/writer/EPUBPackage.cxx
@@ -11,6 +11,7 @@
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
#include <com/sun/star/xml/sax/Writer.hpp>
#include <comphelper/storagehelper.hxx>
@@ -105,9 +106,27 @@ void EPUBPackage::openCSSFile(const char *pName)
mxOutputStream.set(mxStorage->openStreamElementByHierarchicalName(OUString::fromUtf8(pName), embed::ElementModes::READWRITE), uno::UNO_QUERY);
}
-void EPUBPackage::insertRule(const librevenge::RVNGString &/*rSelector*/, const librevenge::RVNGPropertyList &/*rProperties*/)
+void EPUBPackage::insertRule(const librevenge::RVNGString &rSelector, const librevenge::RVNGPropertyList &rProperties)
{
- SAL_WARN("writerperfect", "EPUBPackage::insertRule: implement me");
+ assert(mxOutputStream.is());
+
+ uno::Reference<io::XSeekable> xSeekable(mxOutputStream, uno::UNO_QUERY);
+ std::stringstream aStream;
+ if (xSeekable->getPosition() != 0)
+ aStream << '\n';
+ aStream << rSelector.cstr() << " {\n";
+
+ librevenge::RVNGPropertyList::Iter it(rProperties);
+ for (it.rewind(); it.next();)
+ {
+ if (it())
+ aStream << " " << it.key() << ": " << it()->getStr().cstr() << ";\n";
+ }
+
+ aStream << "}\n";
+ std::string aString = aStream.str();
+ uno::Sequence<sal_Int8> aData(reinterpret_cast<const sal_Int8*>(aString.c_str()), aString.size());
+ mxOutputStream->writeBytes(aData);
}
void EPUBPackage::closeCSSFile()
More information about the Libreoffice-commits
mailing list