Compare commits

..

2 Commits

Author SHA1 Message Date
2682e1fbac Ooxml - fix vml image without image 2018-02-02 14:52:15 +03:00
f5c3ae779b . 2018-02-02 13:59:58 +03:00
2 changed files with 72 additions and 56 deletions

View File

@ -3986,8 +3986,19 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
nullable_string sRid;
oNodeFill.ReadAttributeBase(L"r:id", sRid);
if (sRid.is_init())
{
PPTX::Logic::BlipFill* pBlipFill = new PPTX::Logic::BlipFill();
{
PPTX::Logic::BlipFill* pBlipFill = NULL;
if (pPicture)
{
pBlipFill = &pPicture->blipFill;
}
else
{
pBlipFill = new PPTX::Logic::BlipFill();
pSpPr->Fill.m_type = PPTX::Logic::UniFill::blipFill;
pSpPr->Fill.Fill = pBlipFill;
}
pBlipFill->m_namespace = L"a";
pBlipFill->blip = new PPTX::Logic::Blip();
pBlipFill->blip->embed = new OOX::RId(*sRid);
@ -4000,9 +4011,6 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
{
pBlipFill->stretch = new PPTX::Logic::Stretch();
}
pSpPr->Fill.m_type = PPTX::Logic::UniFill::blipFill;
pSpPr->Fill.Fill = pBlipFill;
}
nullable_string sRotate;
oNodeFill.ReadAttributeBase(L"rotate", sRotate);
@ -4129,7 +4137,19 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
nullable_string sType;
oNodeFillID.ReadAttributeBase(L"type", sType);
PPTX::Logic::BlipFill* pBlipFill = new PPTX::Logic::BlipFill();
PPTX::Logic::BlipFill* pBlipFill = NULL;
if (pPicture)
{
pBlipFill = &pPicture->blipFill;
}
else
{
pBlipFill = new PPTX::Logic::BlipFill();
pSpPr->Fill.m_type = PPTX::Logic::UniFill::blipFill;
pSpPr->Fill.Fill = pBlipFill;
}
pBlipFill->m_namespace = L"a";
pBlipFill->blip = new PPTX::Logic::Blip();
@ -4181,51 +4201,50 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
else
pBlipFill->srcRect->b = str0;
}
if (pShape)
{
pSpPr->Fill.m_type = PPTX::Logic::UniFill::blipFill;
pSpPr->Fill.Fill = pBlipFill;
}
if (pPicture)
{
pSpPr->Fill.m_type = PPTX::Logic::UniFill::notInit;
pPicture->blipFill = *pBlipFill;
}
}
}
}
// default params
if (!pSpPr->Fill.Fill.is_init())
if (pPicture)
{
if (pPPTShape->IsWordArt())
{
PPTX::Logic::NoFill* pNoFill = new PPTX::Logic::NoFill();
pNoFill->m_namespace = L"a";
pSpPr->Fill.m_type = PPTX::Logic::UniFill::notInit;
pSpPr->Fill.m_type = PPTX::Logic::UniFill::noFill;
pSpPr->Fill.Fill = pNoFill;
if (false == pPicture->blipFill.blip.is_init())
{//MSF_Lec3-4.docx
oElem->InitElem(NULL);
}
else
}
else
{
// default params for fill shape
if (!pSpPr->Fill.Fill.is_init())
{
PPTX::Logic::SolidFill* pSolid = new PPTX::Logic::SolidFill();
pSolid->m_namespace = L"a";
pSolid->Color.Color = new PPTX::Logic::SrgbClr();
pSolid->Color.Color->SetRGB(0xFF, 0xFF, 0xFF);
pSpPr->Fill.m_type = PPTX::Logic::UniFill::solidFill;
pSpPr->Fill.Fill = pSolid;
if (sOpacity.is_init())
if (pPPTShape->IsWordArt())
{
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;
pSolid->Color.Color->Modifiers.push_back(oMod);
PPTX::Logic::NoFill* pNoFill = new PPTX::Logic::NoFill();
pNoFill->m_namespace = L"a";
pSpPr->Fill.m_type = PPTX::Logic::UniFill::noFill;
pSpPr->Fill.Fill = pNoFill;
}
else
{
PPTX::Logic::SolidFill* pSolid = new PPTX::Logic::SolidFill();
pSolid->m_namespace = L"a";
pSolid->Color.Color = new PPTX::Logic::SrgbClr();
pSolid->Color.Color->SetRGB(0xFF, 0xFF, 0xFF);
pSpPr->Fill.m_type = PPTX::Logic::UniFill::solidFill;
pSpPr->Fill.Fill = pSolid;
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;
pSolid->Color.Color->Modifiers.push_back(oMod);
}
}
}
}

View File

