sd/qa/unit/HtmlExportTest.cxx | 5 +++++ sd/source/filter/html/htmlex.cxx | 39 +++++++++++++++++++++++++++++++++------ sd/source/filter/html/htmlex.hxx | 4 ++++ sfx2/source/bastyp/frmhtmlw.cxx | 2 +- 4 files changed, 43 insertions(+), 7 deletions(-)
New commits: commit 4034a82d4515369d698c6c7e66d6d527412f81b9 Author: Jan Holesovsky <ke...@collabora.com> Date: Fri Jun 6 16:00:16 2014 +0200 sd html: Provide some minimal reasonable defaults. Change-Id: I72b02f7d87cf6075d318c1cc0d7288e27bbe1b9c diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx index b275206..8768186 100644 --- a/sd/source/filter/html/htmlex.cxx +++ b/sd/source/filter/html/htmlex.cxx @@ -372,6 +372,8 @@ HtmlExport::HtmlExport( mbSlideSound(true), mbHiddenSlides(true), mbUserAttr(false), + maTextColor(COL_BLACK), + maBackColor(COL_WHITE), mbDocColors(false), maHTMLExtension(SdResId(STR_HTMLEXP_DEFAULT_EXTENSION)), maIndexUrl("index"), commit e80d3eb182c9adefb48ad72d2c28e758c27e65ab Author: Jan Holesovsky <ke...@collabora.com> Date: Fri Jun 6 15:46:51 2014 +0200 sd html: Unit test for the metadata export. Change-Id: I1e38e28b57e816a0829d1a56f2ffcb32d8f93718 diff --git a/sd/qa/unit/HtmlExportTest.cxx b/sd/qa/unit/HtmlExportTest.cxx index 388417f..388dfef 100644 --- a/sd/qa/unit/HtmlExportTest.cxx +++ b/sd/qa/unit/HtmlExportTest.cxx @@ -42,6 +42,11 @@ public: assertXPath(htmlDoc, "/html/body/table/tr", 5); assertXPath(htmlDoc, "/html/body/ul", 1); assertXPath(htmlDoc, "/html/body/ul/li", 2); + + assertXPath(htmlDoc, "/html/head/meta[1]", "content", "text/html; charset=utf-8"); + assertXPath(htmlDoc, "/html/head/meta[2]", "name", "generator"); + assertXPath(htmlDoc, "/html/head/meta[3]", "name", "created"); + assertXPath(htmlDoc, "/html/head/meta[3]", "content", "20140409;170541987922038"); } CPPUNIT_TEST_SUITE(SdHTMLFilterTest); commit bb35a9f34cf56752fb9b762bcdd2aa72535d96f7 Author: Jan Holesovsky <ke...@collabora.com> Date: Fri Jun 6 15:46:16 2014 +0200 html export: Close the <meta> tags. Change-Id: Icca58dd1531f2442fe5878ed9524a3611c0601ea diff --git a/sfx2/source/bastyp/frmhtmlw.cxx b/sfx2/source/bastyp/frmhtmlw.cxx index 1ef646d..93567e2 100644 --- a/sfx2/source/bastyp/frmhtmlw.cxx +++ b/sfx2/source/bastyp/frmhtmlw.cxx @@ -76,7 +76,7 @@ void SfxFrameHTMLWriter::OutMeta( SvStream& rStrm, sOut.append("\" ").append(OOO_STRING_SVTOOLS_HTML_O_content).append("=\""); rStrm.WriteCharPtr( sOut.makeStringAndClear().getStr() ); - HTMLOutFuncs::Out_String( rStrm, rContent, eDestEnc, pNonConvertableChars ).WriteCharPtr( "\">" ); + HTMLOutFuncs::Out_String( rStrm, rContent, eDestEnc, pNonConvertableChars ).WriteCharPtr( "\"/>" ); } void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const OUString& rBaseURL, commit cf3af57cfe5631afd1473dc530f4fbe6e41f24e4 Author: Jan Holesovsky <ke...@collabora.com> Date: Fri Jun 6 15:29:28 2014 +0200 sd html: Implement export of metadata in the single document case. Change-Id: Icf99c9bcea187e2a3127b97050d6ddb072540b0d diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx index cdb18b2..b275206 100644 --- a/sd/source/filter/html/htmlex.cxx +++ b/sd/source/filter/html/htmlex.cxx @@ -17,8 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - #include "htmlex.hxx" +#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <com/sun/star/document/XExporter.hpp> #include <com/sun/star/document/XFilter.hpp> #include <com/sun/star/drawing/GraphicExportFilter.hpp> @@ -32,6 +32,11 @@ #include <unotools/ucbstreamhelper.hxx> #include <unotools/localfilehelper.hxx> #include <com/sun/star/frame/XStorable.hpp> +#include <sfx2/app.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/docfile.hxx> +#include <sfx2/fcontnr.hxx> +#include <sfx2/frmhtmlw.hxx> #include <sfx2/progress.hxx> #include <vcl/wrkwin.hxx> #include <svl/aeitem.hxx> @@ -40,13 +45,11 @@ #include <svtools/imapcirc.hxx> #include <svtools/imappoly.hxx> #include <vcl/msgbox.hxx> -#include <sfx2/app.hxx> #include <editeng/outlobj.hxx> #include <editeng/editobj.hxx> #include <svx/svdopath.hxx> #include <svx/xoutbmp.hxx> #include <svtools/htmlout.hxx> -#include <sfx2/docfile.hxx> #include <vcl/cvtgrf.hxx> #include <svtools/colorcfg.hxx> #include <vcl/graphicfilter.hxx> @@ -57,8 +60,6 @@ #include <editeng/postitem.hxx> #include <editeng/crossedoutitem.hxx> #include <editeng/flditem.hxx> -#include <sfx2/dispatch.hxx> -#include <sfx2/fcontnr.hxx> #include <svl/style.hxx> #include <editeng/frmdiritem.hxx> #include <svx/svdoutl.hxx> @@ -648,7 +649,8 @@ void HtmlExport::ExportSingleDocument() InitProgress(mnSdPageCount); OUStringBuffer aStr(maHTMLHeader); - aStr.append(CreateMetaCharset()); + aStr.append(DocumentMetadata()); + aStr.append("\r\n"); aStr.append("</head>\r\n"); aStr.append(CreateBodyTag()); @@ -1084,6 +1086,29 @@ OUString HtmlExport::CreateMetaCharset() const return aStr; } +OUString HtmlExport::DocumentMetadata() const +{ + SvMemoryStream aStream; + + uno::Reference<document::XDocumentProperties> xDocProps; + if (mpDocSh) + { + uno::Reference<document::XDocumentPropertiesSupplier> xDPS( + mpDocSh->GetModel(), uno::UNO_QUERY_THROW); + xDocProps.set(xDPS->getDocumentProperties()); + } + + OUString aNonConvertableCharacters; + + SfxFrameHTMLWriter::Out_DocInfo(aStream, maDocFileName, xDocProps, + " ", RTL_TEXTENCODING_UTF8, + &aNonConvertableCharacters); + + OString aData(reinterpret_cast<const char*>(aStream.GetData()), aStream.GetSize()); + + return OStringToOUString(aData, RTL_TEXTENCODING_UTF8); +} + bool HtmlExport::CreateHtmlTextForPresPages() { bool bOk = true; diff --git a/sd/source/filter/html/htmlex.hxx b/sd/source/filter/html/htmlex.hxx index cdf84cc..19709dc 100644 --- a/sd/source/filter/html/htmlex.hxx +++ b/sd/source/filter/html/htmlex.hxx @@ -202,8 +202,12 @@ class HtmlExport void InitProgress( sal_uInt16 nProgrCount ); void ResetProgress(); + /// Output only the charset metadata, title etc. will be handled separately. OUString CreateMetaCharset() const; + /// Output document metadata. + OUString DocumentMetadata() const; + void InitExportParameters( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rParams); void ExportHtml(); void ExportKiosk(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits