Commit 2c83860c authored by ElenaSubbotina's avatar ElenaSubbotina

Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop

Conflicts:
	DesktopEditor/raster/Metafile/Emf/EmfFile.cpp
parents c64b624d 5e399093
......@@ -811,10 +811,10 @@ namespace DocFileFormat
{
Symbol s = getSymbol( chpx );
m_pXmlWriter->WriteNodeBegin(L"w:sym", true);
m_pXmlWriter->WriteAttribute(L"w:font", FormatUtils::XmlEncode(s.FontName));
m_pXmlWriter->WriteAttribute(L"w:char", FormatUtils::XmlEncode(s.HexValue));
m_pXmlWriter->WriteNodeEnd(L"", true);
//m_pXmlWriter->WriteNodeBegin(L"w:sym", true);
//m_pXmlWriter->WriteAttribute(L"w:font", FormatUtils::XmlEncode(s.FontName));
//m_pXmlWriter->WriteAttribute(L"w:char", FormatUtils::XmlEncode(s.HexValue));
//m_pXmlWriter->WriteNodeEnd(L"", true);
}
else if ((TextMark::DrawnObject == code) && fSpec)
{
......@@ -1663,12 +1663,17 @@ namespace DocFileFormat
FontFamilyName* ffn = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( fontIndex ) );
ret.FontName = ffn->xszFtn;
ret.HexValue = L"f0" + FormatUtils::IntToFormattedWideString( code, L"%02x" );
ret.HexValue = L"f0" + FormatUtils::IntToFormattedWideString( code, L"%02x" );//-123 - ShortToFormattedWideString
break;
}
}
if (ret.HexValue.length() > 4)
{
ret.HexValue = ret.HexValue.substr(ret.HexValue.length() - 4, 4);
}
return ret;
}
......
......@@ -307,6 +307,7 @@ namespace
content << L"<w:" << Node << L"s \
xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" \
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \
......
......@@ -553,7 +553,7 @@ namespace PPTX
std::wstring strFillNode;
std::wstring strStrokeNode;;
CalculateFill(spPr, style, oTheme, oClrMap, strFillAttr, strFillNode, bOle);
CalculateFill(spPr, style, oTheme, oClrMap, strFillAttr, strFillNode, bOle, bSignature);
CalculateLine(spPr, style, oTheme, oClrMap, strStrokeAttr, strStrokeNode, bOle, bSignature);
pWriter->StartNode(L"v:shape");
......
......@@ -59,7 +59,7 @@ namespace PPTX
}
void CalculateFill(PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle, NSCommon::smart_ptr<PPTX::Theme>& oTheme,
NSCommon::smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle)
NSCommon::smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle, bool bSignature)
{
PPTX::Logic::UniFill fill;
DWORD ARGB = 0;
......@@ -113,7 +113,7 @@ namespace PPTX
std::wstring strId = oBlip.blip->embed->ToString();
if(bOle)
if (bOle || bSignature)
{
strAttr = _T(" filled=\"f\"");
strNode = _T("<v:imagedata r:id=\"") + strId + _T("\" o:title=\"\" />");
......
......@@ -44,7 +44,7 @@ namespace PPTX
namespace Logic
{
void CalculateFill(PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle, smart_ptr<PPTX::Theme>& oTheme,
smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle = false);
smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle = false, bool bSignature = false);
void CalculateLine(PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle,
smart_ptr<PPTX::Theme>& oTheme, smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle = false, bool bSignature = false);
......
......@@ -644,7 +644,12 @@ namespace MetaFile
dKoefG = 255.0 / (ulMaskG >> ulShiftG);
dKoefB = 255.0 / (ulMaskB >> ulShiftB);
bMask = true;
if ((ulMaskR >> ulShiftR) == 255 && (ulMaskG >> ulShiftG) == 255 && (ulMaskB >> ulShiftB) == 255)
{
bMask = false; // Proper_Attire_CALT2.odt
}
else
bMask = true;
}
else
return false;
......
......@@ -35,8 +35,142 @@
#include "../../../common/String.h"
#include "../../../fontengine/FontManager.h"
#ifdef _DEBUG
#include <iostream>
#endif
namespace MetaFile
{
static const struct ActionNamesEmf
{
int actionNumber;
std::wstring actionName;
} actionNamesEmf[] =
{
{ 0, L"Unknown"},
{ EMR_HEADER, L"EMR_HEADER"},
{ EMR_POLYBEZIER, L"EMR_POLYBEZIER"},
{ EMR_POLYGON, L"EMR_POLYGON"},
{ EMR_POLYLINE, L"EMR_POLYLINE"},
{ EMR_POLYBEZIERTO, L"EMR_POLYBEZIERTO"},
{ EMR_POLYLINETO, L"EMR_POLYLINETO"},
{ EMR_POLYPOLYLINE, L"EMR_POLYPOLYLINE"},
{ EMR_POLYPOLYGON, L"EMR_POLYPOLYGON"},
{ EMR_SETWINDOWEXTEX, L"EMR_SETWINDOWEXTEX"},
{ EMR_SETWINDOWORGEX, L"EMR_SETWINDOWORGEX"},
{ EMR_SETVIEWPORTEXTEX, L"EMR_SETVIEWPORTEXTEX"},
{ EMR_SETVIEWPORTORGEX, L"EMR_SETVIEWPORTORGEX"},
{ EMR_SETBRUSHORGEX, L"EMR_SETBRUSHORGEX"},
{ EMR_EOF, L"EMR_EOF"},
{ EMR_SETPIXELV, L"EMR_SETPIXELV"},
{ EMR_SETMAPPERFLAGS, L"EMR_SETMAPPERFLAGS"},
{ EMR_SETMAPMODE, L"EMR_SETMAPMODE"},
{ EMR_SETBKMODE, L"EMR_SETBKMODE"},
{ EMR_SETPOLYFILLMODE, L"EMR_SETPOLYFILLMODE"},
{ EMR_SETROP2, L"EMR_SETROP2"},
{ EMR_SETSTRETCHBLTMODE, L"EMR_SETSTRETCHBLTMODE"},
{ EMR_SETTEXTALIGN, L"EMR_SETTEXTALIGN"},
{ EMR_SETCOLORADJUSTMENT, L"EMR_SETCOLORADJUSTMENT"},
{ EMR_SETTEXTCOLOR, L"EMR_SETTEXTCOLOR"},
{ EMR_SETBKCOLOR, L"EMR_SETBKCOLOR"},
{ EMR_OFFSETCLIPRGN, L"EMR_OFFSETCLIPRGN"},
{ EMR_MOVETOEX, L"EMR_MOVETOEX"},
{ EMR_SETMETARGN, L"EMR_SETMETARGN"},
{ EMR_EXCLUDECLIPRECT, L"EMR_EXCLUDECLIPRECT"},
{ EMR_INTERSECTCLIPRECT, L"EMR_INTERSECTCLIPRECT"},
{ EMR_SCALEVIEWPORTEXTEX, L"EMR_SCALEVIEWPORTEXTEX"},
{ EMR_SCALEWINDOWEXTEX, L"EMR_SCALEWINDOWEXTEX"},
{ EMR_SAVEDC, L"EMR_SAVEDC"},
{ EMR_RESTOREDC, L"EMR_RESTOREDC"},
{ EMR_SETWORLDTRANSFORM, L"EMR_SETWORLDTRANSFORM"},
{ EMR_MODIFYWORLDTRANSFORM, L"EMR_MODIFYWORLDTRANSFORM"},
{ EMR_SELECTOBJECT, L"EMR_SELECTOBJECT"},
{ EMR_CREATEPEN, L"EMR_CREATEPEN"},
{ EMR_CREATEBRUSHINDIRECT, L"EMR_CREATEBRUSHINDIRECT"},
{ EMR_DELETEOBJECT, L"EMR_DELETEOBJECT"},
{ EMR_ANGLEARC, L"EMR_ANGLEARC"},
{ EMR_ELLIPSE, L"EMR_ELLIPSE"},
{ EMR_RECTANGLE, L"EMR_RECTANGLE"},
{ EMR_ROUNDRECT, L"EMR_ROUNDRECT"},
{ EMR_ARC, L"EMR_ARC"},
{ EMR_CHORD, L"EMR_CHORD"},
{ EMR_PIE, L"EMR_PIE"},
{ EMR_SELECTPALETTE, L"EMR_SELECTPALETTE"},
{ EMR_CREATEPALETTE, L"EMR_CREATEPALETTE"},
{ EMR_SETPALETTEENTRIES, L"EMR_SETPALETTEENTRIES"},
{ EMR_RESIZEPALETTE, L"EMR_RESIZEPALETTE"},
{ EMR_REALIZEPALETTE, L"EMR_REALIZEPALETTE"},
{ EMR_EXTFLOODFILL, L"EMR_EXTFLOODFILL"},
{ EMR_LINETO, L"EMR_LINETO"},
{ EMR_ARCTO, L"EMR_ARCTO"},
{ EMR_POLYDRAW, L"EMR_POLYDRAW"},
{ EMR_SETARCDIRECTION, L"EMR_SETARCDIRECTION"},
{ EMR_SETMITERLIMIT, L"EMR_SETMITERLIMIT"},
{ EMR_BEGINPATH, L"EMR_BEGINPATH"},
{ EMR_ENDPATH, L"EMR_ENDPATH"},
{ EMR_CLOSEFIGURE, L"EMR_CLOSEFIGURE"},
{ EMR_FILLPATH, L"EMR_FILLPATH"},
{ EMR_STROKEANDFILLPATH, L"EMR_STROKEANDFILLPATH"},
{ EMR_STROKEPATH, L"EMR_STROKEPATH"},
{ EMR_FLATTENPATH, L"EMR_FLATTENPATH"},
{ EMR_WIDENPATH, L"EMR_WIDENPATH"},
{ EMR_SELECTCLIPPATH, L"EMR_SELECTCLIPPATH"},
{ EMR_ABORTPATH, L"EMR_ABORTPATH"},
{ 69, L"Unknown"},
{ EMR_GDICOMMENT, L"EMR_GDICOMMENT"},
{ EMR_FILLRGN, L"EMR_FILLRGN"},
{ EMR_FRAMERGN, L"EMR_FRAMERGN"},
{ EMR_INVERTRGN, L"EMR_INVERTRGN"},
{ EMR_PAINTRGN, L"EMR_PAINTRGN"},
{ EMR_EXTSELECTCLIPRGN, L"EMR_EXTSELECTCLIPRGN"},
{ EMR_BITBLT, L"EMR_BITBLT"},
{ EMR_STRETCHBLT, L"EMR_STRETCHBLT"},
{ EMR_MASKBLT, L"EMR_MASKBLT"},
{ EMR_PLGBLT, L"EMR_PLGBLT"},
{ EMR_SETDIBITSTODEVICE, L"EMR_SETDIBITSTODEVICE"},
{ EMR_STRETCHDIBITS, L"EMR_STRETCHDIBITS"},
{ EMR_EXTCREATEFONTINDIRECTW, L"EMR_EXTCREATEFONTINDIRECTW"},
{ EMR_EXTTEXTOUTA, L"EMR_EXTTEXTOUTA"},
{ EMR_EXTTEXTOUTW, L"EMR_EXTTEXTOUTW"},
{ EMR_POLYBEZIER16, L"EMR_POLYBEZIER16"},
{ EMR_POLYGON16, L"EMR_POLYGON16"},
{ EMR_POLYLINE16, L"EMR_POLYLINE16"},
{ EMR_POLYBEZIERTO16, L"EMR_POLYBEZIERTO16"},
{ EMR_POLYLINETO16, L"EMR_POLYLINETO16"},
{ EMR_POLYPOLYLINE16, L"EMR_POLYPOLYLINE16"},
{ EMR_POLYPOLYGON16, L"EMR_POLYPOLYGON16"},
{ EMR_POLYDRAW16, L"EMR_POLYDRAW16"},
{ EMR_CREATEMONOBRUSH, L"EMR_CREATEMONOBRUSH"},
{ EMR_CREATEDIBPATTERNBRUSHPT,L"EMR_CREATEDIBPATTERNBRUSHPT"},
{ EMR_EXTCREATEPEN, L"EMR_EXTCREATEPEN"},
{ EMR_POLYTEXTOUTA, L"EMR_POLYTEXTOUTA"},
{ EMR_POLYTEXTOUTW, L"EMR_POLYTEXTOUTW"},
{ EMR_SETICMMODE, L"EMR_SETICMMODE"},
{ EMR_CREATECOLORSPACE, L"EMR_CREATECOLORSPACE"},
{ EMR_SETCOLORSPACE, L"EMR_SETCOLORSPACE"},
{ EMR_DELETECOLORSPACE, L"EMR_DELETECOLORSPACE"},
{ EMR_GLSRECORD, L"EMR_GLSRECORD"},
{ EMR_GLSBOUNDEDRECORD, L"EMR_GLSBOUNDEDRECORD"},
{ EMR_PIXELFORMAT, L"EMR_PIXELFORMAT"},
{ EMR_RESERVED_105, L"EMR_RESERVED_105"},
{ EMR_RESERVED_106, L"EMR_RESERVED_106"},
{ EMR_RESERVED_107, L"EMR_RESERVED_107"},
{ EMR_RESERVED_108, L"EMR_RESERVED_108"},
{ EMR_RESERVED_109, L"EMR_RESERVED_109"},
{ EMR_RESERVED_110, L"EMR_RESERVED_110"},
{ EMR_COLORCORRECTPALETTE, L"EMR_COLORCORRECTPALETTE"},
{ EMR_SETICMPROFILEA, L"EMR_SETICMPROFILEA"},
{ EMR_SETICMPROFILEW, L"EMR_SETICMPROFILEW"},
{ EMR_ALPHABLEND, L"EMR_ALPHABLEND"},
{ EMR_SETLAYOUT, L"EMR_SETLAYOUT"},
{ EMR_TRANSPARENTBLT, L"EMR_TRANSPARENTBLT"},
{ EMR_RESERVED_117, L"EMR_RESERVED_117"},
{ EMR_GRADIENTFILL, L"EMR_GRADIENTFILL"},
{ EMR_RESERVED_119, L"EMR_RESERVED_119"},
{ EMR_RESERVED_120, L"EMR_RESERVED_120"},
{ EMR_COLORMATCHTOTARGETW, L"EMR_COLORMATCHTOTARGETW"},
{ EMR_CREATECOLORSPACEW, L"EMR_CREATECOLORSPACEW "}
};
void CEmfFile::PlayMetaFile()
{
if (!m_oStream.IsValid())
......@@ -47,7 +181,8 @@ namespace MetaFile
bool bEof = false;
unsigned int ulRecordIndex = 0;
unsigned int ulRecordIndex = 0;
unsigned int m_ulRecordPos = 0;
if (m_pOutput)
m_pOutput->Begin();
......@@ -60,7 +195,8 @@ namespace MetaFile
m_oStream >> ulType;
m_oStream >> ulSize;
m_ulRecordSize = ulSize - 8;
m_ulRecordPos = m_oStream.Tell();
m_ulRecordSize = ulSize - 8;
if (ulType < EMR_MIN || ulType > EMR_MAX)
{
......@@ -101,7 +237,7 @@ namespace MetaFile
// 2.3.5 Drawing
//-----------------------------------------------------------
case EMR_ANGLEARC: Read_EMR_ANGLEARC(); break;
case EMR_ARC: Read_EMR_ARC(); break;
case EMR_ARC: Read_EMR_ARC(); break;
case EMR_ARCTO: Read_EMR_ARCTO(); break;
case EMR_CHORD: Read_EMR_CHORD(); break;
case EMR_ELLIPSE: Read_EMR_ELLIPSE(); break;
......@@ -109,7 +245,7 @@ namespace MetaFile
case EMR_EXTTEXTOUTW: Read_EMR_EXTTEXTOUTW(); break;
case EMR_FILLPATH: Read_EMR_FILLPATH(); break;
case EMR_LINETO: Read_EMR_LINETO(); break;
case EMR_PIE: Read_EMR_PIE(); break;
case EMR_PIE: Read_EMR_PIE(); break;
case EMR_POLYBEZIER: Read_EMR_POLYBEZIER(); break;
case EMR_POLYBEZIER16: Read_EMR_POLYBEZIER16(); break;
case EMR_POLYBEZIERTO: Read_EMR_POLYBEZIERTO(); break;
......@@ -140,7 +276,7 @@ namespace MetaFile
case EMR_CREATEBRUSHINDIRECT: Read_EMR_CREATEBRUSHINDIRECT(); break;
case EMR_CREATEDIBPATTERNBRUSHPT: Read_EMR_CREATEDIBPATTERNBRUSHPT(); break;
case EMR_CREATEPALETTE: Read_EMR_CREATEPALETTE(); break;
case EMR_CREATEPEN: Read_EMR_CREATEPEN(); break;
case EMR_CREATEPEN: Read_EMR_CREATEPEN(); break;
case EMR_EXTCREATEFONTINDIRECTW: Read_EMR_EXTCREATEFONTINDIRECTW(); break;
case EMR_EXTCREATEPEN: Read_EMR_EXTCREATEPEN(); break;
//-----------------------------------------------------------
......@@ -204,6 +340,17 @@ namespace MetaFile
if (bEof)
break;
int need_skip = m_ulRecordSize - (m_oStream.Tell() - m_ulRecordPos);
m_oStream.Skip(need_skip);
#ifdef _DEBUG
if ( need_skip != 0 && !m_pOutput)
{
std::wstring name = actionNamesEmf[ulType].actionName;
std::wcout << name << L"\t\t(" << ulType << L")\t; skiped = " << need_skip << L"\n";
}
#endif
ulRecordIndex++;
} while (!CheckError());
......@@ -738,9 +885,9 @@ namespace MetaFile
{
// Делаем цветом кисти
pBgraBuffer = new BYTE[4];
pBgraBuffer[0] = pBrush->Color.b;
pBgraBuffer[0] = pBrush->Color.b;
pBgraBuffer[1] = pBrush->Color.g;
pBgraBuffer[2] = pBrush->Color.r;
pBgraBuffer[2] = pBrush->Color.r;
pBgraBuffer[3] = 30;
ulWidth = 1;
......@@ -1425,6 +1572,8 @@ namespace MetaFile
template<typename T>void CEmfFile::Read_EMR_POLYDRAW_BASE()
{
// TODO: Как найдутся файлы проверить данную запись.
//bug #35006 - не прочитывается весь рекорд ... выравнивание?
TEmfRectL oBounds;
m_oStream >> oBounds;
......
......@@ -360,6 +360,8 @@ namespace MetaFile
struct TEmfHeader
{
TEmfHeader() : ulSignature(0), ulVersion(0), ulRecords(0), ushObjects(0), ulSize(0), ulPalEntries(0), ulOffsetDescription(0),ulSizeDescription(0) {}
TEmfRectL oBounds;
TEmfRectL oFrame;
unsigned int ulSignature;
......
......@@ -50,11 +50,11 @@
namespace MetaFile
{
static const struct ActionNames
static const struct ActionNamesSmv
{
int actionNumber;
std::wstring actionName;
} actionNames[] =
} actionNamesSmv[] =
{
{ META_NULL_ACTION, L"META_NULL_ACTION" },
{ META_PIXEL_ACTION, L"META_PIXEL_ACTION" },
......@@ -224,7 +224,7 @@ void CSvmFile::PlayMetaFile()
#ifdef _DEBUG
if (100 <= actionType && actionType <= META_LAST_ACTION && need_skip > 0 && !m_pOutput)
{
std::wstring name = actionNames[actionType - 99].actionName;
std::wstring name = actionNamesSmv[actionType - 99].actionName;
std::wcout << name << L"\t\t" << actionType << L"\t(version = " << m_currentActionVersion << L")\t; skiped = " << need_skip << L"\n";
}
......
......@@ -77,6 +77,11 @@ public:
std::wstring GetImageBase64(const std::wstring& file)
{
if (0 == file.find(L"data:image/"))
{
return file.substr(file.find(L",") + 1);
}
BYTE* pData = NULL;
DWORD dwLen = 0;
if (!NSFile::CFileBinary::ReadAllBytes(file, &pData, dwLen))
......@@ -97,6 +102,8 @@ public:
std::wstring GetRelsReference(const std::wstring& file)
{
COOXMLRelationships oRels(m_sFolder + file, true);
if (oRels.rels.size() == 0)
return L"";
if (L"/_rels/.rels" == file)
{
......
......@@ -177,7 +177,15 @@ public:
std::wstring sSetupID = FindFirstChild(GetObjectById("idOfficeObject"), L"SetupID").GetText();
m_guid = U_TO_UTF8(sSetupID);
// 2) Check files (Manifect)
// 2) Images
XmlUtils::CXmlNode nodeImageValid = GetObjectById("idValidSigLnImg");
if (nodeImageValid.IsValid())
m_sImageValidBase64 = GetBase64Image(nodeImageValid);
XmlUtils::CXmlNode nodeImageInvalid = GetObjectById("idInvalidSigLnImg");
if (nodeImageInvalid.IsValid())
m_sImageInvalidBase64 = GetBase64Image(nodeImageInvalid);
// 3) Check files (Manifect)
XmlUtils::CXmlNode nodeManifect = GetObjectById("idPackageObject");
if (!nodeManifect.IsValid())
{
......@@ -197,14 +205,6 @@ public:
return;
}
// 3) Images
XmlUtils::CXmlNode nodeImageValid = GetObjectById("idValidSigLnImg");
if (nodeImageValid.IsValid())
m_sImageValidBase64 = GetBase64Image(nodeImageValid);
XmlUtils::CXmlNode nodeImageInvalid = GetObjectById("idInvalidSigLnImg");
if (nodeImageInvalid.IsValid())
m_sImageInvalidBase64 = GetBase64Image(nodeImageInvalid);
// 4) Objects
XmlUtils::CXmlNodes nodesReferences;
m_node.ReadNode(L"SignedInfo").GetNodes(L"Reference", nodesReferences);
......
......@@ -7,7 +7,7 @@
QT -= core
QT -= gui
VERSION = 2.4.461.0
VERSION = 2.4.462.0
DEFINES += INTVER=$$VERSION
TARGET = x2t
......
......@@ -487,7 +487,11 @@ namespace NExtractTools
}
else if(_T("m_nCsvDelimiterChar") == sName)
{
m_sCsvDelimiterChar = new std::wstring(L"");
std::wstring sNil;
if (!oXmlNode.GetAttributeIfExist(L"xsi:nil", sNil))
{
m_sCsvDelimiterChar = new std::wstring(L"");
}
}
}
}
......
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