Commit 65d37bb2 authored by ElenaSubbotina's avatar ElenaSubbotina Committed by Alexander Trofimov

OdfReader - исправлена конвертация некоторых метафайлов svm (например Justice...

OdfReader - исправлена конвертация некоторых метафайлов svm (например Justice Gap for Sexual Assault 05-25-10.odt)
parent e2da238d
......@@ -152,8 +152,10 @@ void CSvmFile::PlayMetaFile()
case META_TRANSPARENT_ACTION: Read_META_TRANSPARENT(); break;
case META_FLOATTRANSPARENT_ACTION: Read_META_FLOATTRANSPARENT(); break;
case META_ISECTRECTCLIPREGION_ACTION: Read_META_SECTRECTCLIPREGION(); break;
case META_ISECTREGIONCLIPREGION_ACTION: Read_META_SECTREGIONCLIPREGION(); break;
case META_ISECTRECTCLIPREGION_ACTION: Read_META_SECTRECTCLIPREGION(); break;
case META_ISECTREGIONCLIPREGION_ACTION: Read_META_SECTREGIONCLIPREGION(); break;
case META_LAYOUTMODE_ACTION: Read_META_LAYOUTMODE(); break;
case META_ROUNDRECT_ACTION:
case META_ELLIPSE_ACTION:
......@@ -175,13 +177,13 @@ void CSvmFile::PlayMetaFile()
case META_MOVECLIPREGION_ACTION:
case META_EPS_ACTION:
case META_REFPOINT_ACTION:
case META_LAYOUTMODE_ACTION:
case META_OVERLINECOLOR_ACTION:
case META_RENDERGRAPHIC_ACTION:
case META_COMMENT_ACTION:
case META_NULL_ACTION:
default:
m_unRecordPos = m_unRecordPos;
break;
}
......@@ -191,7 +193,7 @@ void CSvmFile::PlayMetaFile()
m_oStream.Skip(need_skip);
#ifdef _DEBUG
if (100 <= actionType && actionType <= META_LAST_ACTION && need_skip > 0 && !m_pOutput)
if (100 <= actionType && actionType <= META_LAST_ACTION && need_skip != 0 && !m_pOutput)
{
std::wstring name = actionNames[actionType - 99].actionName;
......@@ -218,7 +220,7 @@ void CSvmFile::Read_META_LINE()
CSvmPen *last_pen = dynamic_cast<CSvmPen *>(m_oPlayer.GetLastObject(SVM_OBJECT_PEN));
if (last_pen)
{
last_pen->Width = line_info.width;
last_pen->Width = line_info.width / (m_oPlayer.GetDC()->m_dPixelWidth * 2);
switch(line_info.style)
{
......@@ -250,12 +252,12 @@ void CSvmFile::Read_SVM_HEADER()
m_pDC->SetMapMode(m_oHeader.mapMode, true);
m_oBoundingBox = m_oHeader.boundRect;
m_oBoundingBox.nRight *= m_pDC->m_dPixelWidthPrefered * 2;
m_oBoundingBox.nRight *= m_pDC->m_dPixelWidthPrefered * 2;
m_oBoundingBox.nBottom *= m_pDC->m_dPixelHeightPrefered * 2;
m_oBoundingBox.nLeft *= m_pDC->m_dPixelWidthPrefered * 2;
m_oBoundingBox.nTop *= m_pDC->m_dPixelHeightPrefered * 2;
// *2 ради повышения качества картинки (если в векторе насамом деле растр - сментся на растровые размеры ниже
m_oBoundingBox.nLeft *= m_pDC->m_dPixelWidthPrefered;
m_oBoundingBox.nTop *= m_pDC->m_dPixelHeightPrefered;
//???? *2 ради повышения качества картинки (если в векторе насамом деле растр - сментся на растровые размеры ниже
m_bFirstPoint = true;
}
void CSvmFile::Read_META_POLYLINE()
......@@ -271,7 +273,7 @@ void CSvmFile::Read_META_POLYLINE()
CSvmPen *last_pen = dynamic_cast<CSvmPen *>(m_oPlayer.GetLastObject(SVM_OBJECT_PEN));
if (last_pen)
{
last_pen->Width = line_info.width;
last_pen->Width = line_info.width / (m_oPlayer.GetDC()->m_dPixelWidth * 2);
switch(line_info.style)
{
......@@ -283,11 +285,15 @@ void CSvmFile::Read_META_POLYLINE()
if (m_currentActionVersion >= 3)
{
unsigned int tmp1;
unsigned short tmp2;
unsigned char bHasPolyFlags = 0;
m_oStream >> bHasPolyFlags;
if ( bHasPolyFlags )
{
m_oStream >> tmp1 >> tmp2;
}
bHasPolyFlags = bHasPolyFlags;
//read flags
//enum PolyFlags
//{
......@@ -419,6 +425,15 @@ void CSvmFile::Read_META_SETMAPMODE()
UpdateOutputDC();
}
void CSvmFile::Read_META_LAYOUTMODE()
{
unsigned int textLayputMode;
m_oStream >> textLayputMode;
UpdateOutputDC();
}
void CSvmFile::Read_META_STRETCHTEXT()
{
std::wstring sText;
......@@ -487,6 +502,7 @@ void CSvmFile::Read_META_TEXT()
void CSvmFile::Read_META_ARRAYTEXT()
{
std::wstring sText;
std::wstring sText2;
TSvmPoint startPoint;
m_oStream >> startPoint;
......@@ -529,6 +545,8 @@ void CSvmFile::Read_META_ARRAYTEXT()
m_oStream >> nTemp;
tempBuffer += (wchar_t)nTemp;
}
sText2 = tempBuffer;
}
DrawText(sText, sText.length(), startPoint.x, startPoint.y, mpDXAry);
......
......@@ -49,7 +49,6 @@ class CSvmFile : virtual public IMetaFileBase
}
TRect* GetDCBounds()
{
//if (m_oHeader.mapMode.isSimple)
if (m_pDC->m_oMapMode.isSimple)
{
m_oDCRect = m_oBoundingBox;
......@@ -57,6 +56,7 @@ class CSvmFile : virtual public IMetaFileBase
}
else
{
m_oDCRect = m_oHeader.boundRect;
return &m_oHeader.boundRect;
}
}
......@@ -199,6 +199,8 @@ class CSvmFile : virtual public IMetaFileBase
void Read_META_SECTRECTCLIPREGION();
void Read_META_SECTREGIONCLIPREGION();
void Read_META_LAYOUTMODE();
void Read_META_STRETCHTEXT();
void Read_META_POLYPOLYGON(std::vector<TSvmPolygon> & polygons, std::vector<TSvmPolygon> & complexPolygons);
......@@ -211,12 +213,13 @@ class CSvmFile : virtual public IMetaFileBase
}
void TranslatePoint(int nX, int nY, double& dX, double &dY)
{
if (m_pDC->m_oMapMode.isSimple ) return;
if (m_pDC->m_oMapMode.isSimple )
return;
//TSvmWindow* pWindow = m_pDC->GetWindow();
//TSvmWindow* pViewport = m_pDC->GetViewport();
dX = (double)(nX) * m_pDC->m_dPixelWidth ;
dY = (double)(nY) * m_pDC->m_dPixelHeight ;
//dX = (double)(nX) * m_pDC->m_dPixelWidth ;
//dY = (double)(nY) * m_pDC->m_dPixelHeight ;
//dX = (double)((double)(nX - pWindow->lX) * m_pDC->m_dPixelWidth) + pViewport->lX;
//dY = (double)((double)(nY - pWindow->lY) * m_pDC->m_dPixelHeight) + pViewport->lY;
......
......@@ -464,49 +464,49 @@ void CSvmDC::SetMapMode(TSvmMapMode & mapMode, bool prefered )
{
case MAP_MM: // 1 unit = 1 mm
{
dPixel = 1. * 72 / 25.4;
dPixel = 1. * 96 / 25.4;
SetPixelWidth(dPixel);
SetPixelHeight(dPixel);
}break;
case MAP_CM: // 1 unit = 1 cm = 10 mm
{
dPixel = 10. * 72 / 25.4;
dPixel = 10. * 96 / 25.4;
SetPixelWidth(dPixel);
SetPixelHeight(dPixel);
}break;
case MAP_100TH_MM:
{
dPixel = 1. * 72 / 2540.;
dPixel = 1. * 96 / 2540.;
SetPixelWidth(dPixel);
SetPixelHeight(dPixel);
}break;
case MAP_10TH_MM:
{
dPixel = 1. * 72 / 254.;
dPixel = 1. * 96 / 254.;
SetPixelWidth(dPixel);
SetPixelHeight(dPixel);
}break;
case MAP_1000TH_INCH:
{
dPixel = 1. * 72 / 1000.;
dPixel = 1. * 96 / 1000.;
SetPixelWidth(dPixel);
SetPixelHeight(dPixel);
}break;
case MAP_100TH_INCH:
{
dPixel = 1.* 72 / 100.;
dPixel = 1.* 96 / 100.;
SetPixelWidth(dPixel);
SetPixelHeight(dPixel);
}break;
case MAP_10TH_INCH:
{
dPixel = 1. * 72 / 10.;
dPixel = 1. * 96 / 10.;
SetPixelWidth(dPixel);
SetPixelHeight(dPixel);
}break;
case MAP_INCH: // 1 unit = 1 inch
{
dPixel = 1. * 72;
dPixel = 1. * 96;
SetPixelWidth(dPixel);
SetPixelHeight(dPixel);
}break;
......@@ -522,7 +522,7 @@ void CSvmDC::SetMapMode(TSvmMapMode & mapMode, bool prefered )
}break;
case MAP_PIXEL:
{
dPixel = 0.5;// /72.; //todooo
dPixel = 0.5;// /96.; //todooo
SetPixelWidth(dPixel);
SetPixelHeight(dPixel);
}break;
......
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