@ -509,7 +509,7 @@ namespace NExtractTools
m_oCXlsxSerializer.setIsNoBase64(params.getIsNoBase64());
m_oCXlsxSerializer.setFontDir(params.getFontPath());
return m_oCXlsxSerializer.saveToFile (sTo, sXlsxDir, bXmlOptions ? params.getXmlOptions() : L"") ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
return m_oCXlsxSerializer.saveToFile (sTo, sXlsxDir, bXmlOptions ? params.getXmlOptions() : L"");
}
// xslx -> xslt
@ -572,7 +572,7 @@ namespace NExtractTools
if(SUCCEEDED_X2T(nRes))
{
nRes = m_oCXlsxSerializer.loadFromFile (sTargetBin, sTo, sXmlOptions, sMediaPath, sEmbedPath) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
nRes = m_oCXlsxSerializer.loadFromFile (sTargetBin, sTo, sXmlOptions, sMediaPath, sEmbedPath);
}
//удаляем EditorWithChanges, потому что он не в Temp
if (sFrom != sTargetBin)
@ -1002,10 +1002,10 @@ namespace NExtractTools
std::wstring sMediaPath;
std::wstring sEmbedPath;
int nRes = m_oCXlsxSerializer.saveToFile (sResultXlstFileEditor, sCSV, params.getXmlOptions()) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
int nRes = m_oCXlsxSerializer.saveToFile (sResultXlstFileEditor, sCSV, params.getXmlOptions());
if (SUCCEEDED_X2T(nRes))
{
nRes = m_oCXlsxSerializer.loadFromFile(sResultXlstFileEditor, sTempUnpackedXLSX, params.getXmlOptions(), sMediaPath, sEmbedPath) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
nRes = m_oCXlsxSerializer.loadFromFile(sResultXlstFileEditor, sTempUnpackedXLSX, params.getXmlOptions(), sMediaPath, sEmbedPath);
if (SUCCEEDED_X2T(nRes))
{
nRes = (S_OK == oCOfficeUtils.CompressFileOrDirectory(sTempUnpackedXLSX, sTo, true)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
@ -1022,7 +1022,7 @@ namespace NExtractTools
m_oCXlsxSerializer.setIsNoBase64(params.getIsNoBase64());
m_oCXlsxSerializer.setFontDir(params.getFontPath());
return m_oCXlsxSerializer.saveToFile(sTo, sFrom, params.getXmlOptions()) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
return m_oCXlsxSerializer.saveToFile(sTo, sFrom, params.getXmlOptions());
}
// xlst -> csv
int xlst2csv (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
@ -1047,7 +1047,7 @@ namespace NExtractTools
std::wstring sMediaPath;
std::wstring sEmbedPath;
return m_oCXlsxSerializer.loadFromFile (sTempXlstFileEditor, sCSV, params.getXmlOptions(), sMediaPath, sEmbedPath) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
return m_oCXlsxSerializer.loadFromFile (sTempXlstFileEditor, sCSV, params.getXmlOptions(), sMediaPath, sEmbedPath);
}
// xslx -> csv
int xlsx2csv (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
@ -1071,13 +1071,13 @@ namespace NExtractTools
m_oCXlsxSerializer.setFontDir(params.getFontPath());
std::wstring sXMLOptions = _T("");
int nRes = m_oCXlsxSerializer.saveToFile (sResultXlstFileEditor, sTempUnpackedXLSX, sXMLOptions) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
int nRes = m_oCXlsxSerializer.saveToFile (sResultXlstFileEditor, sTempUnpackedXLSX, sXMLOptions);
if (SUCCEEDED_X2T(nRes))
{
std::wstring sMediaPath;
std::wstring sEmbedPath;
nRes = m_oCXlsxSerializer.loadFromFile (sResultXlstDir, sCSV, sXMLOptions, sMediaPath, sEmbedPath) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
nRes = m_oCXlsxSerializer.loadFromFile (sResultXlstDir, sCSV, sXMLOptions, sMediaPath, sEmbedPath);
}
return nRes;
@ -1108,7 +1108,7 @@ namespace NExtractTools
m_oCXlsxSerializer.CreateXlsxFolders (sXmlOptions, sTemp, sMediaPath, sEmbedPath);
nRes = m_oCXlsxSerializer.loadFromFile(sTargetBin, sToTemp, sXmlOptions, sMediaPath, sEmbedPath) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
nRes = m_oCXlsxSerializer.loadFromFile(sTargetBin, sToTemp, sXmlOptions, sMediaPath, sEmbedPath);
//пишем в Temp и копируем, чтобы не возникало лишних файлов рядом с sTo, а лучше перейти на отдельный метод
if(SUCCEEDED_X2T(nRes))
@ -3747,10 +3747,7 @@ namespace NExtractTools
m_oCXlsxSerializer.setFontDir(params.getFontPath());
int res = m_oCXlsxSerializer.saveToFile (sTo, sResultXlsxDir, params.getXmlOptions()) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
return res;
return m_oCXlsxSerializer.saveToFile (sTo, sResultXlsxDir, params.getXmlOptions());
}
return AVS_FILEUTILS_ERROR_CONVERT;
}