summaryrefslogtreecommitdiff
path: root/tools/source/generic/color.cxx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-05-12 12:29:20 +0200
committerTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-05-15 19:51:06 +0200
commit599328b0a9f50f65d8ad1efea8b72ac604153c56 (patch)
treea3a8192e2c03a0c3c7d44708ff1fe7b3f429b97e /tools/source/generic/color.cxx
parent1c77fcacbd07b077412048a0647271fad16ff461 (diff)
tools: add AsRGBHexString to Color + unit test
AsRGBHexString returns the Color as a RGB hex string. For example "00ff00" for green color. Change-Id: Ia95c7f9eb6d9aefc3ca989046fa8d76b7b7f9e8f
Diffstat (limited to 'tools/source/generic/color.cxx')
-rw-r--r--tools/source/generic/color.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/source/generic/color.cxx b/tools/source/generic/color.cxx
index 909a4e82470f..64cc6c44e3fa 100644
--- a/tools/source/generic/color.cxx
+++ b/tools/source/generic/color.cxx
@@ -232,6 +232,13 @@ SvStream& Color::Write( SvStream& rOStm, bool bNewFormat )
return rOStm;
}
+OUString Color::AsRGBHexString()
+{
+ std::stringstream ss;
+ ss << std::hex << std::setfill ('0') << std::setw(6) << GetRGBColor();
+ return OUString::createFromAscii(ss.str().c_str());
+}
+
#define COL_NAME_USER ((sal_uInt16)0x8000)
SvStream& ReadColor( SvStream& rIStream, Color& rColor )