mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
add bg
This commit is contained in:
@ -259,7 +259,7 @@ namespace SimpleTypes
|
|||||||
CPanose();
|
CPanose();
|
||||||
|
|
||||||
std::wstring GetValue() const;
|
std::wstring GetValue() const;
|
||||||
void SetValue(std::wstring &sValue);
|
void SetValue(std::wstring &sValue);
|
||||||
|
|
||||||
std::wstring FromString(const std::wstring &sValue);
|
std::wstring FromString(const std::wstring &sValue);
|
||||||
std::wstring ToString () const;
|
std::wstring ToString () const;
|
||||||
@ -398,7 +398,6 @@ namespace SimpleTypes
|
|||||||
void SetRGB();
|
void SetRGB();
|
||||||
void ByColorName(const std::wstring& sValue);
|
void ByColorName(const std::wstring& sValue);
|
||||||
|
|
||||||
private:
|
|
||||||
std::wstring m_sValue;
|
std::wstring m_sValue;
|
||||||
|
|
||||||
unsigned char m_unR;
|
unsigned char m_unR;
|
||||||
|
|||||||
@ -1530,7 +1530,7 @@ namespace SimpleTypes
|
|||||||
SimpleTypes_DefaultString(CVml_Vector2D_Percentage)
|
SimpleTypes_DefaultString(CVml_Vector2D_Percentage)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double m_dX; //
|
double m_dX; //
|
||||||
double m_dY; //
|
double m_dY; //
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1698,12 +1698,11 @@ namespace SimpleTypes
|
|||||||
void SetPercentage(double dValue);
|
void SetPercentage(double dValue);
|
||||||
|
|
||||||
virtual double FromString(const std::wstring &sValue);
|
virtual double FromString(const std::wstring &sValue);
|
||||||
virtual std::wstring ToString () const;
|
virtual std::wstring ToString() const;
|
||||||
|
|
||||||
SimpleTypes_DefaultD(CVml_1_65536_Or_Percentage)
|
SimpleTypes_DefaultD(CVml_1_65536_Or_Percentage)
|
||||||
|
|
||||||
private:
|
double m_dValue;
|
||||||
double m_dValue;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -639,7 +639,7 @@ namespace SimpleTypes
|
|||||||
CFFName();
|
CFFName();
|
||||||
|
|
||||||
std::wstring GetValue() const;
|
std::wstring GetValue() const;
|
||||||
void SetValue(std::wstring &sValue);
|
void SetValue(std::wstring &sValue);
|
||||||
|
|
||||||
std::wstring FromString(const std::wstring &sValue);
|
std::wstring FromString(const std::wstring &sValue);
|
||||||
std::wstring ToString () const;
|
std::wstring ToString () const;
|
||||||
@ -894,7 +894,6 @@ namespace SimpleTypes
|
|||||||
void Parse3();
|
void Parse3();
|
||||||
int HexToInt(int nHex);
|
int HexToInt(int nHex);
|
||||||
|
|
||||||
private:
|
|
||||||
std::wstring m_sValue;
|
std::wstring m_sValue;
|
||||||
|
|
||||||
unsigned char m_unR = 0;
|
unsigned char m_unR = 0;
|
||||||
|
|||||||
@ -2022,9 +2022,6 @@ namespace OOX
|
|||||||
}
|
}
|
||||||
void CFill::ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
|
void CFill::ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
|
||||||
{
|
{
|
||||||
std::wstring sColors;
|
|
||||||
|
|
||||||
// Читаем атрибуты
|
|
||||||
if ( oReader.GetAttributesCount() <= 0 )
|
if ( oReader.GetAttributesCount() <= 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -2046,7 +2043,7 @@ namespace OOX
|
|||||||
case 'c':
|
case 'c':
|
||||||
if (L"color" == wsName ) m_oColor = oReader.GetText();
|
if (L"color" == wsName ) m_oColor = oReader.GetText();
|
||||||
else if (L"color2" == wsName ) m_oColor2 = oReader.GetText();
|
else if (L"color2" == wsName ) m_oColor2 = oReader.GetText();
|
||||||
else if (L"colors" == wsName ) sColors = oReader.GetText();
|
else if (L"colors" == wsName ) m_oColors = oReader.GetText();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'i':
|
case 'i':
|
||||||
@ -2102,8 +2099,6 @@ namespace OOX
|
|||||||
wsName = oReader.GetName();
|
wsName = oReader.GetName();
|
||||||
}
|
}
|
||||||
oReader.MoveToElement();
|
oReader.MoveToElement();
|
||||||
|
|
||||||
// TO DO: сделать парсер цветов CFill::m_arrColors
|
|
||||||
}
|
}
|
||||||
std::wstring CFill::toXML() const
|
std::wstring CFill::toXML() const
|
||||||
{
|
{
|
||||||
@ -2119,18 +2114,19 @@ namespace OOX
|
|||||||
sResult += L"opacity=\"" + m_oOpacity->ToString() + L"\" ";
|
sResult += L"opacity=\"" + m_oOpacity->ToString() + L"\" ";
|
||||||
|
|
||||||
ComplexTypes_WriteAttribute (L"color=\"", m_oColor);
|
ComplexTypes_WriteAttribute (L"color=\"", m_oColor);
|
||||||
ComplexTypes_WriteAttribute (L"color2=\"", m_oColor2);
|
ComplexTypes_WriteAttribute (L"color2=\"", m_oColor2);
|
||||||
ComplexTypes_WriteAttribute3(L"src=\"", m_sSrc );
|
ComplexTypes_WriteAttribute3(L"src=\"", m_sSrc );
|
||||||
ComplexTypes_WriteAttribute3(L"o:href=\"", m_sHref );
|
ComplexTypes_WriteAttribute3(L"o:href=\"", m_sHref );
|
||||||
ComplexTypes_WriteAttribute3(L"o:althref=\"", m_sAltHref );
|
ComplexTypes_WriteAttribute3(L"o:althref=\"", m_sAltHref );
|
||||||
ComplexTypes_WriteAttribute (L"size=\"", m_oSize );
|
ComplexTypes_WriteAttribute (L"size=\"", m_oSize );
|
||||||
ComplexTypes_WriteAttribute (L"origin=\"", m_oOrigin );
|
ComplexTypes_WriteAttribute (L"origin=\"", m_oOrigin );
|
||||||
ComplexTypes_WriteAttribute (L"position=\"", m_oPosition );
|
ComplexTypes_WriteAttribute (L"position=\"", m_oPosition );
|
||||||
|
|
||||||
if ((m_oAspect.IsInit()) && (SimpleTypes::imageaspectIgnore != m_oAspect->GetValue() ))
|
if ((m_oAspect.IsInit()) && (SimpleTypes::imageaspectIgnore != m_oAspect->GetValue() ))
|
||||||
sResult += L"aspect=\"" + m_oAspect->ToString() + L"\" ";
|
sResult += L"aspect=\"" + m_oAspect->ToString() + L"\" ";
|
||||||
|
|
||||||
// TO DO: Сделать запись m_arrColors
|
if (m_oColors.IsInit())
|
||||||
|
sResult += L"colors=\"" + *m_oColors + L"\" ";
|
||||||
|
|
||||||
ComplexTypes_WriteAttribute (L"angle=\"", m_oAngle );
|
ComplexTypes_WriteAttribute (L"angle=\"", m_oAngle );
|
||||||
|
|
||||||
@ -2150,7 +2146,7 @@ namespace OOX
|
|||||||
sResult += L"method=\"" + m_oMethod->ToString() + L"\" ";
|
sResult += L"method=\"" + m_oMethod->ToString() + L"\" ";
|
||||||
|
|
||||||
ComplexTypes_WriteAttribute (L"o:detectmouseclick=\"", m_oDetectMouseClick );
|
ComplexTypes_WriteAttribute (L"o:detectmouseclick=\"", m_oDetectMouseClick );
|
||||||
ComplexTypes_WriteAttribute3(L"o:title=\"", m_sTitle );
|
ComplexTypes_WriteAttribute3(L"o:title=\"", m_sTitle );
|
||||||
|
|
||||||
if ( m_oOpacity2.IsInit() )
|
if ( m_oOpacity2.IsInit() )
|
||||||
sResult += L"o:opacity2=\"" + m_oOpacity2->ToString() + L"\" ";
|
sResult += L"o:opacity2=\"" + m_oOpacity2->ToString() + L"\" ";
|
||||||
@ -2161,7 +2157,7 @@ namespace OOX
|
|||||||
if (( m_oRotate.IsInit()) && m_oRotate->GetBool())
|
if (( m_oRotate.IsInit()) && m_oRotate->GetBool())
|
||||||
sResult += L"rotate=\"true\" ";
|
sResult += L"rotate=\"true\" ";
|
||||||
|
|
||||||
ComplexTypes_WriteAttribute (L"r:id=\"", m_rId );
|
ComplexTypes_WriteAttribute (L"r:id=\"", m_rId );
|
||||||
ComplexTypes_WriteAttribute (L"o:relid=\"", m_oRelId );
|
ComplexTypes_WriteAttribute (L"o:relid=\"", m_oRelId );
|
||||||
|
|
||||||
sResult += L">";
|
sResult += L">";
|
||||||
|
|||||||
@ -254,7 +254,8 @@ namespace OOX
|
|||||||
nullable<SimpleTypes::CImageAspect> m_oAspect;
|
nullable<SimpleTypes::CImageAspect> m_oAspect;
|
||||||
nullable<SimpleTypes::CColorType> m_oColor;
|
nullable<SimpleTypes::CColorType> m_oColor;
|
||||||
nullable<SimpleTypes::CColorType> m_oColor2;
|
nullable<SimpleTypes::CColorType> m_oColor2;
|
||||||
std::vector<TIntermediateColor*> m_arrColors;
|
nullable_string m_oColors;
|
||||||
|
std::vector<TIntermediateColor*> m_arrColors; // parsing m_oColors - todooo
|
||||||
nullable<SimpleTypes::CTrueFalse> m_oDetectMouseClick;
|
nullable<SimpleTypes::CTrueFalse> m_oDetectMouseClick;
|
||||||
nullable<SimpleTypes::CFixedPercentage > m_oFocus;
|
nullable<SimpleTypes::CFixedPercentage > m_oFocus;
|
||||||
nullable<SimpleTypes::Vml::CVml_Vector2D_Percentage> m_oFocusPosition;
|
nullable<SimpleTypes::Vml::CVml_Vector2D_Percentage> m_oFocusPosition;
|
||||||
|
|||||||
@ -45,6 +45,7 @@
|
|||||||
#include "../../PPTXFormat/Logic/Colors/SchemeClr.h"
|
#include "../../PPTXFormat/Logic/Colors/SchemeClr.h"
|
||||||
#include "../../PPTXFormat/Logic/Colors/SysClr.h"
|
#include "../../PPTXFormat/Logic/Colors/SysClr.h"
|
||||||
#include "../../PPTXFormat/Logic/Effects/AlphaModFix.h"
|
#include "../../PPTXFormat/Logic/Effects/AlphaModFix.h"
|
||||||
|
#include "../../PPTXFormat/Logic/Effects/Duotone.h"
|
||||||
#include "../../PPTXFormat/PPTX.h"
|
#include "../../PPTXFormat/PPTX.h"
|
||||||
#include "../../PPTXFormat/LegacyDiagramText.h"
|
#include "../../PPTXFormat/LegacyDiagramText.h"
|
||||||
|
|
||||||
@ -3085,7 +3086,7 @@ void CDrawingConverter::ConvertWordArtShape(PPTX::Logic::SpTreeElem* elem, XmlUt
|
|||||||
std::vector<PPTX::Logic::UniColor*> arColorsNew;
|
std::vector<PPTX::Logic::UniColor*> arColorsNew;
|
||||||
std::vector<int> arPos;
|
std::vector<int> arPos;
|
||||||
std::vector<int> arPosNew;
|
std::vector<int> arPosNew;
|
||||||
std::map<PPTX::Logic::UniColor*, int> arGradMap;
|
std::map<int, PPTX::Logic::UniColor*> arGradMap;
|
||||||
|
|
||||||
int R = 255, G = 255, B = 255;
|
int R = 255, G = 255, B = 255;
|
||||||
|
|
||||||
@ -3224,13 +3225,13 @@ void CDrawingConverter::ConvertWordArtShape(PPTX::Logic::SpTreeElem* elem, XmlUt
|
|||||||
XmlMacroReadAttributeBase(oNodeP, L"angle", sAngle);
|
XmlMacroReadAttributeBase(oNodeP, L"angle", sAngle);
|
||||||
XmlMacroReadAttributeBase(oNodeP, L"colors", sColors);
|
XmlMacroReadAttributeBase(oNodeP, L"colors", sColors);
|
||||||
|
|
||||||
if (sType.is_init())
|
if (sType.is_init())
|
||||||
{
|
{
|
||||||
if (*sType == L"gradient") eFillType = etGradFill;
|
if (*sType == L"gradient") eFillType = etGradFill;
|
||||||
else if (*sType == L"gradientradial") eFillType = etGradFill;
|
else if (*sType == L"gradientradial") eFillType = etGradFill;
|
||||||
else if (*sType == L"pattern") eFillType = etPattFill;
|
else if (*sType == L"pattern") eFillType = etPattFill;
|
||||||
else if (*sType == L"tile") eFillType = etBlipFill;
|
else if (*sType == L"tile") eFillType = etBlipFill;
|
||||||
else if (*sType == L"frame") eFillType = etBlipFill;
|
else if (*sType == L"frame") eFillType = etBlipFill;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3366,7 +3367,9 @@ void CDrawingConverter::ConvertWordArtShape(PPTX::Logic::SpTreeElem* elem, XmlUt
|
|||||||
|
|
||||||
for (size_t i = 0; i < arSplit.size(); i++)
|
for (size_t i = 0; i < arSplit.size(); i++)
|
||||||
{
|
{
|
||||||
int p = (int)arSplit[i].find(L" ");
|
size_t p = arSplit[i].find(L" ");
|
||||||
|
if (p == std::wstring::npos)
|
||||||
|
continue;
|
||||||
|
|
||||||
std::wstring strPos = arSplit[i].substr(0, p);
|
std::wstring strPos = arSplit[i].substr(0, p);
|
||||||
std::wstring strColor = arSplit[i].substr(p + 1);
|
std::wstring strColor = arSplit[i].substr(p + 1);
|
||||||
@ -3387,7 +3390,7 @@ void CDrawingConverter::ConvertWordArtShape(PPTX::Logic::SpTreeElem* elem, XmlUt
|
|||||||
arColors.push_back(oColor);
|
arColors.push_back(oColor);
|
||||||
arPos.push_back((int)pos);
|
arPos.push_back((int)pos);
|
||||||
|
|
||||||
arGradMap.insert(std::pair<PPTX::Logic::UniColor*, int>(oColor, (int)pos));
|
arGradMap.insert(std::make_pair((int)pos, oColor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4871,7 +4874,49 @@ void CDrawingConverter::CheckBorderShape(PPTX::Logic::SpTreeElem* oElem, XmlUtil
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void CDrawingConverter::ConvertColor(PPTX::Logic::UniColor & uniColor, nullable_string & sColor, nullable_string& sOpacity)
|
||||||
|
{
|
||||||
|
int R = 255;
|
||||||
|
int G = 255;
|
||||||
|
int B = 255;
|
||||||
|
|
||||||
|
uniColor.Color = new PPTX::Logic::SrgbClr();
|
||||||
|
if (sColor.is_init())
|
||||||
|
{
|
||||||
|
ODRAW::CColor color;
|
||||||
|
if (sColor.is_init() && (std::wstring::npos != sColor->find(L"fill")))
|
||||||
|
{
|
||||||
|
std::wstring sColorEffect = *sColor;
|
||||||
|
if (sColorEffect.length() > 5)
|
||||||
|
sColorEffect = sColorEffect.substr(5);
|
||||||
|
|
||||||
|
int resR, resG, resB;
|
||||||
|
GetColorWithEffect(sColorEffect, R, G, B, resR, resG, resB);
|
||||||
|
|
||||||
|
uniColor.Color->SetRGB(resR, resG, resB);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (NS_DWC_Common::getColorFromString(*sColor, color))
|
||||||
|
{
|
||||||
|
R = color.R;
|
||||||
|
G = color.G;
|
||||||
|
B = color.B;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
uniColor.Color->SetRGB(R, G, B);
|
||||||
|
if (sOpacity.is_init())
|
||||||
|
{
|
||||||
|
BYTE lAlpha = NS_DWC_Common::getOpacityFromString(*sOpacity);
|
||||||
|
|
||||||
|
PPTX::Logic::ColorModifier oMod;
|
||||||
|
oMod.name = L"alpha";
|
||||||
|
int nA = (int)(lAlpha * 100000.0 / 255.0);
|
||||||
|
oMod.val = nA;
|
||||||
|
uniColor.Color->Modifiers.push_back(oMod);
|
||||||
|
}
|
||||||
|
}
|
||||||
void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils::CXmlNode& oNode, CPPTShape* pPPTShape)
|
void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils::CXmlNode& oNode, CPPTShape* pPPTShape)
|
||||||
{
|
{
|
||||||
if (!oElem) return;
|
if (!oElem) return;
|
||||||
@ -4960,30 +5005,42 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
|
|||||||
XmlUtils::CXmlNode oNodeFill = oNode.ReadNode(L"v:fill");
|
XmlUtils::CXmlNode oNodeFill = oNode.ReadNode(L"v:fill");
|
||||||
if (oNodeFill.IsValid() && !pPPTShape->IsWordArt())
|
if (oNodeFill.IsValid() && !pPPTShape->IsWordArt())
|
||||||
{
|
{
|
||||||
nullable_string sType;
|
nullable_string sOpacity;
|
||||||
XmlMacroReadAttributeBase(oNodeFill, L"type", sType);
|
nullable_string sOpacity2;
|
||||||
|
nullable_string sColor2;
|
||||||
sOpacity.reset();
|
|
||||||
XmlMacroReadAttributeBase(oNodeFill, L"opacity", sOpacity);
|
|
||||||
|
|
||||||
nullable_string sColor;
|
nullable_string sColor;
|
||||||
XmlMacroReadAttributeBase(oNodeFill, L"color", sColor);
|
nullable_string sType;
|
||||||
|
nullable_string sFocus;
|
||||||
|
nullable_string sFocusSize;
|
||||||
|
nullable<SimpleTypes::Vml::CVml_Vector2D_Percentage> oFocusPosition;
|
||||||
|
nullable_string sAngle;
|
||||||
|
nullable_string sColors;
|
||||||
|
nullable_string sRotate;
|
||||||
|
|
||||||
|
XmlMacroReadAttributeBase(oNodeFill, L"rotate", sRotate);
|
||||||
|
XmlMacroReadAttributeBase(oNodeFill, L"opacity", sOpacity);
|
||||||
|
XmlMacroReadAttributeBase(oNodeFill, L"opacity2", sOpacity2);
|
||||||
|
XmlMacroReadAttributeBase(oNodeFill, L"color", sColor);
|
||||||
|
XmlMacroReadAttributeBase(oNodeFill, L"color2", sColor2);
|
||||||
|
XmlMacroReadAttributeBase(oNodeFill, L"type", sType);
|
||||||
|
XmlMacroReadAttributeBase(oNodeFill, L"focus", sFocus);
|
||||||
|
XmlMacroReadAttributeBase(oNodeFill, L"focussize", sFocusSize);
|
||||||
|
XmlMacroReadAttributeBase(oNodeFill, L"angle", sAngle);
|
||||||
|
XmlMacroReadAttributeBase(oNodeFill, L"colors", sColors);
|
||||||
|
XmlMacroReadAttributeBase(oNodeFill, L"focusposition", oFocusPosition);
|
||||||
|
|
||||||
if (sColor.is_init())
|
if (sColor.is_init())
|
||||||
{
|
{
|
||||||
ODRAW::CColor color;
|
PPTX::Logic::SolidFill* pSolid = new PPTX::Logic::SolidFill();
|
||||||
if (NS_DWC_Common::getColorFromString(*sColor, color))
|
pSolid->m_namespace = L"a";
|
||||||
{
|
|
||||||
PPTX::Logic::SolidFill* pSolid = new PPTX::Logic::SolidFill();
|
|
||||||
pSolid->m_namespace = L"a";
|
|
||||||
pSolid->Color.Color = new PPTX::Logic::SrgbClr();
|
|
||||||
pSolid->Color.Color->SetRGB(color.R, color.G, color.B);
|
|
||||||
|
|
||||||
pSpPr->Fill.m_type = PPTX::Logic::UniFill::solidFill;
|
ConvertColor(pSolid->Color, sColor, sOpacity);
|
||||||
pSpPr->Fill.Fill = pSolid;
|
|
||||||
|
|
||||||
if (!sFillColor.is_init())
|
pSpPr->Fill.m_type = PPTX::Logic::UniFill::solidFill;
|
||||||
sFillColor = sColor;
|
pSpPr->Fill.Fill = pSolid;
|
||||||
}
|
|
||||||
|
if (!sFillColor.is_init())
|
||||||
|
sFillColor = sColor;
|
||||||
}
|
}
|
||||||
if (!sColor.is_init()) sColor = sFillColor;
|
if (!sColor.is_init()) sColor = sFillColor;
|
||||||
|
|
||||||
@ -5013,100 +5070,84 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
|
|||||||
|
|
||||||
if (sType.is_init() && ((*sType == L"tile") || (*sType == L"pattern")))
|
if (sType.is_init() && ((*sType == L"tile") || (*sType == L"pattern")))
|
||||||
{
|
{
|
||||||
pBlipFill->tile = new PPTX::Logic::Tile();
|
pBlipFill->tile = new PPTX::Logic::Tile();
|
||||||
|
|
||||||
|
if (*sType == L"pattern")
|
||||||
|
{
|
||||||
|
PPTX::Logic::Duotone* pDuotone = new PPTX::Logic::Duotone();
|
||||||
|
|
||||||
|
PPTX::Logic::UniColor fgClr;
|
||||||
|
ConvertColor(fgClr, sColor, sOpacity);
|
||||||
|
pDuotone->Colors.push_back(fgClr);
|
||||||
|
|
||||||
|
PPTX::Logic::UniColor bgClr;
|
||||||
|
ConvertColor(bgClr, sColor2, sOpacity2);
|
||||||
|
pDuotone->Colors.push_back(bgClr);
|
||||||
|
|
||||||
|
PPTX::Logic::UniEffect effect;
|
||||||
|
effect.InitPointer(pDuotone);
|
||||||
|
pBlipFill->blip->Effects.push_back(effect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pBlipFill->stretch = new PPTX::Logic::Stretch();
|
pBlipFill->stretch = new PPTX::Logic::Stretch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nullable_string sRotate;
|
|
||||||
XmlMacroReadAttributeBase(oNodeFill, L"rotate", sRotate);
|
|
||||||
|
|
||||||
nullable_string sMethod;
|
if ((sType.is_init() && (*sType == L"gradient" || *sType == L"gradientradial" || *sType == L"gradientRadial")) ||
|
||||||
XmlMacroReadAttributeBase(oNodeFill, L"method", sMethod);
|
(sFocus.is_init() || sColors.is_init() || sAngle.is_init() || sFocusSize.is_init() || oFocusPosition.is_init()))
|
||||||
|
|
||||||
nullable_string sColor2;
|
|
||||||
XmlMacroReadAttributeBase(oNodeFill, L"color2", sColor2);
|
|
||||||
|
|
||||||
nullable_string sOpacity2;
|
|
||||||
XmlMacroReadAttributeBase(oNodeFill, L"o:opacity2", sOpacity2);
|
|
||||||
|
|
||||||
nullable_string sFocus;
|
|
||||||
XmlMacroReadAttributeBase(oNodeFill, L"focus", sFocus);
|
|
||||||
|
|
||||||
nullable<SimpleTypes::Vml::CVml_Vector2D_Percentage> oFocusPosition;
|
|
||||||
XmlMacroReadAttributeBase(oNodeFill, L"focusposition", oFocusPosition);
|
|
||||||
|
|
||||||
if (sType.is_init() && (*sType == L"gradient" || *sType == L"gradientradial" || *sType == L"gradientRadial"))
|
|
||||||
{
|
{
|
||||||
PPTX::Logic::GradFill* pGradFill = new PPTX::Logic::GradFill();
|
PPTX::Logic::GradFill* pGradFill = new PPTX::Logic::GradFill();
|
||||||
pGradFill->m_namespace = L"a";
|
pGradFill->m_namespace = L"a";
|
||||||
|
|
||||||
PPTX::Logic::Gs Gs_;
|
if (sColors.is_init())
|
||||||
Gs_.color.Color = new PPTX::Logic::SrgbClr();
|
|
||||||
|
|
||||||
if (sColor.is_init())
|
|
||||||
{
|
{
|
||||||
ODRAW::CColor color;
|
std::vector<std::wstring> arSplit;
|
||||||
if (NS_DWC_Common::getColorFromString(*sColor, color))
|
boost::algorithm::split(arSplit, sColors.get(), boost::algorithm::is_any_of(L";"), boost::algorithm::token_compress_on);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < arSplit.size(); i++)
|
||||||
{
|
{
|
||||||
R = color.R;
|
size_t p = arSplit[i].find(L" ");
|
||||||
G = color.G;
|
if (p == std::wstring::npos)
|
||||||
B = color.B;
|
continue;
|
||||||
|
|
||||||
|
std::wstring strPos = arSplit[i].substr(0, p);
|
||||||
|
std::wstring strColor = arSplit[i].substr(p + 1);
|
||||||
|
|
||||||
|
double pos = XmlUtils::GetDouble(strPos);
|
||||||
|
|
||||||
|
PPTX::Logic::Gs Gs_;
|
||||||
|
ODRAW::CColor color;
|
||||||
|
if (NS_DWC_Common::getColorFromString(strColor, color))
|
||||||
|
{
|
||||||
|
Gs_.color.Color = new PPTX::Logic::SrgbClr();
|
||||||
|
Gs_.color.Color->SetRGB(color.R, color.G, color.B);
|
||||||
|
|
||||||
|
if (pos <= 1)
|
||||||
|
pos = 100000 * pos;
|
||||||
|
else
|
||||||
|
pos = pos / 65536 * 100000;
|
||||||
|
|
||||||
|
Gs_.pos = pos;
|
||||||
|
pGradFill->GsLst.push_back(Gs_);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Gs_.color.Color->SetRGB(R, G, B);
|
else
|
||||||
if (sOpacity.is_init())
|
|
||||||
{
|
|
||||||
BYTE lAlpha = NS_DWC_Common::getOpacityFromString(*sOpacity);
|
|
||||||
|
|
||||||
PPTX::Logic::ColorModifier oMod;
|
|
||||||
oMod.name = L"alpha";
|
|
||||||
int nA = (int)(lAlpha * 100000.0 / 255.0);
|
|
||||||
oMod.val = nA;
|
|
||||||
Gs_.color.Color->Modifiers.push_back(oMod);
|
|
||||||
}
|
|
||||||
Gs_.pos = 0;
|
|
||||||
pGradFill->GsLst.push_back(Gs_);
|
|
||||||
|
|
||||||
if (sColor2.is_init() || sOpacity2.is_init())
|
|
||||||
{
|
{
|
||||||
PPTX::Logic::Gs Gs_;
|
PPTX::Logic::Gs Gs_;
|
||||||
Gs_.color.Color = new PPTX::Logic::SrgbClr();
|
ConvertColor(Gs_.color, sColor, sOpacity);
|
||||||
|
|
||||||
|
Gs_.pos = 0;
|
||||||
|
pGradFill->GsLst.push_back(Gs_);
|
||||||
|
|
||||||
if (sColor2.is_init() && (std::wstring::npos != sColor2->find(L"fill")))
|
}
|
||||||
{
|
if (false == sColors.is_init() && (sColor2.is_init() || sOpacity2.is_init()))
|
||||||
std::wstring sColorEffect = *sColor2;
|
{
|
||||||
if (sColorEffect.length() > 5)
|
PPTX::Logic::Gs Gs_;
|
||||||
sColorEffect = sColorEffect.substr(5);
|
ConvertColor(Gs_.color, sColor2, sOpacity2);
|
||||||
|
|
||||||
int resR, resG, resB;
|
|
||||||
GetColorWithEffect(sColorEffect, R, G, B, resR, resG, resB);
|
|
||||||
|
|
||||||
Gs_.color.Color->SetRGB(resR, resG, resB);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ODRAW::CColor color;
|
|
||||||
if (sColor2.is_init() && NS_DWC_Common::getColorFromString(*sColor2, color))
|
|
||||||
{
|
|
||||||
R = color.R;
|
|
||||||
G = color.G;
|
|
||||||
B = color.B;
|
|
||||||
}
|
|
||||||
Gs_.color.Color->SetRGB(R, G, B);
|
|
||||||
}
|
|
||||||
if (sOpacity2.is_init())
|
|
||||||
{
|
|
||||||
BYTE lAlpha = NS_DWC_Common::getOpacityFromString(*sOpacity2);
|
|
||||||
|
|
||||||
PPTX::Logic::ColorModifier oMod;
|
|
||||||
oMod.name = L"alpha";
|
|
||||||
int nA = (int)(lAlpha * 100000.0 / 255.0);
|
|
||||||
oMod.val = nA;
|
|
||||||
Gs_.color.Color->Modifiers.push_back(oMod);
|
|
||||||
}
|
|
||||||
Gs_.pos = 100 * 1000;
|
Gs_.pos = 100 * 1000;
|
||||||
pGradFill->GsLst.push_back( Gs_ );
|
pGradFill->GsLst.push_back( Gs_ );
|
||||||
}
|
}
|
||||||
@ -5123,19 +5164,34 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
|
|||||||
}
|
}
|
||||||
//todooo method
|
//todooo method
|
||||||
|
|
||||||
if (oFocusPosition.is_init() && (*sType == L"gradientradial" || *sType == L"gradientRadial"))
|
if (*sType == L"gradientradial" || *sType == L"gradientRadial")
|
||||||
{
|
{
|
||||||
|
double x = 0, y = 0;
|
||||||
|
if (oFocusPosition.is_init())
|
||||||
|
{
|
||||||
|
x = oFocusPosition->GetX();
|
||||||
|
y = oFocusPosition->GetY();
|
||||||
|
}
|
||||||
pGradFill->path.Init();
|
pGradFill->path.Init();
|
||||||
pGradFill->path->path = 2;
|
pGradFill->path->path = 2;
|
||||||
pGradFill->path->rect.Init();
|
pGradFill->path->rect.Init();
|
||||||
pGradFill->path->rect->b = XmlUtils::ToString(100 - int(oFocusPosition->GetY() * 100)) + L"%";
|
|
||||||
pGradFill->path->rect->t = XmlUtils::ToString(int(oFocusPosition->GetY() * 100)) + L"%";
|
pGradFill->path->rect->b = XmlUtils::ToString(100 - int( y * 100)) + L"%";
|
||||||
pGradFill->path->rect->l = XmlUtils::ToString(oFocusPosition->GetX() * 100) + L"%";
|
pGradFill->path->rect->r = XmlUtils::ToString(100 - int(x * 100)) + L"%";
|
||||||
pGradFill->path->rect->r = XmlUtils::ToString(100 - int(oFocusPosition->GetX() * 100)) + L"%";
|
pGradFill->path->rect->t = XmlUtils::ToString(int(y * 100)) + L"%";
|
||||||
|
pGradFill->path->rect->l = XmlUtils::ToString(int(x * 100)) + L"%";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (sRotate.is_init())
|
if (sAngle.is_init())
|
||||||
|
{
|
||||||
|
int nAngle = XmlUtils::GetInteger(*sAngle);
|
||||||
|
|
||||||
|
pGradFill->lin = new PPTX::Logic::Lin();
|
||||||
|
pGradFill->lin->scaled = 1;
|
||||||
|
pGradFill->lin->ang = (nAngle >= 0 ? nAngle : (360 + nAngle)) * 60000;
|
||||||
|
}
|
||||||
|
else if (sRotate.is_init())
|
||||||
{
|
{
|
||||||
pGradFill->lin = new PPTX::Logic::Lin();
|
pGradFill->lin = new PPTX::Logic::Lin();
|
||||||
pGradFill->lin->scaled = 1;
|
pGradFill->lin->scaled = 1;
|
||||||
@ -5150,29 +5206,31 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
|
|||||||
pSpPr->Fill.Fill = pGradFill;
|
pSpPr->Fill.Fill = pGradFill;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sOpacity.is_init())
|
|
||||||
|
if (*sType == L"pattern" && pSpPr->Fill.m_type != PPTX::Logic::UniFill::blipFill)
|
||||||
|
{
|
||||||
|
PPTX::Logic::PattFill* pPattFill = new PPTX::Logic::PattFill();
|
||||||
|
pPattFill->m_namespace = L"a";
|
||||||
|
|
||||||
|
ConvertColor(pPattFill->fgClr, sColor, sOpacity);
|
||||||
|
ConvertColor(pPattFill->bgClr, sColor2, sOpacity2);
|
||||||
|
|
||||||
|
pSpPr->Fill.m_type = PPTX::Logic::UniFill::pattFill;
|
||||||
|
pSpPr->Fill.Fill = pPattFill;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sOpacity.is_init() && pSpPr->Fill.is<PPTX::Logic::BlipFill>())
|
||||||
{
|
{
|
||||||
BYTE lAlpha = NS_DWC_Common::getOpacityFromString(*sOpacity);
|
BYTE lAlpha = NS_DWC_Common::getOpacityFromString(*sOpacity);
|
||||||
|
|
||||||
if (pSpPr->Fill.is<PPTX::Logic::SolidFill>())
|
PPTX::Logic::AlphaModFix* pAlphaMod = new PPTX::Logic::AlphaModFix();
|
||||||
{
|
int nA = (int)(lAlpha * 100000.0 / 255.0);
|
||||||
PPTX::Logic::ColorModifier oMod;
|
pAlphaMod->amt = nA;
|
||||||
oMod.name = L"alpha";
|
|
||||||
int nA = (int)(lAlpha * 100000.0 / 255.0);
|
|
||||||
oMod.val = nA;
|
|
||||||
pSpPr->Fill.as<PPTX::Logic::SolidFill>().Color.Color->Modifiers.push_back(oMod);
|
|
||||||
}
|
|
||||||
else if (pSpPr->Fill.is<PPTX::Logic::BlipFill>())
|
|
||||||
{
|
|
||||||
PPTX::Logic::AlphaModFix* pAlphaMod = new PPTX::Logic::AlphaModFix();
|
|
||||||
int nA = (int)(lAlpha * 100000.0 / 255.0);
|
|
||||||
pAlphaMod->amt = nA;
|
|
||||||
|
|
||||||
PPTX::Logic::UniEffect oEff;
|
PPTX::Logic::UniEffect oEff;
|
||||||
oEff.InitPointer(pAlphaMod);
|
oEff.InitPointer(pAlphaMod);
|
||||||
|
|
||||||
pSpPr->Fill.as<PPTX::Logic::BlipFill>().blip->Effects.push_back(oEff);
|
pSpPr->Fill.as<PPTX::Logic::BlipFill>().blip->Effects.push_back(oEff);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (true)
|
if (true)
|
||||||
@ -5353,26 +5411,18 @@ void CDrawingConverter::CheckPenShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils::
|
|||||||
if (pPPTShape->IsWordArt())
|
if (pPPTShape->IsWordArt())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nullable_string sStrokeColor;
|
nullable_string sStrokeColor, sStrokeOpacity;
|
||||||
XmlMacroReadAttributeBase(oNode, L"strokecolor", sStrokeColor);
|
XmlMacroReadAttributeBase(oNode, L"strokecolor", sStrokeColor);
|
||||||
if (sStrokeColor.is_init())
|
if (sStrokeColor.is_init())
|
||||||
{
|
{
|
||||||
ODRAW::CColor color;
|
pPPTShape->m_bIsStroked = true;
|
||||||
if (NS_DWC_Common::getColorFromString(*sStrokeColor, color))
|
PPTX::Logic::SolidFill* pSolid = new PPTX::Logic::SolidFill();
|
||||||
{
|
pSolid->m_namespace = L"a";
|
||||||
pPPTShape->m_bIsStroked = true;
|
|
||||||
|
|
||||||
if (!pSpPr->ln.is_init())
|
ConvertColor(pSolid->Color, sStrokeColor, sStrokeOpacity);
|
||||||
pSpPr->ln = new PPTX::Logic::Ln();
|
|
||||||
|
|
||||||
PPTX::Logic::SolidFill* pSolid = new PPTX::Logic::SolidFill();
|
pSpPr->ln->Fill.m_type = PPTX::Logic::UniFill::solidFill;
|
||||||
pSolid->m_namespace = L"a";
|
pSpPr->ln->Fill.Fill = pSolid;
|
||||||
pSolid->Color.Color = new PPTX::Logic::SrgbClr();
|
|
||||||
pSolid->Color.Color->SetRGB(color.R, color.G, color.B);
|
|
||||||
|
|
||||||
pSpPr->ln->Fill.m_type = PPTX::Logic::UniFill::solidFill;
|
|
||||||
pSpPr->ln->Fill.Fill = pSolid;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nullable<SimpleTypes::CEmu> oStrokeWeight;
|
nullable<SimpleTypes::CEmu> oStrokeWeight;
|
||||||
|
|||||||
@ -94,6 +94,7 @@ namespace PPTX
|
|||||||
class Xfrm;
|
class Xfrm;
|
||||||
class Shape;
|
class Shape;
|
||||||
class ClrMap;
|
class ClrMap;
|
||||||
|
class UniColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
class CStringTrimmer
|
class CStringTrimmer
|
||||||
@ -298,7 +299,8 @@ namespace NSBinPptxRW
|
|||||||
void CheckPenShape (PPTX::Logic::SpTreeElem* oElem, XmlUtils::CXmlNode& oNode, CPPTShape* pPPTShape);
|
void CheckPenShape (PPTX::Logic::SpTreeElem* oElem, XmlUtils::CXmlNode& oNode, CPPTShape* pPPTShape);
|
||||||
void CheckBorderShape (PPTX::Logic::SpTreeElem* oElem, XmlUtils::CXmlNode& oNode, CPPTShape* pPPTShape);
|
void CheckBorderShape (PPTX::Logic::SpTreeElem* oElem, XmlUtils::CXmlNode& oNode, CPPTShape* pPPTShape);
|
||||||
|
|
||||||
void LoadCoordSize (XmlUtils::CXmlNode& oNode, ::CShapePtr pShape);
|
void ConvertColor (PPTX::Logic::UniColor& uniColor, nullable_string& sColor, nullable_string& sOpacity);
|
||||||
|
void LoadCoordSize (XmlUtils::CXmlNode& oNode, ::CShapePtr pShape);
|
||||||
void LoadCoordPos (XmlUtils::CXmlNode& oNode, ::CShapePtr pShape);
|
void LoadCoordPos (XmlUtils::CXmlNode& oNode, ::CShapePtr pShape);
|
||||||
|
|
||||||
std::wstring GetDrawingMainProps (XmlUtils::CXmlNode& oNode, PPTX::CCSS& oCssStyles, CSpTreeElemProps& oProps);
|
std::wstring GetDrawingMainProps (XmlUtils::CXmlNode& oNode, PPTX::CCSS& oCssStyles, CSpTreeElemProps& oProps);
|
||||||
|
|||||||
@ -38,6 +38,7 @@
|
|||||||
#include "SpTree.h"
|
#include "SpTree.h"
|
||||||
#include "GraphicFrame.h"
|
#include "GraphicFrame.h"
|
||||||
#include "Effects/AlphaModFix.h"
|
#include "Effects/AlphaModFix.h"
|
||||||
|
#include "Effects/Duotone.h"
|
||||||
|
|
||||||
#include "../SlideMaster.h"
|
#include "../SlideMaster.h"
|
||||||
|
|
||||||
@ -90,11 +91,13 @@ namespace PPTX
|
|||||||
|
|
||||||
if (oBlip.blip.is_init() && oBlip.blip->embed.is_init())
|
if (oBlip.blip.is_init() && oBlip.blip->embed.is_init())
|
||||||
{
|
{
|
||||||
|
std::wstring color2;
|
||||||
std::wstring fopacity;
|
std::wstring fopacity;
|
||||||
|
std::wstring sType = oBlip.tile.IsInit() ? L"tile" : L"frame";
|
||||||
|
|
||||||
size_t eff_count = oBlip.blip->Effects.size();
|
size_t eff_count = oBlip.blip->Effects.size();
|
||||||
for (size_t eff = 0; eff < eff_count; ++eff)
|
for (size_t eff = 0; eff < eff_count; ++eff)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (oBlip.blip->Effects[eff].is<PPTX::Logic::AlphaModFix>())
|
if (oBlip.blip->Effects[eff].is<PPTX::Logic::AlphaModFix>())
|
||||||
{
|
{
|
||||||
PPTX::Logic::AlphaModFix& oAlpha = oBlip.blip->Effects[eff].as<PPTX::Logic::AlphaModFix>();
|
PPTX::Logic::AlphaModFix& oAlpha = oBlip.blip->Effects[eff].as<PPTX::Logic::AlphaModFix>();
|
||||||
@ -111,7 +114,19 @@ namespace PPTX
|
|||||||
|
|
||||||
fopacity = L" opacity=\"" + std::to_wstring(nA) + L"f\"";
|
fopacity = L" opacity=\"" + std::to_wstring(nA) + L"f\"";
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
|
else if (oBlip.blip->Effects[eff].is<PPTX::Logic::Duotone>())
|
||||||
|
{
|
||||||
|
PPTX::Logic::Duotone& oDuotone = oBlip.blip->Effects[eff].as<PPTX::Logic::Duotone>();
|
||||||
|
if (oDuotone.Colors.size() > 1)
|
||||||
|
{
|
||||||
|
sType = L"pattern";
|
||||||
|
ARGB = oDuotone.Colors[0].GetRGBColor(oTheme, oClrMap, ARGB);
|
||||||
|
strAttr += L" fillcolor=\"" + GetHexColor(ARGB) + L"\"";
|
||||||
|
|
||||||
|
ARGB = oDuotone.Colors[1].GetRGBColor(oTheme, oClrMap, ARGB);
|
||||||
|
color2 = L" color2=\"" + GetHexColor(ARGB) + L"\"";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,10 +146,7 @@ namespace PPTX
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (oBlip.tile.is_init())
|
strNode = L"<v:fill " + strId + L" o:title=\"\" type=\"" + sType + L"\"" + fopacity + color2 + L"/>";
|
||||||
strNode = L"<v:fill " + strId + L" o:title=\"\" type=\"tile\"" + fopacity + L"/>";
|
|
||||||
else
|
|
||||||
strNode = L"<v:fill " + strId + L" o:title=\"\" type=\"frame\"" + fopacity + L"/>";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -153,18 +165,123 @@ namespace PPTX
|
|||||||
else if (fill.is<GradFill>())
|
else if (fill.is<GradFill>())
|
||||||
{
|
{
|
||||||
GradFill& oGrad = fill.as<GradFill>();
|
GradFill& oGrad = fill.as<GradFill>();
|
||||||
if (oGrad.GsLst.size() > 0)
|
|
||||||
|
std::wstring sType = L"gradient";
|
||||||
|
std::wstring sColors;
|
||||||
|
std::wstring sColor;
|
||||||
|
std::wstring sColor2;
|
||||||
|
std::wstring sOpacity;
|
||||||
|
std::wstring sOpacity2;
|
||||||
|
std::wstring sAngle;
|
||||||
|
std::wstring sFocus = L"100%";
|
||||||
|
std::wstring sFocusPosition = L"";
|
||||||
|
std::wstring sFillNode;
|
||||||
|
|
||||||
|
if (oGrad.lin.IsInit())
|
||||||
{
|
{
|
||||||
ARGB = oGrad.GsLst[0].color.GetRGBColor(oTheme, oClrMap, ARGB);
|
if (oGrad.lin->ang.IsInit())
|
||||||
strAttr = L" fillcolor=\"" + GetHexColor(ARGB) + L"\"";
|
{
|
||||||
|
int ang = *oGrad.lin->ang / 60000;
|
||||||
|
sAngle = std::to_wstring(ang > 180 ? ang - 360 : ang);
|
||||||
|
}
|
||||||
|
if (oGrad.lin->scaled.IsInit())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (oGrad.path.IsInit())
|
||||||
|
{
|
||||||
|
sType = L"gradientRadial";
|
||||||
|
|
||||||
|
double focusposition_x = 0.5, focusposition_y = 0.5;
|
||||||
|
if (oGrad.path->rect.IsInit())
|
||||||
|
{
|
||||||
|
double l = XmlUtils::GetInteger(oGrad.path->rect->l.get_value_or(L"")) / 100.;
|
||||||
|
double r = XmlUtils::GetInteger(oGrad.path->rect->r.get_value_or(L"")) / 100.;
|
||||||
|
double t = XmlUtils::GetInteger(oGrad.path->rect->t.get_value_or(L"")) / 100.;
|
||||||
|
double b = XmlUtils::GetInteger(oGrad.path->rect->b.get_value_or(L"")) / 100.;
|
||||||
|
|
||||||
|
focusposition_y += (t - b) / 2.;
|
||||||
|
focusposition_x += (l - r) / 2.;
|
||||||
|
}
|
||||||
|
sFocusPosition = XmlUtils::DoubleToString(focusposition_x, L"%.2f") + L"," + XmlUtils::DoubleToString(focusposition_y, L"%.2f");
|
||||||
|
|
||||||
|
sFillNode = L"<o:fill v:ext=\"view\" type=\"gradientCenter\"/>";
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t i = 0; i < oGrad.GsLst.size(); ++i)
|
||||||
|
{
|
||||||
|
std::wstring col, op, pos;
|
||||||
|
ARGB = oGrad.GsLst[i].color.GetRGBColor(oTheme, oClrMap, ARGB);
|
||||||
|
col = GetHexColor(ARGB);
|
||||||
|
|
||||||
BYTE A = (BYTE)((ARGB >> 24) & 0xFF);
|
BYTE A = (BYTE)((ARGB >> 24) & 0xFF);
|
||||||
if (A != 255)
|
if (A != 255)
|
||||||
{
|
{
|
||||||
int fopacity = 100 - (int)(((double)A / 255.0) * 65536);
|
int fopacity = 100 - (int)(((double)A / 255.0) * 65536);
|
||||||
strNode = L"<v:fill opacity=\"" + std::to_wstring(fopacity) + L"f\" />";
|
op = std::to_wstring(fopacity) + L"f";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pos = std::to_wstring((int)(oGrad.GsLst[i].pos / 100000. * 65536)) + L"f";
|
||||||
|
|
||||||
|
if (i == 0)
|
||||||
|
{
|
||||||
|
sColor = col;
|
||||||
|
sOpacity = op;
|
||||||
|
}
|
||||||
|
if (i == oGrad.GsLst.size() - 1)
|
||||||
|
{
|
||||||
|
sColor2 = col;
|
||||||
|
sOpacity2 = op;
|
||||||
|
}
|
||||||
|
sColors += pos + L" " + col + L";";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (false == sColor.empty())
|
||||||
|
{
|
||||||
|
strAttr = L" fillcolor=\"" + sColor + L"\"";
|
||||||
|
}
|
||||||
|
|
||||||
|
strNode += L"<v:fill";
|
||||||
|
if (false == sColor2.empty())
|
||||||
|
{
|
||||||
|
strNode += L" color2=\"" + sColor2 + L"\"";
|
||||||
|
}
|
||||||
|
if (false == sOpacity.empty())
|
||||||
|
{
|
||||||
|
strNode += L" opacity=\"" + sOpacity + L"\"";
|
||||||
|
}
|
||||||
|
if (false == sOpacity2.empty())
|
||||||
|
{
|
||||||
|
strNode += L" opacity2=\"" + sOpacity2 + L"\"";
|
||||||
|
}
|
||||||
|
if (false == sColors.empty())
|
||||||
|
{
|
||||||
|
strNode += L" colors=\"" + sColors + L"\"";
|
||||||
|
}
|
||||||
|
if (false == sAngle.empty())
|
||||||
|
{
|
||||||
|
strNode += L" angle=\"" + sAngle + L"\"";
|
||||||
|
}
|
||||||
|
if (false == sFocusPosition.empty())
|
||||||
|
{
|
||||||
|
strNode += L" focusposition=\"" + sFocusPosition + L"\"";
|
||||||
|
}
|
||||||
|
if (false == sFocus.empty())
|
||||||
|
{
|
||||||
|
strNode += L" focus=\"" + sFocus + L"\"";
|
||||||
|
}
|
||||||
|
if (false == sType.empty())
|
||||||
|
{
|
||||||
|
strNode += L" type=\"" + sType + L"\"";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (false == sFillNode.empty())
|
||||||
|
{
|
||||||
|
strNode += L">" + sFillNode + L"</v:fill>";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
strNode += L"/>";
|
||||||
}
|
}
|
||||||
else if (fill.is<NoFill>() || !fill.is_init())
|
else if (fill.is<NoFill>() || !fill.is_init())
|
||||||
{
|
{
|
||||||
@ -178,18 +295,9 @@ namespace PPTX
|
|||||||
if (A != 255)
|
if (A != 255)
|
||||||
{
|
{
|
||||||
int fopacity = (int)(((double)A / 255.0) * 65536);
|
int fopacity = (int)(((double)A / 255.0) * 65536);
|
||||||
strNode = L"<v:fill opacity=\"" + std::to_wstring(fopacity) + L"f\" />";
|
strNode = L"<v:fill opacity=\"" + std::to_wstring(fopacity) + L"f\"/>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
BYTE alpha = (BYTE)((ARGB >> 24) & 0xFF);
|
|
||||||
if (alpha < 255)
|
|
||||||
{
|
|
||||||
std::wstring strA = = std::to_string( alpha);
|
|
||||||
strAttr += _T(" opacity=\"") + strA + _T("\"");
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
void CalculateLine(BYTE lDocType, PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle, NSCommon::smart_ptr<PPTX::Theme>& oTheme,
|
void CalculateLine(BYTE lDocType, PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle, NSCommon::smart_ptr<PPTX::Theme>& oTheme,
|
||||||
NSCommon::smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle)
|
NSCommon::smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle)
|
||||||
|
|||||||
Reference in New Issue
Block a user