From 1380f5d5425b0860ed7aa9d1a876fed76449ffbd Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Fri, 6 Jun 2014 15:29:28 +0200 Subject: sd html: Implement export of metadata in the single document case. Change-Id: Icf99c9bcea187e2a3127b97050d6ddb072540b0d --- sd/source/filter/html/htmlex.cxx | 37 +++++++++++++++++++++++++++++++------ sd/source/filter/html/htmlex.hxx | 4 ++++ 2 files changed, 35 insertions(+), 6 deletions(-) (limited to 'sd') diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx index cdb18b26ed2e..b2752069db88 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 #include #include #include @@ -32,6 +32,11 @@ #include #include #include +#include +#include +#include +#include +#include #include #include #include @@ -40,13 +45,11 @@ #include #include #include -#include #include #include #include #include #include -#include #include #include #include @@ -57,8 +60,6 @@ #include #include #include -#include -#include #include #include #include @@ -648,7 +649,8 @@ void HtmlExport::ExportSingleDocument() InitProgress(mnSdPageCount); OUStringBuffer aStr(maHTMLHeader); - aStr.append(CreateMetaCharset()); + aStr.append(DocumentMetadata()); + aStr.append("\r\n"); aStr.append("\r\n"); aStr.append(CreateBodyTag()); @@ -1084,6 +1086,29 @@ OUString HtmlExport::CreateMetaCharset() const return aStr; } +OUString HtmlExport::DocumentMetadata() const +{ + SvMemoryStream aStream; + + uno::Reference xDocProps; + if (mpDocSh) + { + uno::Reference 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(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 cdf84ccc32bb..19709dc9a955 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(); -- cgit