Commit 9e1773df authored by ElenaSubbotina's avatar ElenaSubbotina

Used ClrMap in docx settings

parent 39e41405
......@@ -7194,80 +7194,94 @@ namespace BinDocxRW
}
}
}
void WriteColorSchemeMapping(const OOX::Settings::CColorSchemeMapping& oColorSchemeMapping)
void WriteColorSchemeMapping(const PPTX::Logic::ClrMap& oColorSchemeMapping)
{
int nCurPos = 0;
if(oColorSchemeMapping.m_oAccent1.IsInit())
std::map<std::wstring, PPTX::Limit::ColorSchemeIndex>::const_iterator pFind;
pFind = oColorSchemeMapping.ColorMap.find(L"accent1");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent1);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oAccent1->GetValue());
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
}
if(oColorSchemeMapping.m_oAccent2.IsInit())
pFind = oColorSchemeMapping.ColorMap.find(L"accent2");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent2);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oAccent2->GetValue());
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
}
if(oColorSchemeMapping.m_oAccent3.IsInit())
pFind = oColorSchemeMapping.ColorMap.find(L"accent3");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent3);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oAccent3->GetValue());
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
}
if(oColorSchemeMapping.m_oAccent4.IsInit())
pFind = oColorSchemeMapping.ColorMap.find(L"accent4");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent4);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oAccent4->GetValue());
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
}
if(oColorSchemeMapping.m_oAccent5.IsInit())
pFind = oColorSchemeMapping.ColorMap.find(L"accent5");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent5);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oAccent5->GetValue());
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
}
if(oColorSchemeMapping.m_oAccent6.IsInit())
pFind = oColorSchemeMapping.ColorMap.find(L"accent6");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent6);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oAccent6->GetValue());
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
}
if(oColorSchemeMapping.m_oBg1.IsInit())
pFind = oColorSchemeMapping.ColorMap.find(L"bg1");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Bg1);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oBg1->GetValue());
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
}
if(oColorSchemeMapping.m_oBg2.IsInit())
pFind = oColorSchemeMapping.ColorMap.find(L"bg2");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Bg2);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oBg2->GetValue());
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
}
if(oColorSchemeMapping.m_oFollowedHyperlink.IsInit())
pFind = oColorSchemeMapping.ColorMap.find(L"folHlink");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::FollowedHyperlink);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oFollowedHyperlink->GetValue());
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
}
if(oColorSchemeMapping.m_oHyperlink.IsInit())
pFind = oColorSchemeMapping.ColorMap.find(L"hlink");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Hyperlink);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oHyperlink->GetValue());
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
}
if(oColorSchemeMapping.m_oT1.IsInit())
pFind = oColorSchemeMapping.ColorMap.find(L"tx1");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::T1);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oT1->GetValue());
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
}
if(oColorSchemeMapping.m_oT2.IsInit())
pFind = oColorSchemeMapping.ColorMap.find(L"tx2");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::T2);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(oColorSchemeMapping.m_oT2->GetValue());
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
}
};
};
......
......@@ -2809,11 +2809,19 @@ void DocxConverter::convert(ComplexTypes::Word::CColor *color, _CP_OPT(odf_types
if (!color)return;
convert(color->m_oVal.GetPointer(), color->m_oThemeColor.GetPointer(),color->m_oThemeTint.GetPointer(),color->m_oThemeShade.GetPointer(), odf_color);
}
PPTX::Logic::ClrMap* DocxConverter::oox_clrMap()
{
//return current_clrMap; todoooo
OOX::CSettings * docx_settings = docx_document->GetSettings();
if (!docx_settings) return NULL;
return docx_settings->m_oClrSchemeMapping.GetPointer();
}
void DocxConverter::convert_settings()
{
if (!odt_context) return;
OOX::CSettings * docx_settings = docx_document->GetSettings();
OOX::CSettings * docx_settings = docx_document->GetSettings();
if (!docx_settings) return;
if (docx_settings->m_oZoom.IsInit())
......
......@@ -150,6 +150,7 @@ namespace Oox2Odf
virtual OOX::IFileContainer *current_document();
virtual odf_writer::odf_conversion_context *odf_context();
virtual PPTX::Theme *oox_theme();
virtual PPTX::Logic::ClrMap *oox_clrMap();
virtual std::wstring find_link_by_id (std::wstring sId, int t);
virtual NSCommon::smart_ptr<OOX::File> find_file_by_id(std::wstring sId);
......
......@@ -4309,7 +4309,7 @@ HRESULT CDrawingConverter::LoadClrMap(const std::wstring& bsXml)
if (oNode.IsValid())
{
pClrMap->fromXMLW(oNode.ReadNode(L"w:clrSchemeMapping"));
pClrMap->fromXML(oNode.ReadNode(L"w:clrSchemeMapping"));
}
*m_pClrMap = pClrMap;
......
......@@ -245,7 +245,7 @@ namespace PPTX
std::map<std::wstring, Limit::ColorSchemeIndex> ColorMap;
std::wstring m_name;
std::wstring m_name;
protected:
virtual void FillParentPointersForChilds(){};
};
......
......@@ -496,13 +496,13 @@ namespace PPTX
static void HSL2RGB(unsigned char* HSL, unsigned char* RGB)
{
if ( HSL[1] == 0 )
{
RGB[0] = HSL[2];
RGB[1] = HSL[2];
RGB[2] = HSL[2];
}
else
//if ( HSL[1] == 0 )
//{
// RGB[0] = HSL[2];
// RGB[1] = HSL[2];
// RGB[2] = HSL[2];
//}
//else
{
double H = double(HSL[0])/240.0;
double S = double(HSL[1])/240.0;
......
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