Compare commits

..

21 Commits

Author SHA1 Message Date
d3914f513b [x2t] Remove extra space 2022-08-26 00:00:19 +03:00
5c202eece6 Fix big metafiles 2022-08-25 15:53:33 +03:00
bd32484a1e Merge branch 'release/v7.2.0' of https://github.com/ONLYOFFICE/core into release/v7.2.0 2022-08-25 14:50:50 +03:00
b4ae30d5b2 Fix bug 58216 2022-08-25 14:47:28 +03:00
1ff71c824c TextFormPrComplex 2022-08-25 12:49:19 +03:00
7482463667 Fix compile module 2022-08-25 12:26:09 +03:00
d0cda627dd . 2022-08-25 11:13:29 +03:00
7df0bcea7f TextFormPrFormat 2022-08-25 10:55:06 +03:00
43429aa84b Fix xp build 2022-08-24 17:44:51 +03:00
b19bce8d30 Refactoring 2022-08-24 13:34:01 +03:00
be8771f21b Merge pull request #1001 from ONLYOFFICE/fix/bug36412
Fix bug 36412, 55591
2022-08-24 13:31:48 +03:00
91af8c2b62 fix bug #58677 2022-08-24 12:31:20 +03:00
9917f7907d fix bug #58613 2022-08-24 12:21:06 +03:00
65d6a6f56d fix bug #58624 2022-08-24 11:34:01 +03:00
7e79a38520 Merge pull request #1008 from ONLYOFFICE/fix/bug58584
Fix bug 58584
2022-08-24 11:09:30 +03:00
55eb92bfc1 Merge pull request #1009 from ONLYOFFICE/fix/bug58096
Fix bug 58096
2022-08-24 10:59:23 +03:00
34407c4a1c fix dTfs 2022-08-18 18:18:07 +03:00
a51a953d83 Crash fixed 2022-08-18 14:37:09 +03:00
8d42cf008d Fix bug 58584 2022-08-18 14:11:24 +03:00
f40e1997c9 Fix bug 58096 2022-08-16 18:51:25 +03:00
6724f57810 Fix bug 36412, 55591
partially 58084
2022-08-05 12:10:59 +03:00
27 changed files with 431 additions and 66 deletions

View File

@ -1185,7 +1185,7 @@ int Binary_pPrReader::ReadInd(BYTE type, long length, void* poResult)
long nIndFirstLine = SerializeCommon::Round(dIndFirstLine * g_dKoef_mm_to_twips);
std::wstring sIndFirstLine;
if(nIndFirstLine >= 0)
sIndFirstLine = L" w:firstLine =\"" + std::to_wstring(nIndFirstLine) + L"\"";
sIndFirstLine = L" w:firstLine=\"" + std::to_wstring(nIndFirstLine) + L"\"";
else
sIndFirstLine = L" w:hanging=\"" + std::to_wstring(-nIndFirstLine) + L"\"";
pCStringWriter->WriteString(sIndFirstLine);
@ -1196,7 +1196,7 @@ int Binary_pPrReader::ReadInd(BYTE type, long length, void* poResult)
long nIndFirstLine = m_oBufferedStream.GetLong();
std::wstring sIndFirstLine;
if(nIndFirstLine >= 0)
sIndFirstLine = L" w:firstLine =\"" + std::to_wstring(nIndFirstLine) + L"\"";
sIndFirstLine = L" w:firstLine=\"" + std::to_wstring(nIndFirstLine) + L"\"";
else
sIndFirstLine = L" w:hanging=\"" + std::to_wstring(-nIndFirstLine) + L"\"";
pCStringWriter->WriteString(sIndFirstLine);
@ -9648,6 +9648,37 @@ int Binary_DocumentTableReader::ReadSdtTextFormPr(BYTE type, long length, void*
{
pTextFormPr->m_oMultiLine = m_oBufferedStream.GetBool();
}
else if (c_oSerSdt::TextFormPrFormat == type)
{
pTextFormPr->m_oFormat.Init();
READ2_DEF(length, res, this->ReadSdtTextFormPrFormat, pTextFormPr->m_oFormat.GetPointer());
}
else if (c_oSerSdt::TextFormPrComplex == type)
{
pTextFormPr->m_oComplexForm = true;
READ2_DEF(length, res, this->ReadSdtTextFormPrComplex, pTextFormPr->m_oFormat.GetPointer());
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int Binary_DocumentTableReader::ReadSdtTextFormPrComplex(BYTE type, long length, void* poResult)
{
int res = 0;
return res;
}
int Binary_DocumentTableReader::ReadSdtTextFormPrFormat(BYTE type, long length, void* poResult)
{
int res = 0;
ComplexTypes::Word::CTextFormFormat* pFormat = static_cast<ComplexTypes::Word::CTextFormFormat*>(poResult);
if (c_oSerSdt::TextFormPrFormatType == type)
{
pFormat->m_oType.Init(); pFormat->m_oType->SetValueFromByte(m_oBufferedStream.GetChar());
}
else if (c_oSerSdt::TextFormPrFormatString == type)
{
pFormat->m_oFormat = m_oBufferedStream.GetString3(length);
}
else
res = c_oSerConstants::ReadUnknown;
return res;

View File

@ -479,6 +479,8 @@ public:
int ReadSdtFormPr(BYTE type, long length, void* poResult);
int ReadSdtTextFormPr(BYTE type, long length, void* poResult);
int ReadSdtTextFormPrComb(BYTE type, long length, void* poResult);
int ReadSdtTextFormPrFormat(BYTE type, long length, void* poResult);
int ReadSdtTextFormPrComplex(BYTE type, long length, void* poResult);
int ReadSdtPicture(BYTE type, long length, void* poResult);
};
class Binary_NotesTableReader : public Binary_CommonReader

View File

@ -1252,6 +1252,7 @@ extern int g_nCurFormatVersion;
TextFormPrCombBorder = 56,
TextFormPrAutoFit = 57,
TextFormPrMultiLine = 58,
TextFormPrFormat = 59,
PictureFormPr = 60,
PictureFormPrScaleFlag = 61,
PictureFormPrLockProportions = 62,
@ -1260,7 +1261,10 @@ extern int g_nCurFormatVersion;
PictureFormPrShiftY = 65,
FormPrBorder = 70,
FormPrShd = 71,
TextFormPrCombWRule = 72
TextFormPrCombWRule = 72,
TextFormPrFormatType = 80,
TextFormPrFormatString = 81,
TextFormPrComplex = 90
};}
namespace c_oSerFFData{enum c_oSerFFData
{

View File

@ -8007,6 +8007,38 @@ void BinaryDocumentTableWriter::WriteSdtTextFormPr(const OOX::Logic::CTextFormPr
m_oBcw.m_oStream.WriteBOOL(oTextFormPr.m_oMultiLine.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if (oTextFormPr.m_oFormat.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::TextFormPrMultiLine);
WriteSdtTextFormPrFormat(oTextFormPr.m_oFormat.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if (oTextFormPr.m_oFormat.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::TextFormPrComplex);
WriteSdtTextFormPrComplex(/*oTextFormPr.m_oComplexForm*/);
m_oBcw.WriteItemEnd(nCurPos);
}
}
void BinaryDocumentTableWriter::WriteSdtTextFormPrComplex(/*const ComplexTypes::Word::CTextFormComplex& oFormat*/)
{
}
void BinaryDocumentTableWriter::WriteSdtTextFormPrFormat(const ComplexTypes::Word::CTextFormFormat& oFormat)
{
int nCurPos = 0;
if (oFormat.m_oType.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::TextFormPrFormatString);
m_oBcw.m_oStream.WriteBYTE((BYTE)oFormat.m_oType->GetValue());
m_oBcw.WriteItemEnd(nCurPos);
}
if (oFormat.m_oFormat.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::TextFormPrFormatString);
m_oBcw.m_oStream.WriteStringW3(oFormat.m_oFormat.get());
m_oBcw.WriteItemEnd(nCurPos);
}
}
void BinaryDocumentTableWriter::WriteSdtTextFormPrComb(const ComplexTypes::Word::CComb& oComb)
{

View File

@ -503,6 +503,8 @@ namespace BinDocxRW
void WriteSdtFormPr(const OOX::Logic::CFormPr& oFormPr);
void WriteSdtTextFormPr(const OOX::Logic::CTextFormPr& oTextFormPr);
void WriteSdtTextFormPrComb(const ComplexTypes::Word::CComb& oComb);
void WriteSdtTextFormPrFormat(const ComplexTypes::Word::CTextFormFormat& oFormat);
void WriteSdtTextFormPrComplex(/*const ComplexTypes::Word::CTextFormComplex& oFormat*/);
void WriteSdtPicture(const OOX::Logic::CSdtPicture& oSdtPicture);
};
class BinaryCustomsTableWriter

View File

@ -320,7 +320,7 @@ typedef xml::writer::element<wchar_t> xml_element;
#define CP_XML_ATTR_OPT(NAME, VAL) if (VAL)CP_XML_ATTR(NAME, (*VAL))
#define CP_XML_ATTR_OPT_ENCODE_STRING(NAME, STR) if (STR)CP_XML_ATTR(NAME, XmlUtils::EncodeXmlString(XmlUtils::EncodeXmlString(*STR)))
#define CP_XML_ATTR_OPT_ENCODE_STRING(NAME, STR) if (STR)CP_XML_ATTR(NAME, XmlUtils::EncodeXmlString(*STR))
#define CP_XML_NODE_SIMPLE() std::wstring NS_NAME = std::wstring(ns) + std::wstring(L":") + std::wstring(name); CP_XML_NODE(NS_NAME)

View File

@ -481,7 +481,7 @@ void style::serialize(std::wostream & strm)
CP_XML_ATTR_OPT(L"style:master-page-name", style_master_page_name_);
CP_XML_ATTR_OPT_ENCODE_STRING(L"style:display-name", style_display_name_);
CP_XML_ATTR(L"style:family", style_family_);
CP_XML_ATTR(L"style:name", style_name_);
CP_XML_ATTR(L"style:name", XmlUtils::EncodeXmlString(style_name_));
content_.serialize(CP_XML_STREAM());
}

View File

@ -1505,6 +1505,9 @@ namespace PPTX
pWriter->EndAttributes();
pWriter->EndNode(L"v:path");
pWriter->WriteString(pWriter->m_strNodes);
pWriter->m_strNodes.clear();
if (blipFill.blip.is_init() && blipFill.blip->embed.is_init())
{
pWriter->StartNode(L"v:imagedata");

View File

@ -435,8 +435,9 @@ namespace NSCSS
{
std::map<StatistickElement, unsigned int>::const_iterator oFindCountId = m_mStatictics->find(StatistickElement{StatistickElement::IsId, sId});
if (((bIsSettings && oFindCountId->second < MaxNumberRepetitions) ||
(!bIsSettings && oFindCountId->second >= MaxNumberRepetitions)))
if ((m_mStatictics->end() != oFindCountId) &&
(((bIsSettings && oFindCountId->second < MaxNumberRepetitions) ||
(!bIsSettings && oFindCountId->second >= MaxNumberRepetitions))))
{
if (!oFindId->second->Empty())
arFindElements.push_back(oFindId->second);

View File

@ -2545,8 +2545,51 @@ namespace SimpleTypes
SimpleType_FromString (EHeightRule)
SimpleType_Operator_Equal (CHeightRule)
};
//--------------------------------------------------------------------------------
// TextFormFormatType
//--------------------------------------------------------------------------------
enum ETextFormFormatType
{
textFormFormatTypeNone = 0,
textFormFormatTypeDigit = 2,
textFormFormatTypeLetter = 3,
textFormFormatTypeMask = 4,
textFormFormatTypeRegExp = 5
};
template<ETextFormFormatType eDefValue = textFormFormatTypeNone>
class CTextFormFormatType : public CSimpleType<ETextFormFormatType, eDefValue>
{
public:
CTextFormFormatType() {}
virtual ETextFormFormatType FromString(std::wstring &sValue)
{
if (L"none" == sValue) this->m_eValue = textFormFormatTypeNone;
else if (L"digit" == sValue) this->m_eValue = textFormFormatTypeDigit;
else if (L"letter" == sValue) this->m_eValue = textFormFormatTypeLetter;
else if (L"mask" == sValue) this->m_eValue = textFormFormatTypeMask;
else if (L"regExp" == sValue) this->m_eValue = textFormFormatTypeRegExp;
else this->m_eValue = eDefValue;
return this->m_eValue;
}
virtual std::wstring ToString() const
{
switch (this->m_eValue)
{
case textFormFormatTypeNone: return L"none";
case textFormFormatTypeDigit: return L"digit";
case textFormFormatTypeLetter: return L"letter";
case textFormFormatTypeMask: return L"mask";
case textFormFormatTypeRegExp: return L"regExp";
default: return (L"none");
}
}
SimpleType_FromString(ETextFormFormatType)
SimpleType_Operator_Equal(CTextFormFormatType)
};
//--------------------------------------------------------------------------------
// HexColor 17.18.38 (Part 1)
//--------------------------------------------------------------------------------

View File

@ -99,6 +99,39 @@ namespace ComplexTypes
WritingElement_ReadAttributes_Read_else_if(oReader, L"w:wRule", m_oWRule )
WritingElement_ReadAttributes_End( oReader )
}
//----------------------------------------------------------------------------------------------------
void CTextFormFormat::FromXML(XmlUtils::CXmlNode& oNode)
{
XmlMacroReadAttributeBase(oNode, L"w:type", m_oType);
XmlMacroReadAttributeBase(oNode, L"w:format", m_oFormat);
}
void CTextFormFormat::FromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes(oReader);
if (!oReader.IsEmptyNode())
oReader.ReadTillEnd();
}
std::wstring CTextFormFormat::ToString() const
{
std::wstring sResult;
if (m_oType.IsInit())
{
sResult += L"w:type=\"" + m_oType->ToString() + L"\" ";
}
if (m_oFormat.IsInit())
{
sResult += L"w:sym=\"" + XmlUtils::EncodeXmlString(m_oFormat.get()) + L"\" ";
}
return sResult;
}
void CTextFormFormat::ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start(oReader)
WritingElement_ReadAttributes_Read_if(oReader, L"w:type", m_oType)
WritingElement_ReadAttributes_Read_else_if(oReader, L"w:format", m_oFormat)
WritingElement_ReadAttributes_End(oReader)
}
}
}
//-----------------------------------------------------------------------------------------------------------------------------
@ -403,6 +436,12 @@ namespace OOX
WritingElement_ReadNode( oNode, oChild, L"w:comb", m_oComb );
WritingElement_ReadNode( oNode, oChild, L"w:maxCharacters", m_oMaxCharacters );
WritingElement_ReadNode( oNode, oChild, L"w:combBorder", m_oCombBorder );
WritingElement_ReadNode( oNode, oChild, L"w:format", m_oFormat);
if (oNode.GetNode(L"w:complexForm", oChild))
{//feature
m_oComplexForm = true;
}
}
void CTextFormPr::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
@ -421,6 +460,13 @@ namespace OOX
m_oMaxCharacters = oReader;
else if ( L"w:combBorder" == sName )
m_oCombBorder = oReader;
else if (L"w:format" == sName)
m_oFormat = oReader;
else if (L"w:complexForm" == sName)
{
//m_oComplexForm = oReader;
m_oComplexForm = true;
}
}
}
std::wstring CTextFormPr::toXML() const
@ -438,6 +484,9 @@ namespace OOX
WritingElement_WriteNode_1( L"<w:comb ", m_oComb );
WritingElement_WriteNode_1( L"<w:maxCharacters ", m_oMaxCharacters );
WritingElement_WriteNode_1( L"<w:combBorder ", m_oCombBorder );
WritingElement_WriteNode_1( L"<w:format ", m_oFormat);
if (m_oComplexForm.IsInit())
sResult += L"<w:complexForm/>";
sResult += L"</w:textFormPr>";

View File

@ -429,6 +429,29 @@ namespace ComplexTypes
nullable_string m_oSym;
nullable_string m_oFont;
};
//Not from specification
class CTextFormFormat : public ComplexType
{
public:
ComplexTypes_AdditionConstructors(CTextFormFormat)
CTextFormFormat()
{
}
virtual ~CTextFormFormat()
{
}
virtual void FromXML(XmlUtils::CXmlNode& oNode);
virtual void FromXML(XmlUtils::CXmlLiteReader& oReader);
virtual std::wstring ToString() const;
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
public:
nullable<SimpleTypes::CTextFormFormatType<>> m_oType;
nullable_string m_oFormat;
};
} // Word
} // ComplexTypes
@ -486,6 +509,8 @@ namespace OOX
nullable<ComplexTypes::Word::CBorder> m_oCombBorder;
nullable_bool m_oAutoFit;
nullable_bool m_oMultiLine;
nullable<ComplexTypes::Word::CTextFormFormat> m_oFormat;
nullable_bool m_oComplexForm; //feature
};
//--------------------------------------------------------------------------------
// CSdtComboBox 17.5.2.5 (Part 1)
@ -590,11 +615,8 @@ namespace OOX
}
public:
nullable<std::wstring > m_sLastValue;
// Attributes
nullable<std::wstring > m_sLastValue;
// Nodes
std::vector<ComplexTypes::Word::CSdtListItem*> m_arrListItem;
};

View File

@ -494,6 +494,7 @@ defineTest(ADD_DEPENDENCY) {
build_xp {
isEqual(lib, doctrenderer):CORE_BUILDS_LIBRARIES_PATH_DST=$$CORE_BUILDS_LIBRARIES_PATH/xp
isEqual(lib, ascdocumentscore):CORE_BUILDS_LIBRARIES_PATH_DST=$$CORE_BUILDS_LIBRARIES_PATH/xp
isEqual(lib, qtascdocumentscore):CORE_BUILDS_LIBRARIES_PATH_DST=$$CORE_BUILDS_LIBRARIES_PATH/xp
isEqual(lib, videoplayer):CORE_BUILDS_LIBRARIES_PATH_DST=$$CORE_BUILDS_LIBRARIES_PATH/xp
isEqual(lib, ooxmlsignature):CORE_BUILDS_LIBRARIES_PATH_DST=$$CORE_BUILDS_LIBRARIES_PATH/xp
}

View File

@ -68,6 +68,7 @@ namespace Aggplus
m_dDpiTile = -1;
m_nTextRenderMode = FT_RENDER_MODE_NORMAL;
m_nBlendMode = agg::comp_op_src_over;
}
CGraphics::CGraphics(int dwWidth, int dwHeight, int stride, BYTE* pBuffer) : m_dwConfigFlags(0)
@ -101,6 +102,7 @@ namespace Aggplus
m_dDpiTile = -1;
m_nTextRenderMode = FT_RENDER_MODE_NORMAL;
m_nBlendMode = agg::comp_op_src_over;
}
CGraphics::CGraphics(CImage* pImage) : m_dwConfigFlags(0)
@ -139,6 +141,7 @@ namespace Aggplus
m_dDpiTile = -1;
m_nTextRenderMode = FT_RENDER_MODE_NORMAL;
m_nBlendMode = agg::comp_op_src_over;
}
CGraphics::~CGraphics()
@ -1283,11 +1286,29 @@ namespace Aggplus
void CGraphics::DoFillPathSolid(CColor dwColor)
{
typedef agg::renderer_scanline_aa_solid<base_renderer_type> solid_renderer_type;
solid_renderer_type ren_fine(m_frame_buffer.ren_base());
ren_fine.color(dwColor.GetAggColor());
render_scanlines(ren_fine);
if (m_nBlendMode != agg::comp_op_src_over)
{
typedef agg::renderer_scanline_aa_solid<comp_renderer_type> solid_comp_renderer_type;
solid_comp_renderer_type ren_solid;
comp_renderer_type ren_base;
pixfmt_type_comp pixfmt;
pixfmt.attach(m_frame_buffer.ren_buf());
pixfmt.comp_op(m_nBlendMode);
ren_base.attach(pixfmt);
ren_solid.attach(ren_base);
ren_solid.color(dwColor.GetAggColor());
render_scanlines(ren_solid);
}
else
{
typedef agg::renderer_scanline_aa_solid<base_renderer_type> solid_renderer_type;
solid_renderer_type ren_fine(m_frame_buffer.ren_base());
ren_fine.color(dwColor.GetAggColor());
render_scanlines(ren_fine);
}
}
void CGraphics::DoFillPathGradient(CBrushLinearGradient *pBrush)

View File

@ -128,9 +128,12 @@ typedef agg::rendering_buffer rendering_buffer_type;
typedef agg::pixfmt_bgra32 pixformat_type;
typedef agg::blender_rgba< agg::svg::color_type, agg::svg::component_order > blender_type;
typedef agg::comp_op_adaptor_rgba< agg::svg::color_type, agg::svg::component_order > blender_type_comp;
typedef agg::pixfmt_alpha_blend_rgba< blender_type, agg::rendering_buffer, agg::svg::pixel_type > pixfmt_type;
typedef agg::pixfmt_custom_blend_rgba< blender_type_comp, agg::rendering_buffer> pixfmt_type_comp;
typedef agg::renderer_base<pixfmt_type> base_renderer_type;
typedef agg::renderer_base<pixfmt_type_comp> comp_renderer_type;
typedef agg::scanline_u8 scanline_type;
typedef agg::span_interpolator_linear<> interpolator_type_linear;
@ -304,6 +307,7 @@ public:
CGraphics_ClipState m_oClipState;
int m_nTextRenderMode;
unsigned int m_nBlendMode;
public:

View File

@ -1442,3 +1442,10 @@ void CGraphicsRenderer::Restore()
RELEASEOBJECT(pState);
}
void CGraphicsRenderer::put_BlendMode(const unsigned int nBlendMode)
{
if (NULL != m_pRenderer)
{
m_pRenderer->m_nBlendMode = nBlendMode;
}
}

View File

@ -274,6 +274,7 @@ public:
{
_SetFont();
}
virtual void put_BlendMode(const unsigned int nBlendMode) override;
public:
virtual void CloseFont()

View File

@ -126,6 +126,7 @@ namespace NSGraphics
// test
virtual void put_BrushGradInfo(const NSStructures::GradientInfo &_ginfo) = 0;
virtual void put_BlendMode(const unsigned int nBlendMode) = 0;
};
GRAPHICS_DECL IGraphicsRenderer* Create();

View File

@ -34,28 +34,31 @@
namespace MetaFile
{
class CMetaFile : public IMetaFile
{
public:
CMetaFile(NSFonts::IApplicationFonts *pAppFonts) : IMetaFile(pAppFonts) {}
virtual ~CMetaFile() {}
{
public:
CMetaFile(NSFonts::IApplicationFonts *pAppFonts) : IMetaFile(pAppFonts) {}
virtual ~CMetaFile() {}
virtual bool LoadFromFile(const wchar_t* wsFilePath) { return false; }
virtual bool DrawOnRenderer(IRenderer* pRenderer, double dX, double dY, double dWidth, double dHeight) { return false; }
virtual void Close() {}
virtual void GetBounds(double* pdX, double* pdY, double* pdW, double* pdH) {}
virtual int GetType() { return 0; }
virtual void ConvertToRaster(const wchar_t* wsOutFilePath, unsigned int unFileType, int nWidth, int nHeight = -1) {}
virtual NSFonts::IFontManager* get_FontManager() { return NULL; }
virtual bool LoadFromFile(const wchar_t* wsFilePath) { return false; }
virtual bool LoadFromBuffer(BYTE* pBuffer, unsigned int unSize) { return false; }
virtual bool DrawOnRenderer(IRenderer* pRenderer, double dX, double dY, double dWidth, double dHeight) { return false; }
virtual void Close() {}
virtual void GetBounds(double* pdX, double* pdY, double* pdW, double* pdH) {}
virtual int GetType() { return 0; }
virtual void ConvertToRaster(const wchar_t* wsOutFilePath, unsigned int unFileType, int nWidth, int nHeight = -1) {}
virtual NSFonts::IFontManager* get_FontManager() { return NULL; }
virtual void ConvertToXml(const wchar_t* wsFilePath) {}
virtual void ConvertToXmlAndRaster(const wchar_t *wsXmlFilePath, const wchar_t* wsOutFilePath, unsigned int unFileType, int nWidth, int nHeight = -1) {}
virtual std::wstring ConvertToSvg(unsigned int unWidth = 0, unsigned int unHeight = 0) { return L""; }
virtual bool LoadFromXmlFile(const wchar_t* wsFilePath) { return false; }
virtual void ConvertToEmf(const wchar_t *wsFilePath) {}
};
virtual void ConvertToXml(const wchar_t* wsFilePath) {}
virtual void ConvertToXmlAndRaster(const wchar_t *wsXmlFilePath, const wchar_t* wsOutFilePath, unsigned int unFileType, int nWidth, int nHeight = -1) {}
virtual bool LoadFromXmlFile(const wchar_t* wsFilePath) { return false; }
virtual void ConvertToEmf(const wchar_t *wsFilePath) {}
};
IMetaFile* Create(NSFonts::IApplicationFonts *pAppFonts)
{
return new CMetaFile(pAppFonts);
}
}
}

View File

@ -231,6 +231,13 @@ namespace MetaFile
m_oStream.SetStream(pBuf, unSize);
}
void CEmfParser::SetInterpretator(IOutputDevice* pOutput)
{
CEmfParserBase::SetInterpretator(pOutput);
if (m_pEmfPlusParser)
RELEASEOBJECT(m_pEmfPlusParser);
}
bool CEmfParser::ReadImage(unsigned int offBmi, unsigned int cbBmi, unsigned int offBits, unsigned int cbBits, unsigned int ulSkip, BYTE **ppBgraBuffer, unsigned int *pulWidth, unsigned int *pulHeight)
{
int lHeaderOffset = offBmi - ulSkip;

View File

@ -21,6 +21,9 @@ namespace MetaFile
EmfParserType GetType() override;
void SetStream(BYTE* pBuf, unsigned int unSize);
public:
virtual void SetInterpretator(IOutputDevice* pOutput) override;
private:
CEmfPlusParser *m_pEmfPlusParser;

View File

@ -70,7 +70,7 @@ namespace MetaFile
bool IsWindowFlippedY() override;
bool IsWindowFlippedX() override;
void SetInterpretator(IOutputDevice* pOutput);
virtual void SetInterpretator(IOutputDevice* pOutput);
void SetInterpretator(const wchar_t *wsFilePath, InterpretatorType oInterpretatorType, unsigned int unWidth = 0, unsigned int unHeight = 0);
void SetInterpretator(IOutputDevice* pOutput, const wchar_t *wsFilePath);
void SetInterpretator(InterpretatorType oInterpretatorType, unsigned int unWidth = 0, unsigned int unHeight = 0);

View File

@ -612,7 +612,20 @@ namespace MetaFile
double dWidth = 25.4 * nWidth / 96;
double dHeight = 25.4 * nHeight / 96;
BYTE* pBgraData = new BYTE[nWidth * nHeight * 4];
BYTE* pBgraData = (BYTE*)malloc(nWidth * nHeight * 4);
if (!pBgraData)
{
double dKoef = 2000.0 / (nWidth > nHeight ? nWidth : nHeight);
nWidth = (int)(dKoef * nWidth);
nHeight = (int)(dKoef * nHeight);
dWidth = 25.4 * nWidth / 96;
dHeight = 25.4 * nHeight / 96;
pBgraData = (BYTE*)malloc(nWidth * nHeight * 4);
}
if (!pBgraData)
return;
@ -637,8 +650,11 @@ namespace MetaFile
DrawOnRenderer(pGrRenderer, 0, 0, dWidth, dHeight);
oFrame.SaveFile(wsOutFilePath, unFileType);
oFrame.put_Data(NULL);
RELEASEINTERFACE(pFontManager);
RELEASEINTERFACE(pGrRenderer);
if (pBgraData)
free(pBgraData);
}
}

View File

@ -454,8 +454,7 @@ public:
std::string xml_string = XmlUtils::GetUtf8FromFileContent(buffer, dwReadBytes);
bool bRes = false;
if ((std::string::npos != xml_string.find("Content-Type: multipart/related")) &&
(std::string::npos != xml_string.find("Content-Type: text/html")))
if (std::string::npos != xml_string.find("Content-Type: multipart/related"))
{
BYTE* pData;
DWORD nLength;
@ -464,7 +463,15 @@ public:
std::string sFileContent = XmlUtils::GetUtf8FromFileContent(pData, nLength);
RELEASEARRAYOBJECTS(pData);
/*
std::wstring sRes = mhtToXhtml(sFileContent);
NSFile::CFileBinary oWriter;
if (oWriter.CreateFileW(m_sTmp + L"/res.html"))
{
oWriter.WriteStringUTF8(sRes);
oWriter.CloseFile();
}
*/
bRes = m_oLightReader.FromString(mhtToXhtml(sFileContent));
}
else

View File

@ -775,6 +775,69 @@ namespace PdfReader
}
void RendererOutputDev::updateBlendMode(GfxState *pGState)
{
NSGraphics::IGraphicsRenderer* GRenderer = dynamic_cast<NSGraphics::IGraphicsRenderer*>(m_pRenderer);
if (!GRenderer)
return;
switch (pGState->getBlendMode())
{
case gfxBlendNormal:
GRenderer->put_BlendMode(3);
// agg::comp_op_src_over
break;
case gfxBlendMultiply:
GRenderer->put_BlendMode(14);
// agg::comp_op_multiply
break;
case gfxBlendScreen:
GRenderer->put_BlendMode(15);
// agg::comp_op_screen
break;
case gfxBlendOverlay:
GRenderer->put_BlendMode(16);
// agg::comp_op_overlay
break;
case gfxBlendDarken:
GRenderer->put_BlendMode(17);
// agg::comp_op_darken
break;
case gfxBlendLighten:
GRenderer->put_BlendMode(18);
// agg::comp_op_lighten
break;
case gfxBlendColorDodge:
GRenderer->put_BlendMode(19);
// agg::comp_op_color_dodge
break;
case gfxBlendColorBurn:
GRenderer->put_BlendMode(20);
// agg::comp_op_color_burn
break;
case gfxBlendHardLight:
GRenderer->put_BlendMode(21);
// agg::comp_op_hard_light
break;
case gfxBlendSoftLight:
GRenderer->put_BlendMode(22);
// agg::comp_op_soft_light
break;
case gfxBlendDifference:
GRenderer->put_BlendMode(23);
// agg::comp_op_difference
break;
case gfxBlendExclusion:
GRenderer->put_BlendMode(24);
// agg::comp_op_exclusion
break;
case gfxBlendHue:
case gfxBlendSaturation:
case gfxBlendColor:
case gfxBlendLuminosity:
default:
GRenderer->put_BlendMode(3);
// agg::comp_op_src_over
break;
}
}
void RendererOutputDev::updateFillOpacity(GfxState *pGState)
{
@ -3840,20 +3903,32 @@ namespace PdfReader
if (nRenderMode == 1 || nRenderMode == 2 || nRenderMode == 5 || nRenderMode == 6)
{
double dTfsY = 0, dTfsX = 0, dWidth, dHeight, dDpiX, dDpiY;
m_pRenderer->get_Width(&dWidth);
m_pRenderer->get_Height(&dHeight);
m_pRenderer->get_DpiX(&dDpiX);
m_pRenderer->get_DpiY(&dDpiY);
double dPWidth = dWidth * dDpiX / 25.4;
double dPHeight = dHeight * dDpiY / 25.4;
double* dFontBBox = pFont->getFontBBox();
bool bOriginalSizes = (0.99 < dPWidth / pGState->getPageWidth()) && (dPWidth / pGState->getPageWidth() < 1.01) &&
(0.99 < dPHeight / pGState->getPageHeight()) && (dPHeight / pGState->getPageHeight() < 1.01);
if (dFontBBox && bOriginalSizes && (dFontBBox[0] != 0 || dFontBBox[1] != 0 || dFontBBox[2] != 0 || dFontBBox[3] != 0))
{
dTfsY = -fabs(dFontBBox[3] - dFontBBox[1]) * 0.6;
dTfsX = -fabs(dFontBBox[2] - dFontBBox[0]) * 0.25;
}
m_pRenderer->BeginCommand(c_nStrokeTextType);
//m_pRenderer->PathCommandEnd();
//m_pRenderer->PathCommandText( bsText, PDFCoordsToMM( 0 + dShiftX ), PDFCoordsToMM( /*-fabs(pFont->getFontBBox()[3]) * dTfs*/ + dShiftY ), PDFCoordsToMM( 0 ), PDFCoordsToMM( 0 ), PDFCoordsToMM( 0 ) );
// Временно
//m_pRenderer->PathCommandTextEx( bsText, PDFCoordsToMM( 0 + dShiftX ), PDFCoordsToMM( /*-fabs(pFont->getFontBBox()[3]) * dTfs*/ + dShiftY ), PDFCoordsToMM( 0 ), PDFCoordsToMM( 0 ), PDFCoordsToMM( 0 ), 0, bsStringGID );
//m_pRenderer->PathCommandTextEx( bsUnicodeText, bsGIDText, bsSrcCodeText, PDFCoordsToMM( 0 + dShiftX ), PDFCoordsToMM( /*-fabs(pFont->getFontBBox()[3]) * dTfs*/0 + dShiftY ), PDFCoordsToMM( dDx ), PDFCoordsToMM( dDy ), PDFCoordsToMM( 0 ), 0 );
//-----------
//m_pRenderer->PathCommandText( bsUnicodeText, PDFCoordsToMM( 0 + dShiftX ), PDFCoordsToMM( /*-fabs(pFont->getFontBBox()[3]) * dTfs*/ + dShiftY ), PDFCoordsToMM( dDx ), PDFCoordsToMM( dDy ), PDFCoordsToMM( 0 ) );
//m_pRenderer->DrawPath( c_nStroke );
m_pRenderer->PathCommandEnd();
if (unGid)
m_pRenderer->PathCommandTextEx(wsUnicodeText, &unGid, unGidsCount, PDFCoordsToMM(dTfsX + dShiftX), PDFCoordsToMM(dTfsY + dShiftY), PDFCoordsToMM(dDx), PDFCoordsToMM(dDy));
else
m_pRenderer->PathCommandText(wsUnicodeText, PDFCoordsToMM(dTfsX + dShiftX), PDFCoordsToMM(dTfsY + dShiftY), PDFCoordsToMM(dDx), PDFCoordsToMM(dDy));
m_pRenderer->DrawPath(c_nStroke);
m_pRenderer->EndCommand(c_nStrokeTextType);
}

View File

@ -4770,6 +4770,7 @@ void Gfx::drawForm(Object *strRef, Dict *resDict,
strObj.free();
traceBegin(oldBaseMatrix, softMask ? "begin soft mask" : "begin t-group");
/*
if (state->getBlendMode() != gfxBlendNormal) {
state->setBlendMode(gfxBlendNormal);
out->updateBlendMode(state);
@ -4782,6 +4783,7 @@ void Gfx::drawForm(Object *strRef, Dict *resDict,
state->setStrokeOpacity(1);
out->updateStrokeOpacity(state);
}
*/
out->clearSoftMask(state);
out->beginTransparencyGroup(state, bbox, blendingColorSpace,
isolated, knockout, softMask);

View File

@ -198,18 +198,39 @@ void CSVReader::Impl::AddCell(std::wstring &sText, INT nStartCell, std::stack<IN
pCell->m_oCacheValue = sText; // как есть
WCHAR *pEndPtr;
wchar_t *pEndPtr;
double dValue = wcstod(sText.c_str(), &pEndPtr);
if (std::isnan(dValue) || std::isinf(dValue))
pEndPtr = (wchar_t *)sText.c_str();
if ((0 == *pEndPtr) || (0 == *(pEndPtr + 1) && length > 1))
if ((0 == *pEndPtr) || (pEndPtr != sText.c_str() && (sText.c_str() + length - pEndPtr) < 4))
{
std::wstring data_format;
std::wstring postfix;
if (0 != *pEndPtr)
{
size_t sz = length - (pEndPtr - sText.c_str());
while (sz > 0)
{
if (pEndPtr[sz - 1] != L' ')
break;
sz--;
}
if (sz > 0)
{
postfix = std::wstring(pEndPtr, sz);
}
}
size_t pos = sText.find(L".");
if (pos != std::wstring::npos)
{
size_t fraction = sText.length() - pos - ((0 != *pEndPtr) ? 2 : 1);
for (size_t i = 0; i < fraction; ++i)
for (size_t i = 0; i < fraction && fraction != std::wstring::npos; ++i)
data_format += L"0";
}
if (false == data_format.empty()) data_format = L"." + data_format;
@ -218,15 +239,22 @@ void CSVReader::Impl::AddCell(std::wstring &sText, INT nStartCell, std::stack<IN
if (0 != *pEndPtr)
{
wchar_t postfix = *pEndPtr;
data_format += postfix;
if (postfix == L'%')
if (false == postfix.empty())
{
pCell->m_oValue->m_sText = std::to_wstring(dValue / 100.);
}
else
pCell->m_oValue->m_sText = sText.substr(0, length - 1);
if (postfix[0] == L'%')
{
pCell->m_oValue->m_sText = std::to_wstring(dValue / 100.);
}
else
{
pCell->m_oValue->m_sText = sText.substr(0, length - 1);
for (size_t i = 0; i < postfix.size(); ++i)
{
data_format += std::wstring(L"\\") + postfix[i];
}
}
}
}
else
pCell->m_oValue->m_sText = sText;
@ -439,11 +467,11 @@ _UINT32 CSVReader::Impl::Read(const std::wstring &sFileName, OOX::Spreadsheet::C
pRow = NULL;
}
if (nIndex + nDelimiterSize > 1000000)
if (nIndex + nDelimiterSize > 500000)
{
nStartCell = 0;
sFileDataW.erase(0, nIndex + nDelimiterSize);
nIndex = 0; nSize -= (nIndex + nDelimiterSize);
nSize -= (nIndex + nDelimiterSize); nIndex = 0;
pTemp = sFileDataW.c_str();
}
else
@ -471,11 +499,11 @@ _UINT32 CSVReader::Impl::Read(const std::wstring &sFileName, OOX::Spreadsheet::C
++nIndex;
}
if (nIndex + 1 > 1000000)
if (nIndex + 1 > 500000)
{
nStartCell = 0;
sFileDataW.erase(0, nIndex + 1);
nIndex = 0; nSize -= (nIndex + 1);
nSize -= (nIndex + 1); nIndex = 0;
pTemp = sFileDataW.c_str();
}
else