Commit e0682ee8 authored by konovalovsergey's avatar konovalovsergey

for Bug 32706 - Замена темы одной из таблиц и повреждение книги, по мнению MS...

for Bug 32706 - Замена темы одной из таблиц и повреждение книги, по мнению MS Excel, при экспорте в XLSX сразу же после открытия
parent b669aac8
......@@ -34,6 +34,7 @@
#define PPTX_LOGIC_SRGBCLR_INCLUDE_H_
#include "ColorBase.h"
#include <math.h>
namespace PPTX
{
......@@ -55,8 +56,19 @@ namespace PPTX
Modifiers.clear();
node.LoadArray(_T("*"), Modifiers);
}
virtual void fromXMLScRgb(XmlUtils::CXmlNode& node)
{
int cred = node.GetAttributeInt(CString(L"r"), 0);
int cgreen = node.GetAttributeInt(CString(L"g"), 0);
int cblue = node.GetAttributeInt(CString(L"g"), 0);
red = (unsigned char)(255 * scRGB_to_sRGB(cred / 100000.0));
green = (unsigned char)(255 * scRGB_to_sRGB(cgreen / 100000.0));
blue = (unsigned char)(255 * scRGB_to_sRGB(cblue / 100000.0));
Modifiers.clear();
node.LoadArray(_T("*"), Modifiers);
}
virtual CString toXML() const
{
CString str = _T("");
......@@ -124,6 +136,16 @@ namespace PPTX
pWriter->EndRecord();
}
double scRGB_to_sRGB(double value)
{
if( value < 0)
return 0;
if(value <= 0.0031308)
return value * 12.92;
if(value < 1)
return 1.055 * (pow(value , (1 / 2.4))) - 0.055;
return 1;
}
protected:
virtual void FillParentPointersForChilds(){};
......
/*
/*
* (c) Copyright Ascensio System SIA 2010-2016
*
* This program is a free software product. You can redistribute it and/or
......@@ -72,6 +72,12 @@ namespace PPTX
if (name == _T("a:srgbClr"))
Color.reset(new Logic::SrgbClr(node));
else if (name == _T("a:scrgbClr"))
{
Logic::SrgbClr* pSrgbClr = new Logic::SrgbClr(node);
pSrgbClr->fromXMLScRgb(node);
Color.reset(pSrgbClr);
}
else if (name == _T("a:prstClr"))
Color.reset(new Logic::PrstClr(node));
else if (name == _T("a:schemeClr"))
......
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