Commit a2494e2a authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander Trofimov

revert Revision: 66771 из-за картиночных wmf

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@66778 954022d7-b5bf-4e40-9824-e11837661b57
parent 5c5cfa5d
......@@ -256,9 +256,9 @@ namespace NSShapeImageGen
y -= height;
}
return GenerateImageID(punkImage);
return GenerateImageID(punkImage, (std::max)(1.0, width), (std::max)(1.0, height));
}
CImageInfo WriteImage(const CString& strFile, COleInfo* pOle)
CImageInfo WriteImage(const CString& strFile, COleInfo* pOle, double& x, double& y, double& width, double& height)
{
bool bIsDownload = false;
int n1 = strFile.Find(_T("www"));
......@@ -299,7 +299,7 @@ namespace NSShapeImageGen
#endif
return GenerateImageID(strDownload, strFile1, pOle);
return GenerateImageID(strDownload, strFile1, pOle, (std::max)(1.0, width), (std::max)(1.0, height));
}
......@@ -311,7 +311,9 @@ namespace NSShapeImageGen
oFile.CloseFile();
return GenerateImageID(strFile, CString(L""), pOle);
if (-1 == width && -1 == height)
return GenerateImageID(strFile, CString(L""), pOle, width, height);
return GenerateImageID(strFile, CString(L""), pOle, (std::max)(1.0, width), (std::max)(1.0, height));
}
void SetFontManager(CFontManager* pFontManager)
{
......@@ -366,7 +368,7 @@ namespace NSShapeImageGen
return false;
}
void SaveImage(const CString& strFileSrc, CImageInfo& oInfo)
void SaveImage(const CString& strFileSrc, CImageInfo& oInfo, LONG __width, LONG __height)
{
if (CheckImageSimpleCopy(strFileSrc, oInfo))
return;
......@@ -374,7 +376,7 @@ namespace NSShapeImageGen
CBgraFrame oBgraFrame;
if (oBgraFrame.OpenFile(std::wstring(strFileSrc.GetString())) == true)
{
SaveImage(oBgraFrame, oInfo);
SaveImage(oBgraFrame, oInfo, __width, __height);
}
else
{
......@@ -388,7 +390,7 @@ namespace NSShapeImageGen
CDirectory::CopyFile(strFileSrc, strSaveItem, NULL, NULL);
}
}
void SaveImage(CBgraFrame& oBgraFrame, CImageInfo& oInfo)
void SaveImage(CBgraFrame& oBgraFrame, CImageInfo& oInfo, LONG __width, LONG __height)
{
LONG lWidth = oBgraFrame.get_Width();
LONG lHeight = oBgraFrame.get_Height();
......@@ -434,13 +436,16 @@ namespace NSShapeImageGen
oBgraFrame.SaveFile(std::wstring(pathSaveItem.GetPath()), nOutputFormat);
}
CImageInfo GenerateImageID(CBgraFrame& punkData)
CImageInfo GenerateImageID(CBgraFrame& punkData, double dWidth, double dHeight)
{
CImageInfo oInfo;
//if (NULL == punkData)
// return oInfo;
LONG lWidth = (LONG)(dWidth * 96 / 25.4);
LONG lHeight = (LONG)(dHeight * 96 / 25.4);
BYTE* pBuffer = punkData.get_Data();
LONG lLen = 4 * punkData.get_Width() * punkData.get_Height();
......@@ -453,7 +458,7 @@ namespace NSShapeImageGen
++m_lNextIDImage;
oInfo.m_lID = m_lNextIDImage;
SaveImage(punkData, oInfo);
SaveImage(punkData, oInfo, lWidth, lHeight);
m_mapImageData.insert(std::pair<DWORD,CImageInfo>(dwSum, oInfo));
m_listImages.push_back(oInfo);
......@@ -466,7 +471,7 @@ namespace NSShapeImageGen
return oInfo;
}
CImageInfo GenerateImageID(const CString& strFileName, const CString & strUrl, COleInfo* pOle)
CImageInfo GenerateImageID(const CString& strFileName, const CString & strUrl, COleInfo* pOle, double dWidth, double dHeight)
{
CString sMapKey = strFileName;
if(!strUrl.IsEmpty())
......@@ -476,6 +481,9 @@ namespace NSShapeImageGen
CImageInfo oInfo;
std::map<CString, CImageInfo>::iterator pPair = m_mapImagesFile.find(sMapKey);
LONG lWidth = (LONG)(dWidth * 96 / 25.4);
LONG lHeight = (LONG)(dHeight * 96 / 25.4);
if (m_mapImagesFile.end() == pPair)
{
++m_lNextIDImage;
......@@ -529,8 +537,12 @@ namespace NSShapeImageGen
if(bIsRaster)
{
//случай растрового wmf/emf
//-1 == lHeight имеет спецальное значение(берет размеры из файла)
if(lWidth <= 0) lWidth = -1;
if(lHeight <= 0) lHeight = -1;
std::wstring strSaveItem = strSaveItemWE + _T(".png");
oMetafile.ConvertToRaster(strSaveItem.c_str(), 4 /*CXIMAGE_FORMAT_PNG*/, -1, -1);
oMetafile.ConvertToRaster(strSaveItem.c_str(), 4 /*CXIMAGE_FORMAT_PNG*/, lWidth, lHeight);
bool bIsSuccess = NSFile::CFileBinary::Exists(strSaveItem);
if (bIsSuccess)
......@@ -554,7 +566,7 @@ namespace NSShapeImageGen
}
}
SaveImage(strFileName, oInfo);
SaveImage(strFileName, oInfo, lWidth, lHeight);
m_mapImagesFile.insert(std::pair<CString,CImageInfo>(sMapKey, oInfo));
m_listImages.push_back(oInfo);
......
......@@ -28,7 +28,7 @@ namespace PPTX
link = oSrc.link;
m_namespace = oSrc.m_namespace;
oleInfo = oSrc.oleInfo;
return *this;
}
......@@ -90,6 +90,11 @@ namespace PPTX
pWriter->EndRecord();
double dX = 0;
double dY = 0;
double dW = pWriter->GetWidthMM();
double dH = pWriter->GetHeightMM();
FileContainer* pRels = NULL;
if (pWriter->m_pCommonRels->is_init())
pRels = pWriter->m_pCommonRels->operator ->();
......@@ -101,7 +106,7 @@ namespace PPTX
pOleInfo->m_sFilename = this->GetFullOleName(PPTX::RId(oleInfo->m_sRid), pRels);
}
NSShapeImageGen::CImageInfo oId = pWriter->m_pCommon->m_pImageManager->WriteImage(this->GetFullPicName(pRels), pOleInfo);
NSShapeImageGen::CImageInfo oId = pWriter->m_pCommon->m_pImageManager->WriteImage(this->GetFullPicName(pRels), pOleInfo, dX, dY, dW, dH);
CString s = oId.GetPath2();
pWriter->StartRecord(3);
......
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