summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-03-16 20:57:51 +0100
committerTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-04-06 22:02:12 +0200
commit58f8e286e9a7411ab852d74b9cba9cd2b693f2e8 (patch)
treee37141865353c77db62729ae84c41ac9cc18e676 /svtools
parentc7b69624eec1329113630e308170346fce2be823 (diff)
Add HtmlWriterHelper to svtools.
Change-Id: I4d96402cc0fa86d83fe0ade314b84bff86d7db97
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/svhtml/htmlout.cxx26
1 files changed, 26 insertions, 0 deletions
diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx
index 00b7b52f9f50..1a675cf2f016 100644
--- a/svtools/source/svhtml/htmlout.cxx
+++ b/svtools/source/svhtml/htmlout.cxx
@@ -32,6 +32,8 @@
#include <svtools/imappoly.hxx>
#include "svl/urihelper.hxx"
+#include <sstream>
+
#define TXTCONV_BUFFER_SIZE 20
HTMLOutContext::HTMLOutContext( rtl_TextEncoding eDestEnc )
@@ -975,4 +977,28 @@ OString HTMLOutFuncs::CreateTableDataOptionsValNum(
return aStrTD.makeStringAndClear();
}
+void HtmlWriterHelper::applyColor(HtmlWriter& rHtmlWriter, OString aAttributeName, const Color& rColor)
+{
+ OStringBuffer sBuffer;
+
+ if( rColor.GetColor() == COL_AUTO )
+ {
+ sBuffer.append("#000000");
+ }
+ else
+ {
+ sBuffer.append('#');
+ std::ostringstream sStringStream;
+ sStringStream
+ << std::right
+ << std::setfill('0')
+ << std::setw(6)
+ << std::hex
+ << rColor.GetRGBColor();
+ sBuffer.append(sStringStream.str().c_str());
+ }
+
+ rHtmlWriter.attribute(aAttributeName, sBuffer.makeStringAndClear());
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */