Commit 5d7c045f authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

.....

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@63144 954022d7-b5bf-4e40-9824-e11837661b57
parent b307226b
......@@ -55,7 +55,7 @@ static const std::wstring _ooxDashStyle[]=
L"sysDashDotDot"
};
void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_property> & prop)
void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_property> & prop, bool always_draw)
{
_CP_OPT(std::wstring) strStrokeColor;
_CP_OPT(int) iStroke;
......@@ -70,7 +70,7 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
odf_reader::GetProperty(prop, L"stroke-width" , dStrokeWidth);
odf_reader::GetProperty(prop, L"stroke-opacity" , strStrokeOpacity);
if (!strStrokeColor && !iStroke && !dStrokeWidth)return;
if ((!strStrokeColor && !iStroke && !dStrokeWidth) && !always_draw)return;
CP_XML_WRITER(strm)
{
......@@ -96,7 +96,8 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
{
if (fill != L"a:noFill")
{
if (color.length()<1) color = L"ffffff";
if (color.length()<1 && always_draw) color = L"000000";
else if (color.length()<1) color = L"ffffff";
CP_XML_NODE(L"a:srgbClr")
{
CP_XML_ATTR(L"val",color);
......
......@@ -60,7 +60,7 @@ namespace oox {
};
void oox_serialize_xfrm (std::wostream & strm, _oox_drawing & val,std::wstring name_space = L"a");
void oox_serialize_shape (std::wostream & strm, _oox_drawing & val);
void oox_serialize_ln (std::wostream & strm, const std::vector<odf_reader::_property> & val);
void oox_serialize_ln (std::wostream & strm, const std::vector<odf_reader::_property> & val, bool always_draw = false);
void oox_serialize_hlink (std::wostream & strm, const std::vector<_hlink_desc> & val);
void oox_serialize_bodyPr (std::wostream & strm, const std::vector<odf_reader::_property> & val);
void oox_serialize_aLst (std::wostream & strm, const std::vector<odf_reader::_property> & val);
......
......@@ -9,6 +9,7 @@
#include "mediaitems.h"
#include "../../DesktopEditor/common/File.h"
#include "../../DesktopEditor/raster/Metafile/MetaFile.h"
#include "../../DesktopEditor/raster/ImageFileFormatChecker.h"
namespace cpdoccore {
namespace oox {
......@@ -194,8 +195,8 @@ void media::write(const std::wstring & RootPath)
std::wstring & file_name = item.href;
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + item.outputName;
int pos_svm = file_name.rfind(L".svm");
if ( pos_svm >= 0)
CImageFileFormatChecker svmFileChecker;
if (svmFileChecker.isSvmFile(file_name))
{
ConvertSvmToImage(file_name, file_name_out, appFonts_);
}
......
......@@ -145,8 +145,12 @@ void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing & val)
oox_serialize_xfrm(CP_XML_STREAM(),val);
oox_serialize_shape(CP_XML_STREAM(),val);
bool draw_always = false;
if (val.sub_type == 5 || val.sub_type == 6)//line ) - -
draw_always = true;
oox_serialize_ln(CP_XML_STREAM(),val.additional);
oox_serialize_ln(CP_XML_STREAM(),val.additional, draw_always);
} // xdr:spPr
xlsx_serialize_text(CP_XML_STREAM(),val.additional);
......
......@@ -765,7 +765,7 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
else
{
empty_cell++;
if (empty_cell > 2)
if (empty_cell > 4)
{
skip_next_cell = true;
}
......
......@@ -101,6 +101,7 @@ bool CImageFileFormatChecker::isEmfFile(BYTE* pBuffer,DWORD dwBytes)
return false;
}
//pcx ( http://www.fileformat.info/format/pcx/corion.htm )
bool CImageFileFormatChecker::isPcxFile(BYTE* pBuffer,DWORD dwBytes)
{
......@@ -271,23 +272,9 @@ bool CImageFileFormatChecker::isSvmFile(BYTE* pBuffer,DWORD dwBytes)
{
if (eFileType)return false;
if ( (48 <= dwBytes) &&(0x56 == pBuffer[0] && 0x43 == pBuffer[1] && 0x4c == pBuffer[2] && 0x4d == pBuffer[3]
&& 0x54 == pBuffer[4] && 0x46 == pBuffer[5] && 0x01 == pBuffer[6] && 0x00 == pBuffer[7]
&& 0x31 == pBuffer[8] && 0x00 == pBuffer[9] && 0x00 == pBuffer[10] && 0x00 == pBuffer[11]
&& 0x01 == pBuffer[12] && 0x00 == pBuffer[13] && 0x00 == pBuffer[14] && 0x00 == pBuffer[15]
&& 0x01 == pBuffer[16] && 0x00 == pBuffer[17] && 0x1b == pBuffer[18] && 0x00 == pBuffer[19]
&& 0x00 == pBuffer[20] && 0x00 == pBuffer[21] && 0x00 == pBuffer[22] && 0x00 == pBuffer[23]
&& 0x00 == pBuffer[24] && 0x00 == pBuffer[25] && 0x00 == pBuffer[26] && 0x00 == pBuffer[27]
&& 0x00 == pBuffer[28] && 0x00 == pBuffer[29] && 0x00 == pBuffer[30] && 0x00 == pBuffer[31]
&& 0x01 == pBuffer[32] && 0x00 == pBuffer[33] && 0x00 == pBuffer[34] && 0x00 == pBuffer[35]
&& 0x01 == pBuffer[36] && 0x00 == pBuffer[37] && 0x00 == pBuffer[38] && 0x00 == pBuffer[39]
&& 0x01 == pBuffer[40] && 0x00 == pBuffer[41] && 0x00 == pBuffer[42] && 0x00 == pBuffer[43]
&& 0x01 == pBuffer[44] && 0x00 == pBuffer[45] && 0x00 == pBuffer[46] && 0x00 == pBuffer[47]))
if ( (6 <= dwBytes) &&(0x56 == pBuffer[0] && 0x43 == pBuffer[1] && 0x4c == pBuffer[2] && 0x4d == pBuffer[3]
&& 0x54 == pBuffer[4] && 0x46 == pBuffer[5] && 0x01 == pBuffer[6] && 0x00 == pBuffer[7]
&& 0x31 == pBuffer[8] && 0x00 == pBuffer[9] && 0x00 == pBuffer[10] && 0x00 == pBuffer[11]) )
return true;
return false;
......@@ -486,6 +473,36 @@ bool CImageFileFormatChecker::isImageFile(std::wstring& fileName)
if (eFileType)return true;
return false;
}
bool CImageFileFormatChecker::isSvmFile(std::wstring & fileName)
{
eFileType = _CXIMAGE_FORMAT_UNKNOWN;
////////////////////////////////////////////////////////////////////////////////
NSFile::CFileBinary file;
if (!file.OpenFile(fileName))
return false;
BYTE* buffer = new BYTE[12];
if (!buffer)
return false;
DWORD sizeRead = 0;
if (!file.ReadFile(buffer, 12, sizeRead))
{
delete []buffer;
return false;
}
file.CloseFile();
////////////////////////////////////////////////////////////////////////////////
if (isSvmFile(buffer,sizeRead))
{
eFileType = _CXIMAGE_FORMAT_SVM;
}
delete [] buffer;
if (eFileType)return true;
else return false;
}
bool CImageFileFormatChecker::isPngFile(std::wstring & fileName)
{
eFileType = _CXIMAGE_FORMAT_UNKNOWN;
......@@ -541,6 +558,7 @@ std::wstring CImageFileFormatChecker::DetectFormatByData(BYTE *Data, int DataSiz
else if (isRasFile(Data,DataSize)) return L"ras";
else if (isTiffFile(Data,DataSize))return L"tif";
else if (isWmfFile(Data,DataSize)) return L"wmf";
else if (isSvmFile(Data,DataSize)) return L"svm";
return L"jpg";
}
\ No newline at end of file
......@@ -28,6 +28,7 @@ _CXIMAGE_FORMAT_RAW = 19,
_CXIMAGE_FORMAT_PSD = 20,
_CXIMAGE_FORMAT_EMF = 21,
_CXIMAGE_FORMAT_WB = 22,
_CXIMAGE_FORMAT_SVM = 23
};
class CImageFileFormatChecker
......@@ -47,6 +48,7 @@ public:
bool isImageFile(std::wstring& fileName);
bool isPngFile(std::wstring& fileName);
bool isSvmFile(std::wstring& fileName);
bool isRawFile(std::wstring& fileName);
bool isSvgFile(std::wstring& fileName);
......
......@@ -248,10 +248,13 @@ void CSvmFile::Read_SVM_HEADER()
m_pDC->SetMapMode(m_oHeader.mapMode, true);
m_oBoundingBox = m_oHeader.boundRect;
m_oBoundingBox.nRight *= m_pDC->m_dPixelWidthPrefered;
m_oBoundingBox.nBottom *= m_pDC->m_dPixelHeightPrefered;
m_oBoundingBox = m_oHeader.boundRect;
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_bFirstPoint = true;
}
void CSvmFile::Read_META_POLYLINE()
......
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