summaryrefslogtreecommitdiff
path: root/writerfilter/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-02-20 10:55:31 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-02-20 12:55:47 +0100
commit7ca8a6c8b17ffb4727af2df295b82d33227bdcde (patch)
tree1399af3b9cc051e587a0f4d71086626268601f43 /writerfilter/source
parent7b8a0b7c0dcf8380a6bd2d458d0e20ffc6a5d355 (diff)
create uno::Any overrides for Color
And use less ColorData in writerfilter and xmloff. part of removing ColorData. Change-Id: Ia1c57bf837ae814e7642cf1c7de2eb7ada7a1500 Reviewed-on: https://gerrit.libreoffice.org/50028 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'writerfilter/source')
-rw-r--r--writerfilter/source/rtftok/rtfdispatchvalue.cxx16
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx2
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.hxx8
3 files changed, 14 insertions, 12 deletions
diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
index 259b896cdcc3..2ea3c547b10e 100644
--- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
@@ -417,7 +417,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
case RTF_CF:
{
RTFSprms aAttributes;
- auto pValue = std::make_shared<RTFValue>(getColorTable(nParam));
+ auto pValue = std::make_shared<RTFValue>(sal_uInt32(getColorTable(nParam)));
aAttributes.set(NS_ooxml::LN_CT_Color_val, pValue);
m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_color,
std::make_shared<RTFValue>(aAttributes));
@@ -505,7 +505,8 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
break;
case RTF_CHCBPAT:
{
- auto pValue = std::make_shared<RTFValue>(nParam ? getColorTable(nParam) : COL_AUTO);
+ auto pValue
+ = std::make_shared<RTFValue>(nParam ? sal_uInt32(getColorTable(nParam)) : COL_AUTO);
putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_EG_RPrBase_shd,
NS_ooxml::LN_CT_Shd_fill, pValue);
}
@@ -513,7 +514,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
case RTF_CLCBPAT:
case RTF_CLCBPATRAW:
{
- auto pValue = std::make_shared<RTFValue>(getColorTable(nParam));
+ auto pValue = std::make_shared<RTFValue>(sal_uInt32(getColorTable(nParam)));
putNestedAttribute(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_shd,
NS_ooxml::LN_CT_Shd_fill, pValue);
}
@@ -521,20 +522,21 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
case RTF_CBPAT:
if (nParam)
{
- auto pValue = std::make_shared<RTFValue>(getColorTable(nParam));
+ auto pValue = std::make_shared<RTFValue>(sal_uInt32(getColorTable(nParam)));
putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PrBase_shd,
NS_ooxml::LN_CT_Shd_fill, pValue);
}
break;
case RTF_ULC:
{
- auto pValue = std::make_shared<RTFValue>(getColorTable(nParam));
+ auto pValue = std::make_shared<RTFValue>(sal_uInt32(getColorTable(nParam)));
m_aStates.top().aCharacterSprms.set(0x6877, pValue);
}
break;
case RTF_HIGHLIGHT:
{
- auto pValue = std::make_shared<RTFValue>(nParam ? getColorTable(nParam) : COL_AUTO);
+ auto pValue
+ = std::make_shared<RTFValue>(nParam ? sal_uInt32(getColorTable(nParam)) : COL_AUTO);
m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_highlight, pValue);
}
break;
@@ -626,7 +628,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
break;
case RTF_BRDRCF:
{
- auto pValue = std::make_shared<RTFValue>(getColorTable(nParam));
+ auto pValue = std::make_shared<RTFValue>(sal_uInt32(getColorTable(nParam)));
putBorderProperty(m_aStates, NS_ooxml::LN_CT_Border_color, pValue);
}
break;
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index d1f09ec42564..44b671de27bc 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -646,7 +646,7 @@ void RTFDocumentImpl::sectBreak(bool bFinal)
m_bNeedSect = false;
}
-sal_uInt32 RTFDocumentImpl::getColorTable(sal_uInt32 nIndex)
+Color RTFDocumentImpl::getColorTable(sal_uInt32 nIndex)
{
if (!m_pSuperstream)
{
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 38fbad18a1c8..71e7657036f8 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -22,7 +22,7 @@
#include <oox/mathml/importutils.hxx>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
-#include <tools/colordata.hxx>
+#include <tools/color.hxx>
#include <rtftok/RTFDocument.hxx>
#include "rtfreferencetable.hxx"
@@ -143,7 +143,7 @@ public:
m_bAuto = false;
m_nB = nBlue;
}
- ColorData GetColor() const { return m_bAuto ? COL_AUTO : RGB_COLORDATA(m_nR, m_nG, m_nB); }
+ Color GetColor() const { return m_bAuto ? COL_AUTO : Color(m_nR, m_nG, m_nB); }
private:
bool m_bAuto = true;
@@ -472,7 +472,7 @@ public:
private:
SvStream& Strm();
- sal_uInt32 getColorTable(sal_uInt32 nIndex);
+ Color getColorTable(sal_uInt32 nIndex);
writerfilter::Reference<Properties>::Pointer_t createStyleProperties();
void resetSprms();
void resetAttributes();
@@ -539,7 +539,7 @@ private:
/// Maps style indexes to style types.
std::map<int, Id> m_aStyleTypes;
/// Color index <-> RGB color value map
- std::vector<sal_uInt32> m_aColorTable;
+ std::vector<Color> m_aColorTable;
bool m_bFirstRun;
/// If paragraph properties should be emitted on next run.
bool m_bNeedPap;