diff --git a/ASCOfficeOdfFile/src/docx/oox_drawing.cpp b/ASCOfficeOdfFile/src/docx/oox_drawing.cpp index 731e0116fd..4428061211 100644 --- a/ASCOfficeOdfFile/src/docx/oox_drawing.cpp +++ b/ASCOfficeOdfFile/src/docx/oox_drawing.cpp @@ -55,7 +55,7 @@ static const std::wstring _ooxDashStyle[]= L"sysDashDotDot" }; -void oox_serialize_ln(std::wostream & strm, const std::vector & prop) +void oox_serialize_ln(std::wostream & strm, const std::vector & 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 & val); + void oox_serialize_ln (std::wostream & strm, const std::vector & 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 & val); void oox_serialize_aLst (std::wostream & strm, const std::vector & val); diff --git a/ASCOfficeOdfFile/src/docx/oox_package.cpp b/ASCOfficeOdfFile/src/docx/oox_package.cpp index 22e1e7924f..cc6877d7cc 100644 --- a/ASCOfficeOdfFile/src/docx/oox_package.cpp +++ b/ASCOfficeOdfFile/src/docx/oox_package.cpp @@ -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_); } diff --git a/ASCOfficeOdfFile/src/docx/xlsx_drawing.cpp b/ASCOfficeOdfFile/src/docx/xlsx_drawing.cpp index d0f8112885..db3bb73fee 100644 --- a/ASCOfficeOdfFile/src/docx/xlsx_drawing.cpp +++ b/ASCOfficeOdfFile/src/docx/xlsx_drawing.cpp @@ -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); diff --git a/ASCOfficeOdfFile/src/odf/table_xlsx.cpp b/ASCOfficeOdfFile/src/odf/table_xlsx.cpp index a9c6dfd31e..965193dafd 100644 --- a/ASCOfficeOdfFile/src/odf/table_xlsx.cpp +++ b/ASCOfficeOdfFile/src/odf/table_xlsx.cpp @@ -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; } diff --git a/DesktopEditor/raster/ImageFileFormatChecker.cpp b/DesktopEditor/raster/ImageFileFormatChecker.cpp index a31c4f5366..a631f0e116 100644 --- a/DesktopEditor/raster/ImageFileFormatChecker.cpp +++ b/DesktopEditor/raster/ImageFileFormatChecker.cpp @@ -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 diff --git a/DesktopEditor/raster/ImageFileFormatChecker.h b/DesktopEditor/raster/ImageFileFormatChecker.h index 69c4eb0903..a39fd6718f 100644 --- a/DesktopEditor/raster/ImageFileFormatChecker.h +++ b/DesktopEditor/raster/ImageFileFormatChecker.h @@ -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); diff --git a/DesktopEditor/raster/Metafile/StarView/SvmFile.cpp b/DesktopEditor/raster/Metafile/StarView/SvmFile.cpp index 02c2507611..ca8bc81217 100644 --- a/DesktopEditor/raster/Metafile/StarView/SvmFile.cpp +++ b/DesktopEditor/raster/Metafile/StarView/SvmFile.cpp @@ -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()