diff --git a/OOXML/Binary/Sheets/Common/BinReaderWriterDefines.h b/OOXML/Binary/Sheets/Common/BinReaderWriterDefines.h index 20ec0466f5..3416f86765 100644 --- a/OOXML/Binary/Sheets/Common/BinReaderWriterDefines.h +++ b/OOXML/Binary/Sheets/Common/BinReaderWriterDefines.h @@ -589,7 +589,8 @@ namespace BinXlsxRW Text = 53, Print = 54, ItemLst = 55, - Item = 56 + Item = 56, + Shape = 57 };} namespace c_oSerCellTypes{enum c_oSerCellTypes { diff --git a/OOXML/Binary/Sheets/Reader/BinaryWriterS.cpp b/OOXML/Binary/Sheets/Reader/BinaryWriterS.cpp index 072463790a..ad1e8c2d10 100644 --- a/OOXML/Binary/Sheets/Reader/BinaryWriterS.cpp +++ b/OOXML/Binary/Sheets/Reader/BinaryWriterS.cpp @@ -6364,8 +6364,6 @@ void BinaryWorksheetTableWriter::WriteControls(const OOX::Spreadsheet::CWorkshee { continue; } - if (pShape) - pFind->second.bUsed = true; //----------------------------------------------------------------------------------------------------- int nCurPos2 = m_oBcw.WriteItemStart(c_oSerControlTypes::Control); int nCurPos3 = m_oBcw.WriteItemStart(c_oSerControlTypes::ControlAnchor); @@ -6378,6 +6376,21 @@ void BinaryWorksheetTableWriter::WriteControls(const OOX::Spreadsheet::CWorkshee m_oBcw.m_oStream.WriteStringW(*pControl->m_oName); } WriteControlPr(pControl->m_oControlPr.GetPointer(), pFormControlPr); + if (pShape) + { + pFind->second.bUsed = true; + + nCurPos3 = m_oBcw.WriteItemStart(c_oSerControlTypes::Shape); + + std::wstring* pMainProps = NULL; + smart_ptr oldRels = m_pOfficeDrawingConverter->GetRels(); + m_pOfficeDrawingConverter->SetRels(pVmlDrawing); + + m_pOfficeDrawingConverter->AddObject(L"" + pFind->second.sXml + L"", &pMainProps); + + m_pOfficeDrawingConverter->SetRels(oldRels); + m_oBcw.WriteItemEnd(nCurPos3); + } m_oBcw.WriteItemEnd(nCurPos2); } m_oBcw.WriteItemEnd(nCurPos); diff --git a/OOXML/Binary/Sheets/Writer/BinaryReaderS.cpp b/OOXML/Binary/Sheets/Writer/BinaryReaderS.cpp index 486a021492..8c2e0c0da5 100644 --- a/OOXML/Binary/Sheets/Writer/BinaryReaderS.cpp +++ b/OOXML/Binary/Sheets/Writer/BinaryReaderS.cpp @@ -6453,7 +6453,9 @@ int BinaryWorksheetsTableReader::ReadDrawings(BYTE type, long length, void* poRe oWriter.m_lObjectIdVML = m_pCurVmlDrawing->m_lObjectIdVML; NSCommon::smart_ptr oClrMap; - oShape.toXmlWriterVML(&oWriter, m_oSaveParams.pTheme, oClrMap, false, true); + NSCommon::smart_ptr oContainer = m_pCurVmlDrawing.smart_dynamic_cast(); + + oShape.toXmlWriterVML(&oWriter, m_oSaveParams.pTheme, oClrMap, oContainer, false, true); std::wstring strXml = oWriter.GetXmlString(); @@ -6567,12 +6569,17 @@ int BinaryWorksheetsTableReader::ReadLegacyDrawingHF(BYTE type, long length, voi if (c_oSer_LegacyDrawingHF::Drawings == type) { m_pOfficeDrawingConverter->SetDstContentRels(); + OOX::CVmlDrawing* pVmlDrawing = new OOX::CVmlDrawing(NULL, false); pVmlDrawing->m_lObjectIdVML = m_lObjectIdVML; + READ1_DEF(length, res, this->ReadLegacyDrawingHFDrawings, pVmlDrawing); + m_lObjectIdVML = pVmlDrawing->m_lObjectIdVML; + NSCommon::smart_ptr pVmlDrawingFile(pVmlDrawing); const OOX::RId oRId = m_pCurWorksheet->Add(pVmlDrawingFile); + pLegacyDrawingHF->m_oId.Init(); pLegacyDrawingHF->m_oId->SetValue(oRId.get()); @@ -6700,7 +6707,10 @@ int BinaryWorksheetsTableReader::ReadLegacyDrawingHFDrawings(BYTE type, long len //oWriter.m_strId = oVmlShape.sXml.c_str(); //?? - pSpTree->toXmlWriterVML(&oWriter, m_oSaveParams.pTheme, oClrMap); + NSCommon::smart_ptr oContainer(pVmlDrawing); + oContainer.AddRef(); + + pSpTree->toXmlWriterVML(&oWriter, m_oSaveParams.pTheme, oClrMap, oContainer); pVmlDrawing->m_lObjectIdVML = oWriter.m_lObjectIdVML; pVmlDrawing->m_arObjectXml.push_back(oWriter.GetXmlString()); } @@ -7119,10 +7129,8 @@ int BinaryWorksheetsTableReader::ReadControls(BYTE type, long length, void* poRe READ1_DEF(length, res, this->ReadControl, pControl.GetPointer()); - std::wstring strXml = GetControlVmlShape(pControl.GetPointer()); + GetControlVmlShape(pControl.GetPointer()); - m_pCurVmlDrawing->m_arControlXml.push_back(strXml); - smart_ptr pCtrlPropFile(new OOX::Spreadsheet::CCtrlPropFile(NULL)); pCtrlPropFile->m_oFormControlPr = pControl->m_oFormControlPr; @@ -7339,6 +7347,15 @@ int BinaryWorksheetsTableReader::ReadControl(BYTE type, long length, void* poRes pControl->m_oFormControlPr->m_oItemLst.Init(); READ1_DEF(length, res, this->ReadControlItems, pControl->m_oFormControlPr->m_oItemLst.GetPointer()); } + else if (c_oSerControlTypes::Shape == type) + { + pControl->m_oShape = new PPTX::Logic::SpTreeElem(); + BYTE typeRec1 = m_oBufferedStream.GetUChar(); // must be 0; + LONG _e = m_oBufferedStream.GetPos() + m_oBufferedStream.GetLong() + 4; + m_oBufferedStream.Skip(5); // type record (must be 1) + 4 byte - len recor + + pControl->m_oShape->fromPPTY(&m_oBufferedStream); + } else res = c_oSerConstants::ReadUnknown; return res; @@ -7359,7 +7376,7 @@ int BinaryWorksheetsTableReader::ReadControlItems(BYTE type, long length, void* res = c_oSerConstants::ReadUnknown; return res; } -std::wstring BinaryWorksheetsTableReader::GetControlVmlShape(void* pC) +void BinaryWorksheetsTableReader::GetControlVmlShape(void* pC) { OOX::Spreadsheet::CControl* pControl = static_cast(pC); //generate ClientData @@ -7442,29 +7459,64 @@ std::wstring BinaryWorksheetsTableReader::GetControlVmlShape(void* pC) oClientData.m_oFmlaTxbx = pControl->m_oFormControlPr->m_oFmlaTxbx; oClientData.m_oFmlaGroup = pControl->m_oFormControlPr->m_oFmlaGroup; - std::wstring result = L"m_oShapeId->GetValue()) + L"\""; - result += L" style='position:absolute' stroked=\"f\" strokecolor=\"windowText [64]\" o:insetmode=\"auto\""; - result += L" filled=\"f\" fillcolor=\"window [65]\""; + std::wstring strXmlShapeControl; + + std::wstring strFillAttr; + std::wstring strStrokeAttr; + std::wstring strFillNode; + std::wstring strStrokeNode; + + smart_ptr oShape; + + if (pControl->m_oShape.IsInit() && pControl->m_oShape->is_init()) + { + oShape = pControl->m_oShape->GetElem().smart_dynamic_cast(); + } + + if (oShape.IsInit()) + { + NSCommon::smart_ptr oClrMap; + + NSCommon::smart_ptr pContainer = m_pCurVmlDrawing.smart_dynamic_cast(); + + CalculateFill(XMLWRITER_DOC_TYPE_XLSX, oShape->spPr, oShape->style, m_oSaveParams.pTheme, oClrMap, pContainer, strFillAttr, strFillNode, false, false); + CalculateLine(XMLWRITER_DOC_TYPE_XLSX, oShape->spPr, oShape->style, m_oSaveParams.pTheme, oClrMap, strStrokeAttr, strStrokeNode, false); + } + else + { + strStrokeAttr = L" stroked='f' strokecolor='windowText [64]'"; + strFillAttr = L" filled='f' fillcolor='window [65]'"; + } + strXmlShapeControl = L""; - result += L""; - - result += oClientData.toXML(); + strXmlShapeControl += L">"; + + strXmlShapeControl += strFillNode; + strXmlShapeControl += strStrokeNode; + strXmlShapeControl += L""; + if (pControl->m_oFormControlPr->m_oText.IsInit()) { OOX::Vml::CTextbox oTextbox; oTextbox.m_oText = pControl->m_oFormControlPr->m_oText; - result += oTextbox.toXML(); + strXmlShapeControl += oTextbox.toXML(); } - result += L""; - return result; + strXmlShapeControl += oClientData.toXML(); + + strXmlShapeControl += L""; + + m_pCurVmlDrawing->m_arControlXml.push_back(strXmlShapeControl); } int BinaryWorksheetsTableReader::ReadFormula(BYTE type, long length, void* poResult) { diff --git a/OOXML/Binary/Sheets/Writer/BinaryReaderS.h b/OOXML/Binary/Sheets/Writer/BinaryReaderS.h index 39312a00cf..33c028d419 100644 --- a/OOXML/Binary/Sheets/Writer/BinaryReaderS.h +++ b/OOXML/Binary/Sheets/Writer/BinaryReaderS.h @@ -413,7 +413,7 @@ namespace BinXlsxRW void WriteComments(); void AddLineBreak(OOX::Spreadsheet::CSi& oSi); - std::wstring GetControlVmlShape(void* pControl); + void GetControlVmlShape(void* pControl); int ReadSheetDataToBin(BYTE type, long length, void* poResult); bool m_bWriteToXlsb = false; }; diff --git a/OOXML/PPTXFormat/DrawingConverter/ASCOfficeDrawingConverter.cpp b/OOXML/PPTXFormat/DrawingConverter/ASCOfficeDrawingConverter.cpp index 3e243830fd..84e2ff0fe8 100644 --- a/OOXML/PPTXFormat/DrawingConverter/ASCOfficeDrawingConverter.cpp +++ b/OOXML/PPTXFormat/DrawingConverter/ASCOfficeDrawingConverter.cpp @@ -559,9 +559,40 @@ namespace NS_DWC_Common bool getColorFromString(const std::wstring& colorStr, ODRAW::CColor & color) { bool bSet = false; - if (colorStr.find(L"#") != std::wstring::npos) + + int RGB = 0; + std::wstring str; + + size_t pos = colorStr.find(L"["); //"buttonFace [67]" "#9c0 [50]" + if (pos != std::wstring::npos) { - if (colorStr.length() == 4) + size_t pos1 = colorStr.find(L"]", pos + 1); + if (pos1 != std::wstring::npos) + { + str = colorStr.substr(pos + 1, pos1 - pos - 1); + + if (NSStringUtils::IsNumber(str)) + { + int index = XmlUtils::GetInteger(str); + if (index < 64) + { + RGB = shemeDefaultColor[index]; + bSet = true; + } + } + } + //else if (index < 93) + //{ + // RGB = background ? controlPanelColors2[index - 65] : controlPanelColors1[index - 65]; + // bSet = true; + //} + } + if (!bSet && colorStr.find(L"#") == 0) // "#9c0 [50]" + { + size_t pos_end = colorStr.find(L" ", 1); //"buttonFace [67]" "#9c0 [50]" + if (pos_end == std::wstring::npos) pos_end = colorStr.length(); + + if (pos_end == 4) { int lColor = XmlUtils::GetColorBGR(colorStr.substr(1, 3)); BYTE lB = ((lColor >> 16) & 0x0F); @@ -581,293 +612,264 @@ namespace NS_DWC_Common color.B = (BYTE)(lColor >> 16); color.A = 0; } + RGB = color.GetLONG_RGB(); bSet = true; } - else + + if (!bSet) { - int RGB = 0; - std::wstring str; + pos = colorStr.find(' '); + if (pos == std::wstring::npos) + str = colorStr; + else + str = colorStr.substr(0, pos); - size_t pos = colorStr.find(L"["); //"buttonFace [67]" - if (pos != std::wstring::npos) + switch (str[0]) { - size_t pos1 = colorStr.find(L"]", pos + 1); - if (pos1 != std::wstring::npos) - { - str = colorStr.substr(pos + 1, pos1 - pos - 1); - - if (NSStringUtils::IsNumber(str)) - { - int index = XmlUtils::GetInteger(str); - if (index < 64) - { - RGB = shemeDefaultColor[index]; - bSet = true; - } - } - } - //else if (index < 93) - //{ - // RGB = background ? controlPanelColors2[index - 65] : controlPanelColors1[index - 65]; - // bSet = true; - //} - } - - if (!bSet) - { - pos = colorStr.find(' '); - if (pos == std::wstring::npos) - str = colorStr; - else - str = colorStr.substr(0, pos); - - switch (str[0]) - { - case 'a': - if (str == L"aliceBlue") { RGB = 0xF0F8FF; bSet = true; break; } // (Alice Blue Preset Color) Specifies a color with RGB value (240,248,255) - else if (str == L"antiqueWhite") { RGB = 0xFAEBD7; bSet = true; break; } // (Antique White Preset Color) Specifies a color with RGB value (250,235,215) - else if (str == L"aqua") { RGB = 0x00FFFF; bSet = true; break; } // (Aqua Preset Color) Specifies a color with RGB value (0,255,255) - else if (str == L"aquamarine") { RGB = 0x7FFFD4; bSet = true; break; } // (Aquamarine Preset Color) Specifies a color with RGB value (127,255,212) - else if (str == L"azure") { RGB = 0xF0FFFF; bSet = true; break; } // (Azure Preset Color) Specifies a color with RGB value (240,255,255) - break; - case 'b': - if (str == L"beige") { RGB = 0xF5F5DC; bSet = true; break; } // (Beige Preset Color) Specifies a color with RGB value (245,245,220) - else if (str == L"bisque") { RGB = 0xFFE4C4; bSet = true; break; } // (Bisque Preset Color) Specifies a color with RGB value (255,228,196) - else if (str == L"black") { RGB = 0x000000; bSet = true; break; } // (Black Preset Color) Specifies a color with RGB value (0,0,0) - else if (str == L"blanchedAlmond") { RGB = 0xFFEBCD; bSet = true; break; } // (Blanched Almond Preset Color) Specifies a color with RGB value (255,235,205) - else if (str == L"blue") { RGB = 0x0000FF; bSet = true; break; } // (Blue Preset Color) Specifies a color with RGB value (0,0,255) - else if (str == L"blueViolet") { RGB = 0x8A2BE2; bSet = true; break; } // (Blue Violet Preset Color) Specifies a color with RGB value (138,43,226) - else if (str == L"brown") { RGB = 0xA52A2A; bSet = true; break; } // (Brown Preset Color) Specifies a color with RGB value (165,42,42) - else if (str == L"burlyWood") { RGB = 0xDEB887; bSet = true; break; } // (Burly Wood Preset Color) Specifies a color with RGB value (222,184,135) - else if (str == L"buttonFace") { RGB = 0xF0F0F0; bSet = true; break; } - else if (str == L"buttonText") { RGB = 0x000000; bSet = true; break; } - break; - case 'c': - if (str == L"cadetBlue") { RGB = 0x5F9EA0; bSet = true; break; } // (Cadet Blue Preset Color) Specifies a color with RGB value (95,158,160) - else if (str == L"chartreuse") { RGB = 0x7FFF00; bSet = true; break; } // (Chartreuse Preset Color) Specifies a color with RGB value (127,255,0) - else if (str == L"chocolate") { RGB = 0xD2691E; bSet = true; break; } // (Chocolate Preset Color) Specifies a color with RGB value (210,105,30) - else if (str == L"coral") { RGB = 0xFF7F50; bSet = true; break; } // (Coral Preset Color) Specifies a color with RGB value (255,127,80) - else if (str == L"cornflowerBlue") { RGB = 0x6495ED; bSet = true; break; } // (Cornflower Blue Preset Color) Specifies a color with RGB value (100,149,237) - else if (str == L"cornsilk") { RGB = 0xFFF8DC; bSet = true; break; } // (Cornsilk Preset Color) Specifies a color with RGB value (255,248,220) - else if (str == L"crimson") { RGB = 0xDC143C; bSet = true; break; } // (Crimson Preset Color) Specifies a color with RGB value (220,20,60) - else if (str == L"cyan") { RGB = 0x00FFFF; bSet = true; break; } // (Cyan Preset Color) Specifies a color with RGB value (0,255,255) - break; - case 'd': - if (str == L"darkBlue") { RGB = 0x00008B; bSet = true; break; } // (Dark Blue Preset Color) Specifies a color with RGB value (0,0,139) - else if (str == L"darkCyan") { RGB = 0x008B8B; bSet = true; break; } // (Dark Cyan Preset Color) Specifies a color with RGB value (0,139,139) - else if (str == L"darkGoldenrod") { RGB = 0xB8860B; bSet = true; break; } // (Dark Goldenrod Preset Color) Specifies a color with RGB value (184,134,11) - else if (str == L"darkGray") { RGB = 0xA9A9A9; bSet = true; break; } // (Dark Gray Preset Color) Specifies a color with RGB value (169,169,169) - else if (str == L"darkGreen") { RGB = 0x006400; bSet = true; break; } // (Dark Green Preset Color) Specifies a color with RGB value (0,100,0) - else if (str == L"darkGrey") { RGB = 0xA9A9A9; bSet = true; break; } // (Dark Gray Preset Color) Specifies a color with RGB value (169,169,169) - else if (str == L"darkKhaki") { RGB = 0xBDB76B; bSet = true; break; } // (Dark Khaki Preset Color) Specifies a color with RGB value (189,183,107) - else if (str == L"darkMagenta") { RGB = 0x8B008B; bSet = true; break; } // (Dark Magenta Preset Color) Specifies a color with RGB value (139,0,139) - else if (str == L"darkOliveGreen") { RGB = 0x556B2F; bSet = true; break; } // (Dark Olive Green Preset Color) Specifies a color with RGB value (85,107,47) - else if (str == L"darkOrange") { RGB = 0xFF8C00; bSet = true; break; } // (Dark Orange Preset Color) Specifies a color with RGB value (255,140,0) - else if (str == L"darkOrchid") { RGB = 0x9932CC; bSet = true; break; } // (Dark Orchid Preset Color) Specifies a color with RGB value (153,50,204) - else if (str == L"darkRed") { RGB = 0x8B0000; bSet = true; break; } // (Dark Red Preset Color) Specifies a color with RGB value (139,0,0) - else if (str == L"darkSalmon") { RGB = 0xE9967A; bSet = true; break; } // (Dark Salmon Preset Color) Specifies a color with RGB value (233,150,122) - else if (str == L"darkSeaGreen") { RGB = 0x8FBC8F; bSet = true; break; } // (Dark Sea Green Preset Color) Specifies a color with RGB value (143,188,143) - else if (str == L"darkSlateBlue") { RGB = 0x483D8B; bSet = true; break; } // (Dark Slate Blue Preset Color) Specifies a color with RGB value (72,61,139) - else if (str == L"darkSlateGray") { RGB = 0x2F4F4F; bSet = true; break; } // (Dark Slate Gray Preset Color) Specifies a color with RGB value (47,79,79) - else if (str == L"darkSlateGrey") { RGB = 0x2F4F4F; bSet = true; break; } // (Dark Slate Gray Preset Color) Specifies a color with RGB value (47,79,79) - else if (str == L"darkTurquoise") { RGB = 0x00CED1; bSet = true; break; } // (Dark Turquoise Preset Color) Specifies a color with RGB value (0,206,209) - else if (str == L"darkViolet") { RGB = 0x9400D3; bSet = true; break; } // (Dark Violet Preset Color) Specifies a color with RGB value (148,0,211) - else if (str == L"deepPink") { RGB = 0xFF1493; bSet = true; break; } // (Deep Pink Preset Color) Specifies a color with RGB value (255,20,147) - else if (str == L"deepSkyBlue") { RGB = 0x00BFFF; bSet = true; break; } // (Deep Sky Blue Preset Color) Specifies a color with RGB value (0,191,255) - else if (str == L"dimGray") { RGB = 0x696969; bSet = true; break; } // (Dim Gray Preset Color) Specifies a color with RGB value (105,105,105) - else if (str == L"dimGrey") { RGB = 0x696969; bSet = true; break; } // (Dim Gray Preset Color) Specifies a color with RGB value (105,105,105) - else if (str == L"dkBlue") { RGB = 0x00008B; bSet = true; break; } // (Dark Blue Preset Color) Specifies a color with RGB value (0,0,139) - else if (str == L"dkCyan") { RGB = 0x008B8B; bSet = true; break; } // (Dark Cyan Preset Color) Specifies a color with RGB value (0,139,139) - else if (str == L"dkGoldenrod") { RGB = 0xB8860B; bSet = true; break; } // (Dark Goldenrod Preset Color) Specifies a color with RGB value (184,134,11) - else if (str == L"dkGray") { RGB = 0xA9A9A9; bSet = true; break; } // (Dark Gray Preset Color) Specifies a color with RGB value (169,169,169) - else if (str == L"dkGreen") { RGB = 0x006400; bSet = true; break; } // (Dark Green Preset Color) Specifies a color with RGB value (0,100,0) - else if (str == L"dkGrey") { RGB = 0xA9A9A9; bSet = true; break; } // (Dark Gray Preset Color) Specifies a color with RGB value (169,169,169) - else if (str == L"dkKhaki") { RGB = 0xBDB76B; bSet = true; break; } // (Dark Khaki Preset Color) Specifies a color with RGB value (189,183,107) - else if (str == L"dkMagenta") { RGB = 0x8B008B; bSet = true; break; } // (Dark Magenta Preset Color) Specifies a color with RGB value (139,0,139) - else if (str == L"dkOliveGreen") { RGB = 0x556B2F; bSet = true; break; } // (Dark Olive Green Preset Color) Specifies a color with RGB value (85,107,47) - else if (str == L"dkOrange") { RGB = 0xFF8C00; bSet = true; break; } // (Dark Orange Preset Color) Specifies a color with RGB value (255,140,0) - else if (str == L"dkOrchid") { RGB = 0x9932CC; bSet = true; break; } // (Dark Orchid Preset Color) Specifies a color with RGB value (153,50,204) - else if (str == L"dkRed") { RGB = 0x8B0000; bSet = true; break; } // (Dark Red Preset Color) Specifies a color with RGB value (139,0,0) - else if (str == L"dkSalmon") { RGB = 0xE9967A; bSet = true; break; } // (Dark Salmon Preset Color) Specifies a color with RGB value (233,150,122) - else if (str == L"dkSeaGreen") { RGB = 0x8FBC8B; bSet = true; break; } // (Dark Sea Green Preset Color) Specifies a color with RGB value (143,188,139) - else if (str == L"dkSlateBlue") { RGB = 0x483D8B; bSet = true; break; } // (Dark Slate Blue Preset Color) Specifies a color with RGB value (72,61,139) - else if (str == L"dkSlateGray") { RGB = 0x2F4F4F; bSet = true; break; } // (Dark Slate Gray Preset Color) Specifies a color with RGB value (47,79,79) - else if (str == L"dkSlateGrey") { RGB = 0x2F4F4F; bSet = true; break; } // (Dark Slate Gray Preset Color) Specifies a color with RGB value (47,79,79) - else if (str == L"dkTurquoise") { RGB = 0x00CED1; bSet = true; break; } // (Dark Turquoise Preset Color) Specifies a color with RGB value (0,206,209) - else if (str == L"dkViolet") { RGB = 0x9400D3; bSet = true; break; } // (Dark Violet Preset Color) Specifies a color with RGB value (148,0,211) - else if (str == L"dodgerBlue") { RGB = 0x1E90FF; bSet = true; break; } // (Dodger Blue Preset Color) Specifies a color with RGB value (30,144,255) - break; - case 'f': - if (str == L"firebrick") { RGB = 0xB22222; bSet = true; break; } // (Firebrick Preset Color) Specifies a color with RGB value (178,34,34) - else if (str == L"floralWhite") { RGB = 0xFFFAF0; bSet = true; break; } // (Floral White Preset Color) Specifies a color with RGB value (255,250,240) - else if (str == L"forestGreen") { RGB = 0x228B22; bSet = true; break; } // (Forest Green Preset Color) Specifies a color with RGB value (34,139,34) - else if (str == L"fuchsia") { RGB = 0xFF00FF; bSet = true; break; } // (Fuchsia Preset Color) Specifies a color with RGB value (255,0,255) - break; - case 'g': - if (str == L"gainsboro") { RGB = 0xDCDCDC; bSet = true; break; } // (Gainsboro Preset Color) Specifies a color with RGB value (220,220,220) - else if (str == L"ghostWhite") { RGB = 0xF8F8FF; bSet = true; break; } // (Ghost White Preset Color) Specifies a color with RGB value (248,248,255) - else if (str == L"gold") { RGB = 0xFFD700; bSet = true; break; } // (Gold Preset Color) Specifies a color with RGB value (255,215,0) - else if (str == L"goldenrod") { RGB = 0xDAA520; bSet = true; break; } // (Goldenrod Preset Color) Specifies a color with RGB value (218,165,32) - else if (str == L"gray") { RGB = 0x808080; bSet = true; break; } // (Gray Preset Color) Specifies a color with RGB value (128,128,128) - else if (str == L"green") { RGB = 0x008000; bSet = true; break; } // (Green Preset Color) Specifies a color with RGB value (0,128,0) - else if (str == L"greenYellow") { RGB = 0xADFF2F; bSet = true; break; } // (Green Yellow Preset Color) Specifies a color with RGB value (173,255,47) - else if (str == L"grey") { RGB = 0x808080; bSet = true; break; } // (Gray Preset Color) Specifies a color with RGB value (128,128,128) - break; - case 'h': - if (str == L"honeydew") { RGB = 0xF0FFF0; bSet = true; break; } // (Honeydew Preset Color) Specifies a color with RGB value (240,255,240) - else if (str == L"hotPink") { RGB = 0xFF69B4; bSet = true; break; } // (Hot Pink Preset Color) Specifies a color with RGB value (255,105,180) - break; - case 'i': - if (str == L"indianRed") { RGB = 0xCD5C5C; bSet = true; break; } // (Indian Red Preset Color) Specifies a color with RGB value (205,92,92) - else if (str == L"indigo") { RGB = 0x4B0082; bSet = true; break; } // (Indigo Preset Color) Specifies a color with RGB value (75,0,130) - else if (str == L"ivory") { RGB = 0xFFFFF0; bSet = true; break; } // (Ivory Preset Color) Specifies a color with RGB value (255,255,240) - else if (str == L"infoText") { RGB = 0x000000; bSet = true; break; } - break; - case 'k': - if (str == L"khaki") { RGB = 0xF0E68C; bSet = true; break; } // (Khaki Preset Color) Specifies a color with RGB value (240,230,140) - break; - case 'l': - if (str == L"lavender") { RGB = 0xE6E6FA; bSet = true; break; } // (Lavender Preset Color) Specifies a color with RGB value (230,230,250) - else if (str == L"lavenderBlush") { RGB = 0xFFF0F5; bSet = true; break; } // (Lavender Blush Preset Color) Specifies a color with RGB value (255,240,245) - else if (str == L"lawnGreen") { RGB = 0x7CFC00; bSet = true; break; } // (Lawn Green Preset Color) Specifies a color with RGB value (124,252,0) - else if (str == L"lemonChiffon") { RGB = 0xFFFACD; bSet = true; break; } // (Lemon Chiffon Preset Color) Specifies a color with RGB value (255,250,205) - else if (str == L"lightBlue") { RGB = 0xADD8E6; bSet = true; break; } // (Light Blue Preset Color) Specifies a color with RGB value (173,216,230) - else if (str == L"lightCoral") { RGB = 0xF08080; bSet = true; break; } // (Light Coral Preset Color) Specifies a color with RGB value (240,128,128) - else if (str == L"lightCyan") { RGB = 0xE0FFFF; bSet = true; break; } // (Light Cyan Preset Color) Specifies a color with RGB value (224,255,255) - else if (str == L"lightGoldenrodYellow") { RGB = 0xFAFAD2; bSet = true; break; } // (Light Goldenrod Color) Specifies a color with RGB value (250,250,210) - else if (str == L"lightGray") { RGB = 0xD3D3D3; bSet = true; break; } // (Light Gray Preset Color) Specifies a color with RGB value (211,211,211) - else if (str == L"lightGreen") { RGB = 0x90EE90; bSet = true; break; } // (Light Green Preset Color) Specifies a color with RGB value (144,238,144) - else if (str == L"lightGrey") { RGB = 0xD3D3D3; bSet = true; break; } // (Light Gray Preset Color) Specifies a color with RGB value (211,211,211) - else if (str == L"lightPink") { RGB = 0xFFB6C1; bSet = true; break; } // (Light Pink Preset Color) Specifies a color with RGB value (255,182,193) - else if (str == L"lightSalmon") { RGB = 0xFFA07A; bSet = true; break; } // (Light Salmon Preset Color) Specifies a color with RGB value (255,160,122) - else if (str == L"lightSeaGreen") { RGB = 0x20B2AA; bSet = true; break; } // (Light Sea Green Preset Color) Specifies a color with RGB value (32,178,170) - else if (str == L"lightSkyBlue") { RGB = 0x87CEFA; bSet = true; break; } // (Light Sky Blue Preset Color) Specifies a color with RGB value (135,206,250) - else if (str == L"lightSlateGray") { RGB = 0x778899; bSet = true; break; } // (Light Slate Gray Preset Color) Specifies a color with RGB value (119,136,153) - else if (str == L"lightSlateGrey") { RGB = 0x778899; bSet = true; break; } // (Light Slate Gray Preset Color) Specifies a color with RGB value (119,136,153) - else if (str == L"lightSteelBlue") { RGB = 0xB0C4DE; bSet = true; break; } // (Light Steel Blue Preset Color) Specifies a color with RGB value (176,196,222) - else if (str == L"lightYellow") { RGB = 0xFFFFE0; bSet = true; break; } // (Light Yellow Preset Color) Specifies a color with RGB value (255,255,224) - else if (str == L"lime") { RGB = 0x00FF00; bSet = true; break; } // (Lime Preset Color) Specifies a color with RGB value (0,255,0) - else if (str == L"limeGreen") { RGB = 0x32CD32; bSet = true; break; } // (Lime Green Preset Color) Specifies a color with RGB value (50,205,50) - else if (str == L"linen") { RGB = 0xFAF0E6; bSet = true; break; } // (Linen Preset Color) Specifies a color with RGB value (250,240,230) - else if (str == L"ltBlue") { RGB = 0xADD8E6; bSet = true; break; } // (Light Blue Preset Color) Specifies a color with RGB value (173,216,230) - else if (str == L"ltCoral") { RGB = 0xF08080; bSet = true; break; } // (Light Coral Preset Color) Specifies a color with RGB value (240,128,128) - else if (str == L"ltCyan") { RGB = 0xE0FFFF; bSet = true; break; } // (Light Cyan Preset Color) Specifies a color with RGB value (224,255,255) - else if (str == L"ltGoldenrodYellow") { RGB = 0xFAFA78; bSet = true; break; } // (Light Goldenrod Color) Specifies a color with RGB value (250,250,120) - else if (str == L"ltGray") { RGB = 0xD3D3D3; bSet = true; break; } // (Light Gray Preset Color) Specifies a color with RGB value (211,211,211) - else if (str == L"ltGreen") { RGB = 0x90EE90; bSet = true; break; } // (Light Green Preset Color) Specifies a color with RGB value (144,238,144) - else if (str == L"ltGrey") { RGB = 0xD3D3D3; bSet = true; break; } // (Light Gray Preset Color) Specifies a color with RGB value (211,211,211) - else if (str == L"ltPink") { RGB = 0xFFB6C1; bSet = true; break; } // (Light Pink Preset Color) Specifies a color with RGB value (255,182,193) - else if (str == L"ltSalmon") { RGB = 0xFFA07A; bSet = true; break; } // (Light Salmon Preset Color) Specifies a color with RGB value (255,160,122) - else if (str == L"ltSeaGreen") { RGB = 0x20B2AA; bSet = true; break; } // (Light Sea Green Preset Color) Specifies a color with RGB value (32,178,170) - else if (str == L"ltSkyBlue") { RGB = 0x87CEFA; bSet = true; break; } // (Light Sky Blue Preset Color) Specifies a color with RGB value (135,206,250) - else if (str == L"ltSlateGray") { RGB = 0x778899; bSet = true; break; } // (Light Slate Gray Preset Color) Specifies a color with RGB value (119,136,153) - else if (str == L"ltSlateGrey") { RGB = 0x778899; bSet = true; break; } // (Light Slate Gray Preset Color) Specifies a color with RGB value (119,136,153) - else if (str == L"ltSteelBlue") { RGB = 0xB0C4DE; bSet = true; break; } // (Light Steel Blue Preset Color) Specifies a color with RGB value (176,196,222) - else if (str == L"ltYellow") { RGB = 0xFFFFE0; bSet = true; break; } // (Light Yellow Preset Color) Specifies a color with RGB value (255,255,224) - break; - case 'm': - if (str == L"magenta") { RGB = 0xFF00FF; bSet = true; break; } // (Magenta Preset Color) Specifies a color with RGB value (255,0,255) - else if (str == L"maroon") { RGB = 0x800000; bSet = true; break; } // (Maroon Preset Color) Specifies a color with RGB value (128,0,0) - else if (str == L"medAquamarine") { RGB = 0x66CDAA; bSet = true; break; } // (Medium Aquamarine Preset Color)Specifies a color with RGB value (102,205,170) - else if (str == L"medBlue") { RGB = 0x0000CD; bSet = true; break; } // (Medium Blue Preset Color) Specifies a color with RGB value (0,0,205) - else if (str == L"mediumAquamarine") { RGB = 0x66CDAA; bSet = true; break; } // (Medium Aquamarine Color) Specifies a color with RGB value (102,205,170) - else if (str == L"mediumBlue") { RGB = 0x0000CD; bSet = true; break; } // (Medium Blue Preset Color) Specifies a color with RGB value (0,0,205) - else if (str == L"mediumOrchid") { RGB = 0xBA55D3; bSet = true; break; } // (Medium Orchid Preset Color) Specifies a color with RGB value (186,85,211) - else if (str == L"mediumPurple") { RGB = 0x9370DB; bSet = true; break; } // (Medium Purple Preset Color) Specifies a color with RGB value (147,112,219) - else if (str == L"mediumSeaGreen") { RGB = 0x3CB371; bSet = true; break; } // (Medium Sea Green Preset Color) Specifies a color with RGB value (60,179,113) - else if (str == L"mediumSlateBlue") { RGB = 0x7B68EE; bSet = true; break; } // (Medium Slate Blue Preset Color)Specifies a color with RGB value (123,104,238) - else if (str == L"mediumSpringGreen") { RGB = 0x00FA9A; bSet = true; break; } // (Medium Spring Color) Specifies a color with RGB value (0,250,154) - else if (str == L"mediumTurquoise") { RGB = 0x48D1CC; bSet = true; break; } // (Medium Turquoise Preset Color) Specifies a color with RGB value (72,209,204) - else if (str == L"mediumVioletRed") { RGB = 0xC71585; bSet = true; break; } // (Medium Violet Red Preset Color)Specifies a color with RGB value (199,21,133) - else if (str == L"medOrchid") { RGB = 0xBA55D3; bSet = true; break; } // (Medium Orchid Preset Color) Specifies a color with RGB value (186,85,211) - else if (str == L"medPurple") { RGB = 0x9370DB; bSet = true; break; } // (Medium Purple Preset Color) Specifies a color with RGB value (147,112,219) - else if (str == L"medSeaGreen") { RGB = 0x3CB371; bSet = true; break; } // (Medium Sea Green Preset Color) Specifies a color with RGB value (60,179,113) - else if (str == L"medSlateBlue") { RGB = 0x7B68EE; bSet = true; break; } // (Medium Slate Blue Preset Color)Specifies a color with RGB value (123,104,238) - else if (str == L"medSpringGreen") { RGB = 0x00FA9A; bSet = true; break; } // (Medium Spring Preset Color) Specifies a color with RGB value (0,250,154) - else if (str == L"medTurquoise") { RGB = 0x48D1CC; bSet = true; break; } // (Medium Turquoise Preset Color) Specifies a color with RGB value (72,209,204) - else if (str == L"medVioletRed") { RGB = 0xC71585; bSet = true; break; } // (Medium Violet Red Preset Color)Specifies a color with RGB value (199,21,133) - else if (str == L"midnightBlue") { RGB = 0x191970; bSet = true; break; } // (Midnight Blue Preset Color) Specifies a color with RGB value (25,25,112) - else if (str == L"mintCream") { RGB = 0xF5FFFA; bSet = true; break; } // (Mint Cream Preset Color) Specifies a color with RGB value (245,255,250) - else if (str == L"mistyRose") { RGB = 0xFFE4FF; bSet = true; break; } // (Misty Rose Preset Color) Specifies a color with RGB value (255,228,225) - else if (str == L"moccasin") { RGB = 0xFFE4B5; bSet = true; break; } // (Moccasin Preset Color) Specifies a color with RGB value (255,228,181) - else if (str == L"menuText") { RGB = 0x000000; bSet = true; break; } - break; - case 'n': - if (str == L"navajoWhite") { RGB = 0xFFDEAD; bSet = true; break; } // (Navajo White Preset Color) Specifies a color with RGB value (255,222,173) - else if (str == L"navy") { RGB = 0x000080; bSet = true; break; } // (Navy Preset Color) Specifies a color with RGB value (0,0,128) - break; - case 'o': - if (str == L"oldLace") { RGB = 0xFDF5E6; bSet = true; break; } // (Old Lace Preset Color) Specifies a color with RGB value (253,245,230) - else if (str == L"olive") { RGB = 0x808000; bSet = true; break; } // (Olive Preset Color) Specifies a color with RGB value (128,128,0) - else if (str == L"oliveDrab") { RGB = 0x6B8E23; bSet = true; break; } // (Olive Drab Preset Color) Specifies a color with RGB value (107,142,35) - else if (str == L"orange") { RGB = 0xFFA500; bSet = true; break; } // (Orange Preset Color) Specifies a color with RGB value (255,165,0) - else if (str == L"orangeRed") { RGB = 0xFF4500; bSet = true; break; } // (Orange Red Preset Color) Specifies a color with RGB value (255,69,0) - else if (str == L"orchid") { RGB = 0xDA70D6; bSet = true; break; } // (Orchid Preset Color) Specifies a color with RGB value (218,112,214) - break; - case 'p': - if (str == L"paleGoldenrod") { RGB = 0xEEE8AA; bSet = true; break; } // (Pale Goldenrod Preset Color) Specifies a color with RGB value (238,232,170) - else if (str == L"paleGreen") { RGB = 0x98FB98; bSet = true; break; } // (Pale Green Preset Color) Specifies a color with RGB value (152,251,152) - else if (str == L"paleTurquoise") { RGB = 0xAFEEEE; bSet = true; break; } // (Pale Turquoise Preset Color) Specifies a color with RGB value (175,238,238) - else if (str == L"paleVioletRed") { RGB = 0xDB7093; bSet = true; break; } // (Pale Violet Red Preset Color) Specifies a color with RGB value (219,112,147) - else if (str == L"papayaWhip") { RGB = 0xFFEFD5; bSet = true; break; } // (Papaya Whip Preset Color) Specifies a color with RGB value (255,239,213) - else if (str == L"peachPuff") { RGB = 0xFFDAB9; bSet = true; break; } // (Peach Puff Preset Color) Specifies a color with RGB value (255,218,185) - else if (str == L"peru") { RGB = 0xCD853F; bSet = true; break; } // (Peru Preset Color) Specifies a color with RGB value (205,133,63) - else if (str == L"pink") { RGB = 0xFFC0CB; bSet = true; break; } // (Pink Preset Color) Specifies a color with RGB value (255,192,203) - else if (str == L"plum") { RGB = 0xD3A0D3; bSet = true; break; } // (Plum Preset Color) Specifies a color with RGB value (221,160,221) - else if (str == L"powderBlue") { RGB = 0xB0E0E6; bSet = true; break; } // (Powder Blue Preset Color) Specifies a color with RGB value (176,224,230) - else if (str == L"purple") { RGB = 0x800080; bSet = true; break; } // (Purple Preset Color) Specifies a color with RGB value (128,0,128) - break; - case 'r': - if (str == L"red") { RGB = 0xFF0000; bSet = true; break; } // (Red Preset Color) Specifies a color with RGB value (255,0,0) - else if (str == L"rosyBrown") { RGB = 0xBC8F8F; bSet = true; break; } // (Rosy Brown Preset Color) Specifies a color with RGB value (188,143,143) - else if (str == L"royalBlue") { RGB = 0x4169E1; bSet = true; break; } // (Royal Blue Preset Color) Specifies a color with RGB value (65,105,225) - break; - case 's': - if (str == L"saddleBrown") { RGB = 0x8B4513; bSet = true; break; } // (Saddle Brown Preset Color) Specifies a color with RGB value (139,69,19) - else if (str == L"salmon") { RGB = 0xFA8072; bSet = true; break; } // (Salmon Preset Color) Specifies a color with RGB value (250,128,114) - else if (str == L"sandyBrown") { RGB = 0xF4A460; bSet = true; break; } // (Sandy Brown Preset Color) Specifies a color with RGB value (244,164,96) - else if (str == L"seaGreen") { RGB = 0x2E8B57; bSet = true; break; } // (Sea Green Preset Color) Specifies a color with RGB value (46,139,87) - else if (str == L"seaShell") { RGB = 0xFFF5EE; bSet = true; break; } // (Sea Shell Preset Color) Specifies a color with RGB value (255,245,238) - else if (str == L"sienna") { RGB = 0xA0522D; bSet = true; break; } // (Sienna Preset Color) Specifies a color with RGB value (160,82,45) - else if (str == L"silver") { RGB = 0xC0C0C0; bSet = true; break; } // (Silver Preset Color) Specifies a color with RGB value (192,192,192) - else if (str == L"skyBlue") { RGB = 0x87CEEB; bSet = true; break; } // (Sky Blue Preset Color) Specifies a color with RGB value (135,206,235) - else if (str == L"slateBlue") { RGB = 0x6A5AEB; bSet = true; break; } // (Slate Blue Preset Color) Specifies a color with RGB value (106,90,205) - else if (str == L"slateGray") { RGB = 0x708090; bSet = true; break; } // (Slate Gray Preset Color) Specifies a color with RGB value (112,128,144) - else if (str == L"slateGrey") { RGB = 0x708090; bSet = true; break; } // (Slate Gray Preset Color) Specifies a color with RGB value (112,128,144) - else if (str == L"snow") { RGB = 0xFFFAFA; bSet = true; break; } // (Snow Preset Color) Specifies a color with RGB value (255,250,250) - else if (str == L"springGreen") { RGB = 0x00FF7F; bSet = true; break; } // (Spring Green Preset Color) Specifies a color with RGB value (0,255,127) - else if (str == L"steelBlue") { RGB = 0x4682B4; bSet = true; break; } // (Steel Blue Preset Color) Specifies a color with RGB value (70,130,180) - break; - case 't': - if (str == L"tan") { RGB = 0xD2B48C; bSet = true; break; } // (Tan Preset Color) Specifies a color with RGB value (210,180,140) - else if (str == L"teal") { RGB = 0x008080; bSet = true; break; } // (Teal Preset Color) Specifies a color with RGB value (0,128,128) - else if (str == L"thistle") { RGB = 0xD8BFD8; bSet = true; break; } // (Thistle Preset Color) Specifies a color with RGB value (216,191,216) - else if (str == L"tomato") { RGB = 0xFF7347; bSet = true; break; } // (Tomato Preset Color) Specifies a color with RGB value (255,99,71) - else if (str == L"turquoise") { RGB = 0x40E0D0; bSet = true; break; } // (Turquoise Preset Color) Specifies a color with RGB value (64,224,208) - break; - case 'v': - if (str == L"violet") { RGB = 0xEE82EE; bSet = true; break; } // (Violet Preset Color) Specifies a color with RGB value (238,130,238) - break; - case 'w': - if (str == L"wheat") { RGB = 0xF5DEB3; bSet = true; break; } // (Wheat Preset Color) Specifies a color with RGB value (245,222,179) - else if (str == L"white") { RGB = 0xFFFFFF; bSet = true; break; } // (White Preset Color) Specifies a color with RGB value (255,255,255) - else if (str == L"whiteSmoke") { RGB = 0xF5F5F5; bSet = true; break; } // (White Smoke Preset Color) Specifies a color with RGB value (245,245,245) - else if (str == L"windowsText") { RGB = 0x000000; bSet = true; break; } // (White Smoke Preset Color) Specifies a color with RGB value (245,245,245) - break; - case 'y': - if (str == L"yellow") { RGB = 0xFFFF00; bSet = true; break; } // (Yellow Preset Color) Specifies a color with RGB value (255,255,0) - else if (str == L"yellowGreen") { RGB = 0x9ACD32; bSet = true; break; } // (Yellow Green Preset Color) Specifies a color with RGB value (154,205,50) - break; - } - } - if (bSet) - { - color.R = (BYTE)(RGB >> 16); - color.G = (BYTE)(RGB >> 8); - color.B = (BYTE)(RGB); - color.A = 0; + case 'a': + if (str == L"aliceBlue") { RGB = 0xF0F8FF; bSet = true; break; } // (Alice Blue Preset Color) Specifies a color with RGB value (240,248,255) + else if (str == L"antiqueWhite") { RGB = 0xFAEBD7; bSet = true; break; } // (Antique White Preset Color) Specifies a color with RGB value (250,235,215) + else if (str == L"aqua") { RGB = 0x00FFFF; bSet = true; break; } // (Aqua Preset Color) Specifies a color with RGB value (0,255,255) + else if (str == L"aquamarine") { RGB = 0x7FFFD4; bSet = true; break; } // (Aquamarine Preset Color) Specifies a color with RGB value (127,255,212) + else if (str == L"azure") { RGB = 0xF0FFFF; bSet = true; break; } // (Azure Preset Color) Specifies a color with RGB value (240,255,255) + break; + case 'b': + if (str == L"beige") { RGB = 0xF5F5DC; bSet = true; break; } // (Beige Preset Color) Specifies a color with RGB value (245,245,220) + else if (str == L"bisque") { RGB = 0xFFE4C4; bSet = true; break; } // (Bisque Preset Color) Specifies a color with RGB value (255,228,196) + else if (str == L"black") { RGB = 0x000000; bSet = true; break; } // (Black Preset Color) Specifies a color with RGB value (0,0,0) + else if (str == L"blanchedAlmond") { RGB = 0xFFEBCD; bSet = true; break; } // (Blanched Almond Preset Color) Specifies a color with RGB value (255,235,205) + else if (str == L"blue") { RGB = 0x0000FF; bSet = true; break; } // (Blue Preset Color) Specifies a color with RGB value (0,0,255) + else if (str == L"blueViolet") { RGB = 0x8A2BE2; bSet = true; break; } // (Blue Violet Preset Color) Specifies a color with RGB value (138,43,226) + else if (str == L"brown") { RGB = 0xA52A2A; bSet = true; break; } // (Brown Preset Color) Specifies a color with RGB value (165,42,42) + else if (str == L"burlyWood") { RGB = 0xDEB887; bSet = true; break; } // (Burly Wood Preset Color) Specifies a color with RGB value (222,184,135) + else if (str == L"buttonFace") { RGB = 0xF0F0F0; bSet = true; break; } + else if (str == L"buttonText") { RGB = 0x000000; bSet = true; break; } + break; + case 'c': + if (str == L"cadetBlue") { RGB = 0x5F9EA0; bSet = true; break; } // (Cadet Blue Preset Color) Specifies a color with RGB value (95,158,160) + else if (str == L"chartreuse") { RGB = 0x7FFF00; bSet = true; break; } // (Chartreuse Preset Color) Specifies a color with RGB value (127,255,0) + else if (str == L"chocolate") { RGB = 0xD2691E; bSet = true; break; } // (Chocolate Preset Color) Specifies a color with RGB value (210,105,30) + else if (str == L"coral") { RGB = 0xFF7F50; bSet = true; break; } // (Coral Preset Color) Specifies a color with RGB value (255,127,80) + else if (str == L"cornflowerBlue") { RGB = 0x6495ED; bSet = true; break; } // (Cornflower Blue Preset Color) Specifies a color with RGB value (100,149,237) + else if (str == L"cornsilk") { RGB = 0xFFF8DC; bSet = true; break; } // (Cornsilk Preset Color) Specifies a color with RGB value (255,248,220) + else if (str == L"crimson") { RGB = 0xDC143C; bSet = true; break; } // (Crimson Preset Color) Specifies a color with RGB value (220,20,60) + else if (str == L"cyan") { RGB = 0x00FFFF; bSet = true; break; } // (Cyan Preset Color) Specifies a color with RGB value (0,255,255) + break; + case 'd': + if (str == L"darkBlue") { RGB = 0x00008B; bSet = true; break; } // (Dark Blue Preset Color) Specifies a color with RGB value (0,0,139) + else if (str == L"darkCyan") { RGB = 0x008B8B; bSet = true; break; } // (Dark Cyan Preset Color) Specifies a color with RGB value (0,139,139) + else if (str == L"darkGoldenrod") { RGB = 0xB8860B; bSet = true; break; } // (Dark Goldenrod Preset Color) Specifies a color with RGB value (184,134,11) + else if (str == L"darkGray") { RGB = 0xA9A9A9; bSet = true; break; } // (Dark Gray Preset Color) Specifies a color with RGB value (169,169,169) + else if (str == L"darkGreen") { RGB = 0x006400; bSet = true; break; } // (Dark Green Preset Color) Specifies a color with RGB value (0,100,0) + else if (str == L"darkGrey") { RGB = 0xA9A9A9; bSet = true; break; } // (Dark Gray Preset Color) Specifies a color with RGB value (169,169,169) + else if (str == L"darkKhaki") { RGB = 0xBDB76B; bSet = true; break; } // (Dark Khaki Preset Color) Specifies a color with RGB value (189,183,107) + else if (str == L"darkMagenta") { RGB = 0x8B008B; bSet = true; break; } // (Dark Magenta Preset Color) Specifies a color with RGB value (139,0,139) + else if (str == L"darkOliveGreen") { RGB = 0x556B2F; bSet = true; break; } // (Dark Olive Green Preset Color) Specifies a color with RGB value (85,107,47) + else if (str == L"darkOrange") { RGB = 0xFF8C00; bSet = true; break; } // (Dark Orange Preset Color) Specifies a color with RGB value (255,140,0) + else if (str == L"darkOrchid") { RGB = 0x9932CC; bSet = true; break; } // (Dark Orchid Preset Color) Specifies a color with RGB value (153,50,204) + else if (str == L"darkRed") { RGB = 0x8B0000; bSet = true; break; } // (Dark Red Preset Color) Specifies a color with RGB value (139,0,0) + else if (str == L"darkSalmon") { RGB = 0xE9967A; bSet = true; break; } // (Dark Salmon Preset Color) Specifies a color with RGB value (233,150,122) + else if (str == L"darkSeaGreen") { RGB = 0x8FBC8F; bSet = true; break; } // (Dark Sea Green Preset Color) Specifies a color with RGB value (143,188,143) + else if (str == L"darkSlateBlue") { RGB = 0x483D8B; bSet = true; break; } // (Dark Slate Blue Preset Color) Specifies a color with RGB value (72,61,139) + else if (str == L"darkSlateGray") { RGB = 0x2F4F4F; bSet = true; break; } // (Dark Slate Gray Preset Color) Specifies a color with RGB value (47,79,79) + else if (str == L"darkSlateGrey") { RGB = 0x2F4F4F; bSet = true; break; } // (Dark Slate Gray Preset Color) Specifies a color with RGB value (47,79,79) + else if (str == L"darkTurquoise") { RGB = 0x00CED1; bSet = true; break; } // (Dark Turquoise Preset Color) Specifies a color with RGB value (0,206,209) + else if (str == L"darkViolet") { RGB = 0x9400D3; bSet = true; break; } // (Dark Violet Preset Color) Specifies a color with RGB value (148,0,211) + else if (str == L"deepPink") { RGB = 0xFF1493; bSet = true; break; } // (Deep Pink Preset Color) Specifies a color with RGB value (255,20,147) + else if (str == L"deepSkyBlue") { RGB = 0x00BFFF; bSet = true; break; } // (Deep Sky Blue Preset Color) Specifies a color with RGB value (0,191,255) + else if (str == L"dimGray") { RGB = 0x696969; bSet = true; break; } // (Dim Gray Preset Color) Specifies a color with RGB value (105,105,105) + else if (str == L"dimGrey") { RGB = 0x696969; bSet = true; break; } // (Dim Gray Preset Color) Specifies a color with RGB value (105,105,105) + else if (str == L"dkBlue") { RGB = 0x00008B; bSet = true; break; } // (Dark Blue Preset Color) Specifies a color with RGB value (0,0,139) + else if (str == L"dkCyan") { RGB = 0x008B8B; bSet = true; break; } // (Dark Cyan Preset Color) Specifies a color with RGB value (0,139,139) + else if (str == L"dkGoldenrod") { RGB = 0xB8860B; bSet = true; break; } // (Dark Goldenrod Preset Color) Specifies a color with RGB value (184,134,11) + else if (str == L"dkGray") { RGB = 0xA9A9A9; bSet = true; break; } // (Dark Gray Preset Color) Specifies a color with RGB value (169,169,169) + else if (str == L"dkGreen") { RGB = 0x006400; bSet = true; break; } // (Dark Green Preset Color) Specifies a color with RGB value (0,100,0) + else if (str == L"dkGrey") { RGB = 0xA9A9A9; bSet = true; break; } // (Dark Gray Preset Color) Specifies a color with RGB value (169,169,169) + else if (str == L"dkKhaki") { RGB = 0xBDB76B; bSet = true; break; } // (Dark Khaki Preset Color) Specifies a color with RGB value (189,183,107) + else if (str == L"dkMagenta") { RGB = 0x8B008B; bSet = true; break; } // (Dark Magenta Preset Color) Specifies a color with RGB value (139,0,139) + else if (str == L"dkOliveGreen") { RGB = 0x556B2F; bSet = true; break; } // (Dark Olive Green Preset Color) Specifies a color with RGB value (85,107,47) + else if (str == L"dkOrange") { RGB = 0xFF8C00; bSet = true; break; } // (Dark Orange Preset Color) Specifies a color with RGB value (255,140,0) + else if (str == L"dkOrchid") { RGB = 0x9932CC; bSet = true; break; } // (Dark Orchid Preset Color) Specifies a color with RGB value (153,50,204) + else if (str == L"dkRed") { RGB = 0x8B0000; bSet = true; break; } // (Dark Red Preset Color) Specifies a color with RGB value (139,0,0) + else if (str == L"dkSalmon") { RGB = 0xE9967A; bSet = true; break; } // (Dark Salmon Preset Color) Specifies a color with RGB value (233,150,122) + else if (str == L"dkSeaGreen") { RGB = 0x8FBC8B; bSet = true; break; } // (Dark Sea Green Preset Color) Specifies a color with RGB value (143,188,139) + else if (str == L"dkSlateBlue") { RGB = 0x483D8B; bSet = true; break; } // (Dark Slate Blue Preset Color) Specifies a color with RGB value (72,61,139) + else if (str == L"dkSlateGray") { RGB = 0x2F4F4F; bSet = true; break; } // (Dark Slate Gray Preset Color) Specifies a color with RGB value (47,79,79) + else if (str == L"dkSlateGrey") { RGB = 0x2F4F4F; bSet = true; break; } // (Dark Slate Gray Preset Color) Specifies a color with RGB value (47,79,79) + else if (str == L"dkTurquoise") { RGB = 0x00CED1; bSet = true; break; } // (Dark Turquoise Preset Color) Specifies a color with RGB value (0,206,209) + else if (str == L"dkViolet") { RGB = 0x9400D3; bSet = true; break; } // (Dark Violet Preset Color) Specifies a color with RGB value (148,0,211) + else if (str == L"dodgerBlue") { RGB = 0x1E90FF; bSet = true; break; } // (Dodger Blue Preset Color) Specifies a color with RGB value (30,144,255) + break; + case 'f': + if (str == L"firebrick") { RGB = 0xB22222; bSet = true; break; } // (Firebrick Preset Color) Specifies a color with RGB value (178,34,34) + else if (str == L"floralWhite") { RGB = 0xFFFAF0; bSet = true; break; } // (Floral White Preset Color) Specifies a color with RGB value (255,250,240) + else if (str == L"forestGreen") { RGB = 0x228B22; bSet = true; break; } // (Forest Green Preset Color) Specifies a color with RGB value (34,139,34) + else if (str == L"fuchsia") { RGB = 0xFF00FF; bSet = true; break; } // (Fuchsia Preset Color) Specifies a color with RGB value (255,0,255) + break; + case 'g': + if (str == L"gainsboro") { RGB = 0xDCDCDC; bSet = true; break; } // (Gainsboro Preset Color) Specifies a color with RGB value (220,220,220) + else if (str == L"ghostWhite") { RGB = 0xF8F8FF; bSet = true; break; } // (Ghost White Preset Color) Specifies a color with RGB value (248,248,255) + else if (str == L"gold") { RGB = 0xFFD700; bSet = true; break; } // (Gold Preset Color) Specifies a color with RGB value (255,215,0) + else if (str == L"goldenrod") { RGB = 0xDAA520; bSet = true; break; } // (Goldenrod Preset Color) Specifies a color with RGB value (218,165,32) + else if (str == L"gray") { RGB = 0x808080; bSet = true; break; } // (Gray Preset Color) Specifies a color with RGB value (128,128,128) + else if (str == L"green") { RGB = 0x008000; bSet = true; break; } // (Green Preset Color) Specifies a color with RGB value (0,128,0) + else if (str == L"greenYellow") { RGB = 0xADFF2F; bSet = true; break; } // (Green Yellow Preset Color) Specifies a color with RGB value (173,255,47) + else if (str == L"grey") { RGB = 0x808080; bSet = true; break; } // (Gray Preset Color) Specifies a color with RGB value (128,128,128) + break; + case 'h': + if (str == L"honeydew") { RGB = 0xF0FFF0; bSet = true; break; } // (Honeydew Preset Color) Specifies a color with RGB value (240,255,240) + else if (str == L"hotPink") { RGB = 0xFF69B4; bSet = true; break; } // (Hot Pink Preset Color) Specifies a color with RGB value (255,105,180) + break; + case 'i': + if (str == L"indianRed") { RGB = 0xCD5C5C; bSet = true; break; } // (Indian Red Preset Color) Specifies a color with RGB value (205,92,92) + else if (str == L"indigo") { RGB = 0x4B0082; bSet = true; break; } // (Indigo Preset Color) Specifies a color with RGB value (75,0,130) + else if (str == L"ivory") { RGB = 0xFFFFF0; bSet = true; break; } // (Ivory Preset Color) Specifies a color with RGB value (255,255,240) + else if (str == L"infoText") { RGB = 0x000000; bSet = true; break; } + break; + case 'k': + if (str == L"khaki") { RGB = 0xF0E68C; bSet = true; break; } // (Khaki Preset Color) Specifies a color with RGB value (240,230,140) + break; + case 'l': + if (str == L"lavender") { RGB = 0xE6E6FA; bSet = true; break; } // (Lavender Preset Color) Specifies a color with RGB value (230,230,250) + else if (str == L"lavenderBlush") { RGB = 0xFFF0F5; bSet = true; break; } // (Lavender Blush Preset Color) Specifies a color with RGB value (255,240,245) + else if (str == L"lawnGreen") { RGB = 0x7CFC00; bSet = true; break; } // (Lawn Green Preset Color) Specifies a color with RGB value (124,252,0) + else if (str == L"lemonChiffon") { RGB = 0xFFFACD; bSet = true; break; } // (Lemon Chiffon Preset Color) Specifies a color with RGB value (255,250,205) + else if (str == L"lightBlue") { RGB = 0xADD8E6; bSet = true; break; } // (Light Blue Preset Color) Specifies a color with RGB value (173,216,230) + else if (str == L"lightCoral") { RGB = 0xF08080; bSet = true; break; } // (Light Coral Preset Color) Specifies a color with RGB value (240,128,128) + else if (str == L"lightCyan") { RGB = 0xE0FFFF; bSet = true; break; } // (Light Cyan Preset Color) Specifies a color with RGB value (224,255,255) + else if (str == L"lightGoldenrodYellow") { RGB = 0xFAFAD2; bSet = true; break; } // (Light Goldenrod Color) Specifies a color with RGB value (250,250,210) + else if (str == L"lightGray") { RGB = 0xD3D3D3; bSet = true; break; } // (Light Gray Preset Color) Specifies a color with RGB value (211,211,211) + else if (str == L"lightGreen") { RGB = 0x90EE90; bSet = true; break; } // (Light Green Preset Color) Specifies a color with RGB value (144,238,144) + else if (str == L"lightGrey") { RGB = 0xD3D3D3; bSet = true; break; } // (Light Gray Preset Color) Specifies a color with RGB value (211,211,211) + else if (str == L"lightPink") { RGB = 0xFFB6C1; bSet = true; break; } // (Light Pink Preset Color) Specifies a color with RGB value (255,182,193) + else if (str == L"lightSalmon") { RGB = 0xFFA07A; bSet = true; break; } // (Light Salmon Preset Color) Specifies a color with RGB value (255,160,122) + else if (str == L"lightSeaGreen") { RGB = 0x20B2AA; bSet = true; break; } // (Light Sea Green Preset Color) Specifies a color with RGB value (32,178,170) + else if (str == L"lightSkyBlue") { RGB = 0x87CEFA; bSet = true; break; } // (Light Sky Blue Preset Color) Specifies a color with RGB value (135,206,250) + else if (str == L"lightSlateGray") { RGB = 0x778899; bSet = true; break; } // (Light Slate Gray Preset Color) Specifies a color with RGB value (119,136,153) + else if (str == L"lightSlateGrey") { RGB = 0x778899; bSet = true; break; } // (Light Slate Gray Preset Color) Specifies a color with RGB value (119,136,153) + else if (str == L"lightSteelBlue") { RGB = 0xB0C4DE; bSet = true; break; } // (Light Steel Blue Preset Color) Specifies a color with RGB value (176,196,222) + else if (str == L"lightYellow") { RGB = 0xFFFFE0; bSet = true; break; } // (Light Yellow Preset Color) Specifies a color with RGB value (255,255,224) + else if (str == L"lime") { RGB = 0x00FF00; bSet = true; break; } // (Lime Preset Color) Specifies a color with RGB value (0,255,0) + else if (str == L"limeGreen") { RGB = 0x32CD32; bSet = true; break; } // (Lime Green Preset Color) Specifies a color with RGB value (50,205,50) + else if (str == L"linen") { RGB = 0xFAF0E6; bSet = true; break; } // (Linen Preset Color) Specifies a color with RGB value (250,240,230) + else if (str == L"ltBlue") { RGB = 0xADD8E6; bSet = true; break; } // (Light Blue Preset Color) Specifies a color with RGB value (173,216,230) + else if (str == L"ltCoral") { RGB = 0xF08080; bSet = true; break; } // (Light Coral Preset Color) Specifies a color with RGB value (240,128,128) + else if (str == L"ltCyan") { RGB = 0xE0FFFF; bSet = true; break; } // (Light Cyan Preset Color) Specifies a color with RGB value (224,255,255) + else if (str == L"ltGoldenrodYellow") { RGB = 0xFAFA78; bSet = true; break; } // (Light Goldenrod Color) Specifies a color with RGB value (250,250,120) + else if (str == L"ltGray") { RGB = 0xD3D3D3; bSet = true; break; } // (Light Gray Preset Color) Specifies a color with RGB value (211,211,211) + else if (str == L"ltGreen") { RGB = 0x90EE90; bSet = true; break; } // (Light Green Preset Color) Specifies a color with RGB value (144,238,144) + else if (str == L"ltGrey") { RGB = 0xD3D3D3; bSet = true; break; } // (Light Gray Preset Color) Specifies a color with RGB value (211,211,211) + else if (str == L"ltPink") { RGB = 0xFFB6C1; bSet = true; break; } // (Light Pink Preset Color) Specifies a color with RGB value (255,182,193) + else if (str == L"ltSalmon") { RGB = 0xFFA07A; bSet = true; break; } // (Light Salmon Preset Color) Specifies a color with RGB value (255,160,122) + else if (str == L"ltSeaGreen") { RGB = 0x20B2AA; bSet = true; break; } // (Light Sea Green Preset Color) Specifies a color with RGB value (32,178,170) + else if (str == L"ltSkyBlue") { RGB = 0x87CEFA; bSet = true; break; } // (Light Sky Blue Preset Color) Specifies a color with RGB value (135,206,250) + else if (str == L"ltSlateGray") { RGB = 0x778899; bSet = true; break; } // (Light Slate Gray Preset Color) Specifies a color with RGB value (119,136,153) + else if (str == L"ltSlateGrey") { RGB = 0x778899; bSet = true; break; } // (Light Slate Gray Preset Color) Specifies a color with RGB value (119,136,153) + else if (str == L"ltSteelBlue") { RGB = 0xB0C4DE; bSet = true; break; } // (Light Steel Blue Preset Color) Specifies a color with RGB value (176,196,222) + else if (str == L"ltYellow") { RGB = 0xFFFFE0; bSet = true; break; } // (Light Yellow Preset Color) Specifies a color with RGB value (255,255,224) + break; + case 'm': + if (str == L"magenta") { RGB = 0xFF00FF; bSet = true; break; } // (Magenta Preset Color) Specifies a color with RGB value (255,0,255) + else if (str == L"maroon") { RGB = 0x800000; bSet = true; break; } // (Maroon Preset Color) Specifies a color with RGB value (128,0,0) + else if (str == L"medAquamarine") { RGB = 0x66CDAA; bSet = true; break; } // (Medium Aquamarine Preset Color)Specifies a color with RGB value (102,205,170) + else if (str == L"medBlue") { RGB = 0x0000CD; bSet = true; break; } // (Medium Blue Preset Color) Specifies a color with RGB value (0,0,205) + else if (str == L"mediumAquamarine") { RGB = 0x66CDAA; bSet = true; break; } // (Medium Aquamarine Color) Specifies a color with RGB value (102,205,170) + else if (str == L"mediumBlue") { RGB = 0x0000CD; bSet = true; break; } // (Medium Blue Preset Color) Specifies a color with RGB value (0,0,205) + else if (str == L"mediumOrchid") { RGB = 0xBA55D3; bSet = true; break; } // (Medium Orchid Preset Color) Specifies a color with RGB value (186,85,211) + else if (str == L"mediumPurple") { RGB = 0x9370DB; bSet = true; break; } // (Medium Purple Preset Color) Specifies a color with RGB value (147,112,219) + else if (str == L"mediumSeaGreen") { RGB = 0x3CB371; bSet = true; break; } // (Medium Sea Green Preset Color) Specifies a color with RGB value (60,179,113) + else if (str == L"mediumSlateBlue") { RGB = 0x7B68EE; bSet = true; break; } // (Medium Slate Blue Preset Color)Specifies a color with RGB value (123,104,238) + else if (str == L"mediumSpringGreen") { RGB = 0x00FA9A; bSet = true; break; } // (Medium Spring Color) Specifies a color with RGB value (0,250,154) + else if (str == L"mediumTurquoise") { RGB = 0x48D1CC; bSet = true; break; } // (Medium Turquoise Preset Color) Specifies a color with RGB value (72,209,204) + else if (str == L"mediumVioletRed") { RGB = 0xC71585; bSet = true; break; } // (Medium Violet Red Preset Color)Specifies a color with RGB value (199,21,133) + else if (str == L"medOrchid") { RGB = 0xBA55D3; bSet = true; break; } // (Medium Orchid Preset Color) Specifies a color with RGB value (186,85,211) + else if (str == L"medPurple") { RGB = 0x9370DB; bSet = true; break; } // (Medium Purple Preset Color) Specifies a color with RGB value (147,112,219) + else if (str == L"medSeaGreen") { RGB = 0x3CB371; bSet = true; break; } // (Medium Sea Green Preset Color) Specifies a color with RGB value (60,179,113) + else if (str == L"medSlateBlue") { RGB = 0x7B68EE; bSet = true; break; } // (Medium Slate Blue Preset Color)Specifies a color with RGB value (123,104,238) + else if (str == L"medSpringGreen") { RGB = 0x00FA9A; bSet = true; break; } // (Medium Spring Preset Color) Specifies a color with RGB value (0,250,154) + else if (str == L"medTurquoise") { RGB = 0x48D1CC; bSet = true; break; } // (Medium Turquoise Preset Color) Specifies a color with RGB value (72,209,204) + else if (str == L"medVioletRed") { RGB = 0xC71585; bSet = true; break; } // (Medium Violet Red Preset Color)Specifies a color with RGB value (199,21,133) + else if (str == L"midnightBlue") { RGB = 0x191970; bSet = true; break; } // (Midnight Blue Preset Color) Specifies a color with RGB value (25,25,112) + else if (str == L"mintCream") { RGB = 0xF5FFFA; bSet = true; break; } // (Mint Cream Preset Color) Specifies a color with RGB value (245,255,250) + else if (str == L"mistyRose") { RGB = 0xFFE4FF; bSet = true; break; } // (Misty Rose Preset Color) Specifies a color with RGB value (255,228,225) + else if (str == L"moccasin") { RGB = 0xFFE4B5; bSet = true; break; } // (Moccasin Preset Color) Specifies a color with RGB value (255,228,181) + else if (str == L"menuText") { RGB = 0x000000; bSet = true; break; } + break; + case 'n': + if (str == L"navajoWhite") { RGB = 0xFFDEAD; bSet = true; break; } // (Navajo White Preset Color) Specifies a color with RGB value (255,222,173) + else if (str == L"navy") { RGB = 0x000080; bSet = true; break; } // (Navy Preset Color) Specifies a color with RGB value (0,0,128) + break; + case 'o': + if (str == L"oldLace") { RGB = 0xFDF5E6; bSet = true; break; } // (Old Lace Preset Color) Specifies a color with RGB value (253,245,230) + else if (str == L"olive") { RGB = 0x808000; bSet = true; break; } // (Olive Preset Color) Specifies a color with RGB value (128,128,0) + else if (str == L"oliveDrab") { RGB = 0x6B8E23; bSet = true; break; } // (Olive Drab Preset Color) Specifies a color with RGB value (107,142,35) + else if (str == L"orange") { RGB = 0xFFA500; bSet = true; break; } // (Orange Preset Color) Specifies a color with RGB value (255,165,0) + else if (str == L"orangeRed") { RGB = 0xFF4500; bSet = true; break; } // (Orange Red Preset Color) Specifies a color with RGB value (255,69,0) + else if (str == L"orchid") { RGB = 0xDA70D6; bSet = true; break; } // (Orchid Preset Color) Specifies a color with RGB value (218,112,214) + break; + case 'p': + if (str == L"paleGoldenrod") { RGB = 0xEEE8AA; bSet = true; break; } // (Pale Goldenrod Preset Color) Specifies a color with RGB value (238,232,170) + else if (str == L"paleGreen") { RGB = 0x98FB98; bSet = true; break; } // (Pale Green Preset Color) Specifies a color with RGB value (152,251,152) + else if (str == L"paleTurquoise") { RGB = 0xAFEEEE; bSet = true; break; } // (Pale Turquoise Preset Color) Specifies a color with RGB value (175,238,238) + else if (str == L"paleVioletRed") { RGB = 0xDB7093; bSet = true; break; } // (Pale Violet Red Preset Color) Specifies a color with RGB value (219,112,147) + else if (str == L"papayaWhip") { RGB = 0xFFEFD5; bSet = true; break; } // (Papaya Whip Preset Color) Specifies a color with RGB value (255,239,213) + else if (str == L"peachPuff") { RGB = 0xFFDAB9; bSet = true; break; } // (Peach Puff Preset Color) Specifies a color with RGB value (255,218,185) + else if (str == L"peru") { RGB = 0xCD853F; bSet = true; break; } // (Peru Preset Color) Specifies a color with RGB value (205,133,63) + else if (str == L"pink") { RGB = 0xFFC0CB; bSet = true; break; } // (Pink Preset Color) Specifies a color with RGB value (255,192,203) + else if (str == L"plum") { RGB = 0xD3A0D3; bSet = true; break; } // (Plum Preset Color) Specifies a color with RGB value (221,160,221) + else if (str == L"powderBlue") { RGB = 0xB0E0E6; bSet = true; break; } // (Powder Blue Preset Color) Specifies a color with RGB value (176,224,230) + else if (str == L"purple") { RGB = 0x800080; bSet = true; break; } // (Purple Preset Color) Specifies a color with RGB value (128,0,128) + break; + case 'r': + if (str == L"red") { RGB = 0xFF0000; bSet = true; break; } // (Red Preset Color) Specifies a color with RGB value (255,0,0) + else if (str == L"rosyBrown") { RGB = 0xBC8F8F; bSet = true; break; } // (Rosy Brown Preset Color) Specifies a color with RGB value (188,143,143) + else if (str == L"royalBlue") { RGB = 0x4169E1; bSet = true; break; } // (Royal Blue Preset Color) Specifies a color with RGB value (65,105,225) + break; + case 's': + if (str == L"saddleBrown") { RGB = 0x8B4513; bSet = true; break; } // (Saddle Brown Preset Color) Specifies a color with RGB value (139,69,19) + else if (str == L"salmon") { RGB = 0xFA8072; bSet = true; break; } // (Salmon Preset Color) Specifies a color with RGB value (250,128,114) + else if (str == L"sandyBrown") { RGB = 0xF4A460; bSet = true; break; } // (Sandy Brown Preset Color) Specifies a color with RGB value (244,164,96) + else if (str == L"seaGreen") { RGB = 0x2E8B57; bSet = true; break; } // (Sea Green Preset Color) Specifies a color with RGB value (46,139,87) + else if (str == L"seaShell") { RGB = 0xFFF5EE; bSet = true; break; } // (Sea Shell Preset Color) Specifies a color with RGB value (255,245,238) + else if (str == L"sienna") { RGB = 0xA0522D; bSet = true; break; } // (Sienna Preset Color) Specifies a color with RGB value (160,82,45) + else if (str == L"silver") { RGB = 0xC0C0C0; bSet = true; break; } // (Silver Preset Color) Specifies a color with RGB value (192,192,192) + else if (str == L"skyBlue") { RGB = 0x87CEEB; bSet = true; break; } // (Sky Blue Preset Color) Specifies a color with RGB value (135,206,235) + else if (str == L"slateBlue") { RGB = 0x6A5AEB; bSet = true; break; } // (Slate Blue Preset Color) Specifies a color with RGB value (106,90,205) + else if (str == L"slateGray") { RGB = 0x708090; bSet = true; break; } // (Slate Gray Preset Color) Specifies a color with RGB value (112,128,144) + else if (str == L"slateGrey") { RGB = 0x708090; bSet = true; break; } // (Slate Gray Preset Color) Specifies a color with RGB value (112,128,144) + else if (str == L"snow") { RGB = 0xFFFAFA; bSet = true; break; } // (Snow Preset Color) Specifies a color with RGB value (255,250,250) + else if (str == L"springGreen") { RGB = 0x00FF7F; bSet = true; break; } // (Spring Green Preset Color) Specifies a color with RGB value (0,255,127) + else if (str == L"steelBlue") { RGB = 0x4682B4; bSet = true; break; } // (Steel Blue Preset Color) Specifies a color with RGB value (70,130,180) + break; + case 't': + if (str == L"tan") { RGB = 0xD2B48C; bSet = true; break; } // (Tan Preset Color) Specifies a color with RGB value (210,180,140) + else if (str == L"teal") { RGB = 0x008080; bSet = true; break; } // (Teal Preset Color) Specifies a color with RGB value (0,128,128) + else if (str == L"thistle") { RGB = 0xD8BFD8; bSet = true; break; } // (Thistle Preset Color) Specifies a color with RGB value (216,191,216) + else if (str == L"tomato") { RGB = 0xFF7347; bSet = true; break; } // (Tomato Preset Color) Specifies a color with RGB value (255,99,71) + else if (str == L"turquoise") { RGB = 0x40E0D0; bSet = true; break; } // (Turquoise Preset Color) Specifies a color with RGB value (64,224,208) + break; + case 'v': + if (str == L"violet") { RGB = 0xEE82EE; bSet = true; break; } // (Violet Preset Color) Specifies a color with RGB value (238,130,238) + break; + case 'w': + if (str == L"wheat") { RGB = 0xF5DEB3; bSet = true; break; } // (Wheat Preset Color) Specifies a color with RGB value (245,222,179) + else if (str == L"white") { RGB = 0xFFFFFF; bSet = true; break; } // (White Preset Color) Specifies a color with RGB value (255,255,255) + else if (str == L"whiteSmoke") { RGB = 0xF5F5F5; bSet = true; break; } // (White Smoke Preset Color) Specifies a color with RGB value (245,245,245) + else if (str == L"windowsText") { RGB = 0x000000; bSet = true; break; } // (White Smoke Preset Color) Specifies a color with RGB value (245,245,245) + break; + case 'y': + if (str == L"yellow") { RGB = 0xFFFF00; bSet = true; break; } // (Yellow Preset Color) Specifies a color with RGB value (255,255,0) + else if (str == L"yellowGreen") { RGB = 0x9ACD32; bSet = true; break; } // (Yellow Green Preset Color) Specifies a color with RGB value (154,205,50) + break; } } + if (bSet) + { + color.R = (BYTE)(RGB >> 16); + color.G = (BYTE)(RGB >> 8); + color.B = (BYTE)(RGB); + color.A = 0; + } return bSet; } } @@ -2107,8 +2109,12 @@ bool CDrawingConverter::ParceObject(const std::wstring& strXml, std::wstring** p pOle = NULL; } } + //std::wstring test; if (pElem) + { m_pBinaryWriter->WriteRecord1(1, *pElem); + //test = pElem->toXML(); + } RELEASEOBJECT(pElem) RELEASEOBJECT(pOle) @@ -5094,11 +5100,16 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils } nullable_string sRid; - XmlMacroReadAttributeBase(oNodeFill, L"r:id", sRid); + XmlMacroReadAttributeBase(oNodeFill, L"o:relid", sRid); + if (false == sRid.IsInit()) { XmlMacroReadAttributeBase(oNodeFill, L"relationships:id", sRid); } + if (false == sRid.IsInit()) + { + XmlMacroReadAttributeBase(oNodeFill, L"o:relid", sRid); + } if (sRid.is_init()) { PPTX::Logic::BlipFill* pBlipFill = NULL; @@ -6143,7 +6154,7 @@ std::wstring CDrawingConverter::SaveObjectBackground(LONG lStart, LONG lLength) oXmlWriter.m_bIsTop = true; // не забыть скинуть в самом шейпе PPTX::Logic::Shape& oShape = oElem.as(); - oShape.toXmlWriterVMLBackground(&oXmlWriter, *m_pTheme, *m_pClrMap); + oShape.toXmlWriterVMLBackground(&oXmlWriter, *m_pTheme, *m_pClrMap, GetRels()); } --m_nCurrentIndexObject; @@ -6171,7 +6182,7 @@ void CDrawingConverter::ConvertShapeVML(PPTX::Logic::SpTreeElem& oElem, const st oWriter.m_bIsTop = true; // не забыть скинуть в самом шейпе PPTX::Logic::Shape& oShape = oElem.as(); - oShape.toXmlWriterVML(&oWriter, *m_pTheme, *m_pClrMap, false, bSignature); + oShape.toXmlWriterVML(&oWriter, *m_pTheme, *m_pClrMap, GetRels(), false, bSignature); } } @@ -6184,7 +6195,7 @@ void CDrawingConverter::ConvertGroupVML(PPTX::Logic::SpTreeElem& oElem, const st oWriter.m_bIsTop = true; // не забыть скинуть в самом шейпе (вместе с остальными параметрами) PPTX::Logic::SpTree& oGroup = oElem.as(); - oGroup.toXmlWriterVML(&oWriter, *m_pTheme, *m_pClrMap); + oGroup.toXmlWriterVML(&oWriter, *m_pTheme, *m_pClrMap, GetRels()); } } void CDrawingConverter::ConvertTextVML(XmlUtils::CXmlNode &nodeTextBox, PPTX::Logic::Shape* pShape) diff --git a/OOXML/PPTXFormat/Logic/Shape.cpp b/OOXML/PPTXFormat/Logic/Shape.cpp index 9172823544..70f86c9fc0 100644 --- a/OOXML/PPTXFormat/Logic/Shape.cpp +++ b/OOXML/PPTXFormat/Logic/Shape.cpp @@ -686,7 +686,8 @@ namespace PPTX } } - void Shape::toXmlWriterVML(NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr& oTheme, NSCommon::smart_ptr& oClrMap, bool in_group, bool bSignature) + void Shape::toXmlWriterVML(NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr& oTheme, NSCommon::smart_ptr& oClrMap + , NSCommon::smart_ptr& pContainer, bool in_group, bool bSignature) { std::wstring strPath, strTextRect; SimpleTypes::Vml::SptType vmlPrst = SimpleTypes::Vml::sptNotPrimitive; @@ -736,7 +737,7 @@ namespace PPTX std::wstring strFillNode; std::wstring strStrokeNode;; - CalculateFill(pWriter->m_lDocType, spPr, style, oTheme, oClrMap, strFillAttr, strFillNode, false, bSignature); + CalculateFill(pWriter->m_lDocType, spPr, style, oTheme, oClrMap, pContainer, strFillAttr, strFillNode, false, bSignature); CalculateLine(pWriter->m_lDocType, spPr, style, oTheme, oClrMap, strStrokeAttr, strStrokeNode, false); //------------------------------------------------------------- std::wstring node_name = L"v:shape"; @@ -922,10 +923,10 @@ namespace PPTX pWriter->m_strStyleMain.clear(); pWriter->m_strStyleWrap.clear(); } - void Shape::toXmlWriterVMLBackground(NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr& oTheme, NSCommon::smart_ptr& oClrMap) + void Shape::toXmlWriterVMLBackground(NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr& oTheme, NSCommon::smart_ptr& oClrMap, NSCommon::smart_ptr& pContainer) { std::wstring strFillAttr, strFillNode; - CalculateFill(pWriter->m_lDocType, spPr, style, oTheme, oClrMap, strFillAttr, strFillNode, false); + CalculateFill(pWriter->m_lDocType, spPr, style, oTheme, oClrMap, pContainer, strFillAttr, strFillNode, false); pWriter->StartNode(L"v:background"); pWriter->StartAttributes(); diff --git a/OOXML/PPTXFormat/Logic/Shape.h b/OOXML/PPTXFormat/Logic/Shape.h index 63ae952648..3bb2501ee3 100644 --- a/OOXML/PPTXFormat/Logic/Shape.h +++ b/OOXML/PPTXFormat/Logic/Shape.h @@ -313,8 +313,8 @@ namespace PPTX void SetLevelUpElement( Shape* p){m_pLevelUp = p;}; virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; - void toXmlWriterVML (NSBinPptxRW::CXmlWriter* pWriter, smart_ptr& oTheme, smart_ptr& oClrMap, bool in_group = false, bool bSignature = false); - void toXmlWriterVMLBackground (NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr& oTheme, NSCommon::smart_ptr& oClrMap); + void toXmlWriterVML (NSBinPptxRW::CXmlWriter* pWriter, smart_ptr& oTheme, smart_ptr& oClrMap, NSCommon::smart_ptr& pContainer, bool in_group = false, bool bSignature = false); + void toXmlWriterVMLBackground (NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr& oTheme, NSCommon::smart_ptr& oClrMap, NSCommon::smart_ptr& pContainer); virtual void toXmlWriter (NSBinPptxRW::CXmlWriter* pWriter) const; virtual void fromPPTY (NSBinPptxRW::CBinaryFileReader* pReader); diff --git a/OOXML/PPTXFormat/Logic/SpTree.cpp b/OOXML/PPTXFormat/Logic/SpTree.cpp index 176a105ef6..3bc95f9a00 100644 --- a/OOXML/PPTXFormat/Logic/SpTree.cpp +++ b/OOXML/PPTXFormat/Logic/SpTree.cpp @@ -188,7 +188,7 @@ namespace PPTX return XmlUtils::CreateNode(name_, oValue); } - void SpTree::toXmlWriterVML(NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr& oTheme, NSCommon::smart_ptr& oClrMap, bool in_group) + void SpTree::toXmlWriterVML(NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr& oTheme, NSCommon::smart_ptr& oClrMap, NSCommon::smart_ptr& pContainer, bool in_group) { pWriter->StartNode(_T("v:group")); pWriter->StartAttributes(); @@ -311,7 +311,7 @@ namespace PPTX { if (SpTreeElems[i].is()) { - SpTreeElems[i].as().toXmlWriterVML(pWriter, oTheme, oClrMap, true); + SpTreeElems[i].as().toXmlWriterVML(pWriter, oTheme, oClrMap, pContainer, true); } else if (SpTreeElems[i].is()) { @@ -319,7 +319,7 @@ namespace PPTX } else if (SpTreeElems[i].is()) { - SpTreeElems[i].as().toXmlWriterVML(pWriter, oTheme, oClrMap, true); + SpTreeElems[i].as().toXmlWriterVML(pWriter, oTheme, oClrMap, pContainer, true); } } diff --git a/OOXML/PPTXFormat/Logic/SpTree.h b/OOXML/PPTXFormat/Logic/SpTree.h index 3dd0fb18dd..c95a2659ca 100644 --- a/OOXML/PPTXFormat/Logic/SpTree.h +++ b/OOXML/PPTXFormat/Logic/SpTree.h @@ -56,7 +56,7 @@ namespace PPTX virtual void fromXML(XmlUtils::CXmlNode& node); virtual std::wstring toXML() const; - void toXmlWriterVML(NSBinPptxRW::CXmlWriter* pWriter, smart_ptr& oTheme, smart_ptr& oClrMap, bool in_group = false); + void toXmlWriterVML(NSBinPptxRW::CXmlWriter* pWriter, smart_ptr& oTheme, smart_ptr& oClrMap, NSCommon::smart_ptr& pContainer, bool in_group = false); virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; diff --git a/OOXML/PPTXFormat/Logic/SpTreeElem.cpp b/OOXML/PPTXFormat/Logic/SpTreeElem.cpp index a6117dcf6c..4aa4efc0ed 100644 --- a/OOXML/PPTXFormat/Logic/SpTreeElem.cpp +++ b/OOXML/PPTXFormat/Logic/SpTreeElem.cpp @@ -64,7 +64,7 @@ namespace PPTX } void CalculateFill(BYTE lDocType, PPTX::Logic::SpPr& oSpPr, nullable& pShapeStyle, NSCommon::smart_ptr& oTheme, - NSCommon::smart_ptr& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle, bool bSignature) + NSCommon::smart_ptr& oClrMap, NSCommon::smart_ptr& pContainer, std::wstring& strAttr, std::wstring& strNode, bool bOle, bool bSignature) { PPTX::Logic::UniFill fill; DWORD ARGB = 0; @@ -129,8 +129,17 @@ namespace PPTX } } } - std::wstring strId = oBlip.blip->embed->ToString(); + + NSCommon::smart_ptr pImageFileVml(new OOX::Image(NULL, false)); + pImageFileVml->set_filename(oBlip.blip->imageFilepath, false); + + smart_ptr pFileVml = pImageFileVml.smart_dynamic_cast(); + + if (pContainer.IsInit()) + { + pContainer->Add(strId, pFileVml); + } if (XMLWRITER_DOC_TYPE_XLSX == lDocType) { strId = L"o:relid=\"" + strId + L"\""; @@ -158,7 +167,7 @@ namespace PPTX BYTE A = (BYTE)((ARGB >> 24) & 0xFF); if (A != 255) { - int fopacity = 100 - (int)(((double)A / 255.0) * 65536); + int fopacity = (int)((double)A / 255. * 65536.); strNode = L""; } } @@ -218,7 +227,7 @@ namespace PPTX BYTE A = (BYTE)((ARGB >> 24) & 0xFF); if (A != 255) { - int fopacity = 100 - (int)(((double)A / 255.0) * 65536); + int fopacity = (int)((double)A / 255. * 65536.); op = std::to_wstring(fopacity) + L"f"; } @@ -696,7 +705,7 @@ namespace PPTX return m_elem->toXML(); return L""; } - void SpTreeElem::toXmlWriterVML (NSBinPptxRW::CXmlWriter* pWriter, smart_ptr& oTheme, smart_ptr& oClrMap) const + void SpTreeElem::toXmlWriterVML (NSBinPptxRW::CXmlWriter* pWriter, smart_ptr& oTheme, smart_ptr& oClrMap, NSCommon::smart_ptr& pContainer) const { if (m_elem.IsInit() == false) return; @@ -705,7 +714,7 @@ namespace PPTX case OOX::et_a_Shape: { smart_ptr oShape = m_elem.smart_dynamic_cast(); - if (oShape.IsInit()) oShape->toXmlWriterVML(pWriter, oTheme, oClrMap); + if (oShape.IsInit()) oShape->toXmlWriterVML(pWriter, oTheme, oClrMap, pContainer); }break; case OOX::et_pic: { @@ -716,7 +725,7 @@ namespace PPTX case OOX::et_lc_LockedCanvas: { smart_ptr oSpTree = m_elem.smart_dynamic_cast(); - if (oSpTree.IsInit()) oSpTree->toXmlWriterVML(pWriter, oTheme, oClrMap); + if (oSpTree.IsInit()) oSpTree->toXmlWriterVML(pWriter, oTheme, oClrMap, pContainer); }break; default: break; diff --git a/OOXML/PPTXFormat/Logic/SpTreeElem.h b/OOXML/PPTXFormat/Logic/SpTreeElem.h index 670e5c8eea..fb404a9923 100644 --- a/OOXML/PPTXFormat/Logic/SpTreeElem.h +++ b/OOXML/PPTXFormat/Logic/SpTreeElem.h @@ -51,7 +51,7 @@ namespace PPTX namespace Logic { void CalculateFill(BYTE lDocType, PPTX::Logic::SpPr& oSpPr, nullable& pShapeStyle, smart_ptr& oTheme, - smart_ptr& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle = false, bool bSignature = false); + smart_ptr& oClrMap, NSCommon::smart_ptr& pContainer, std::wstring& strAttr, std::wstring& strNode, bool bOle = false, bool bSignature = false); void CalculateLine(BYTE lDocType, PPTX::Logic::SpPr& oSpPr, nullable& pShapeStyle, smart_ptr& oTheme, smart_ptr& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle = false); @@ -85,11 +85,11 @@ namespace PPTX void InitElem(WrapperWritingElement* pElem); - virtual void fromPPTY (NSBinPptxRW::CBinaryFileReader* pReader); - virtual void toPPTY (NSBinPptxRW::CBinaryFileWriter* pWriter) const; + virtual void fromPPTY (NSBinPptxRW::CBinaryFileReader* pReader); + virtual void toPPTY (NSBinPptxRW::CBinaryFileWriter* pWriter) const; - void toXmlWriterVML (NSBinPptxRW::CXmlWriter* pWriter, smart_ptr& oTheme, smart_ptr& oClrMap) const; - virtual void toXmlWriter (NSBinPptxRW::CXmlWriter* pWriter) const; + void toXmlWriterVML (NSBinPptxRW::CXmlWriter* pWriter, smart_ptr& oTheme, smart_ptr& oClrMap, NSCommon::smart_ptr& pContainer) const; + virtual void toXmlWriter (NSBinPptxRW::CXmlWriter* pWriter) const; std::wstring GetUriElem(); smart_ptr GetElem(); diff --git a/OOXML/XlsxFormat/Controls/Controls.cpp b/OOXML/XlsxFormat/Controls/Controls.cpp index c2ae7519a6..8f827b5887 100644 --- a/OOXML/XlsxFormat/Controls/Controls.cpp +++ b/OOXML/XlsxFormat/Controls/Controls.cpp @@ -37,6 +37,8 @@ #include "../../Common/SimpleTypes_Spreadsheet.h" #include "../../DocxFormat/Drawing/DrawingExt.h" +#include "../../PPTXFormat/Logic/SpTreeElem.h" +#include "../../DocxFormat/Logic/Pict.h" #include "../../XlsbFormat/Biff12_unions/ACTIVEXCONTROLS.h" #include "../../XlsbFormat/Biff12_records/ActiveX.h" diff --git a/OOXML/XlsxFormat/Controls/Controls.h b/OOXML/XlsxFormat/Controls/Controls.h index 9d7ddbfada..e80acdd0f1 100644 --- a/OOXML/XlsxFormat/Controls/Controls.h +++ b/OOXML/XlsxFormat/Controls/Controls.h @@ -52,7 +52,13 @@ namespace SimpleTypes class CEditValidation; } } - +namespace PPTX +{ + namespace Logic + { + class SpTreeElem; + } +} namespace OOX { namespace Drawing @@ -239,6 +245,7 @@ namespace OOX nullable m_oControlPr; //--for-write-from-bin-------------- nullable m_oFormControlPr; + nullable m_oShape; }; //------------------------------------------------------------------------------------------------------------------------ class CControls : public WritingElement