Kaydet (Commit) 58f8e286 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

Add HtmlWriterHelper to svtools.

Change-Id: I4d96402cc0fa86d83fe0ade314b84bff86d7db97
üst c7b69624
......@@ -26,6 +26,8 @@
#include <rtl/string.hxx>
#include <svl/macitem.hxx>
#include "HtmlWriter.hxx"
class Color;
class ImageMap;
class SvStream;
......@@ -104,6 +106,11 @@ struct HTMLOutFuncs
OUString *pNonConvertableChars = 0);
};
struct HtmlWriterHelper
{
SVT_DLLPUBLIC static void applyColor( HtmlWriter& rHtmlWriter, OString aAttributeName, const Color& rColor);
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -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: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment