From 1e8a9867fe2fb7da16f8e426f86aaeb9daf98bbe Mon Sep 17 00:00:00 2001 From: "Elena.Subbotina" Date: Thu, 28 Apr 2022 18:10:34 +0300 Subject: [PATCH] fix bug #56911 --- .../source/DestinationCommand.cpp | 21 +++++++++++++++---- .../RtfFormatLib/source/DestinationCommand.h | 6 ++---- .../source/Reader/OOXShapeReader.cpp | 8 +++++++ 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.cpp b/ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.cpp index b188336924..2f59309f02 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.cpp +++ b/ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.cpp @@ -536,6 +536,16 @@ bool RtfNormalReader::ExecuteCommand( RtfDocument& oDocument, RtfReader& oReader //default set to curent section SectDef( oDocument, oReader ); } + else if ("defchp" == sCommand) + { + RtfDefCharPropReader oDefCharPropReader; + return StartSubReader(oDefCharPropReader, oDocument, oReader); + } + else if ("defpap" == sCommand) + { + RtfDefParPropReader oDefParPropReader; + return StartSubReader(oDefParPropReader, oDocument, oReader); + } else { bool bResult = false; @@ -978,13 +988,16 @@ bool RtfCharPropsCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader& oRea if ( hasParameter ) charProps->m_nCharacterSpacing = 5 * parameter; //quater -points } - COMMAND_RTF_INT ( "fittext" , charProps->m_nFitText, sCommand, hasParameter, parameter) - COMMAND_RTF_INT ( "f" , charProps->m_nFont, sCommand, hasParameter, parameter) + COMMAND_RTF_INT ( "fittext" , charProps->m_nFitText, sCommand, hasParameter, parameter) + else if ("f" == sCommand && hasParameter) + { + charProps->m_nFont = parameter; + oReader.m_nDefFont = charProps->m_nFont; //reset + } COMMAND_RTF_INT ( "fs" , charProps->m_nFontSize, sCommand, hasParameter, parameter) COMMAND_RTF_BOOL( "i" , charProps->m_bItalic, sCommand, hasParameter, parameter) COMMAND_RTF_BOOL( "impr" , charProps->m_bImprint, sCommand, hasParameter, parameter) - COMMAND_RTF_INT ( "kerning" , charProps->m_nKerning, sCommand, hasParameter, parameter) - + COMMAND_RTF_INT ( "kerning" , charProps->m_nKerning, sCommand, hasParameter, parameter) else if ( "ltrch" == sCommand ) { if ( false == hasParameter || 0 != parameter ) diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.h b/ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.h index 4717e991e2..bb2cc96170 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.h +++ b/ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.h @@ -437,8 +437,7 @@ public: class RtfDefCharPropReader: public RtfAbstractReader { public: - RtfCharProperty& m_oCharProp; - RtfDefCharPropReader( RtfCharProperty& oOutput ):m_oCharProp(oOutput) + RtfDefCharPropReader() { } bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, std::string sCommand, bool hasParameter, int parameter) @@ -446,11 +445,10 @@ public: if( "defchp" == sCommand ) return true; else - return RtfCharPropsCommand::ExecuteCommand( oDocument, oReader, sCommand, hasParameter, parameter, &oReader.m_oState->m_oCharProp ); + return RtfCharPropsCommand::ExecuteCommand( oDocument, oReader, sCommand, hasParameter, parameter, &oDocument.m_oDefaultCharProp); } void ExitReader( RtfDocument& oDocument, RtfReader& oReader ) { - m_oCharProp = oReader.m_oState->m_oCharProp; } }; diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.cpp b/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.cpp index 285361b486..5f54065b18 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.cpp +++ b/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.cpp @@ -238,6 +238,14 @@ bool OOXShapeReader::ParseVmlStyle(RtfShapePtr pShape, SimpleTypes::Vml::CCssPro { pShape->m_nPctHeight = (int)prop->get_Value().oValue.dValue; }break; + case SimpleTypes::Vml::csspctMsoTopPercent: + { + pShape->m_nPositionVPct = (int)prop->get_Value().oValue.dValue; + }break; + case SimpleTypes::Vml::csspctMsoLeftPercent: + { + pShape->m_nPositionHPct = (int)prop->get_Value().oValue.dValue; + }break; case SimpleTypes::Vml::cssptVRotateLetters: { pShape->m_bGtextFVertical = prop->get_Value().bValue;