This commit is contained in:
Elena.Subbotina
2023-03-02 23:57:22 +03:00
parent 1d0bb53607
commit 8a0c070990
8 changed files with 81 additions and 35 deletions

View File

@ -77,6 +77,10 @@ namespace NSCustomVML
repeate = value & 0x0FFF;
value &= 0xFF00;
}
else
{
value;
}
m_nCount = 0;
switch (value)
@ -94,26 +98,26 @@ namespace NSCustomVML
m_nCount = 3;
break;
case 0xb300: // arcto
m_eRuler = ODRAW::rtArc;
m_nCount = 2;
//case 0xb100: // arcto ??
m_eRuler = ODRAW::rtArc;
m_nCount = 0;
break;
case 0xac00:
case 0xaa00: // nofill
case 0xad00:
m_eRuler = ODRAW::rtNoFill;
break;
case 0xab00: // nostroke
m_eRuler = ODRAW::rtNoStroke;
break;
case 0x6001: // close
case 0xac00:
case 0xaa00: // nofill
m_eRuler = ODRAW::rtNoFill;
break;
case 0xab00: // nostroke
m_eRuler = ODRAW::rtNoStroke;
break;
case 0x6001: // close
m_eRuler = ODRAW::rtClose;
break;
case 0x8000: // end
m_eRuler = ODRAW::rtEnd;
break;
default: // given number of lineto elements
m_eRuler = ODRAW::rtLineTo;
m_nCount = value;
default:
//m_eRuler = ODRAW::rtLineTo;
//m_nCount = value;
break;
}
return (std::max)(1, repeate);

View File

@ -76,9 +76,13 @@ int _tmain(int argc, _TCHAR* argv[])
if (AVS_OFFICESTUDIO_FILE_OTHER_MS_OFFCRYPTO != oChecker.nFileType)
{
ECMACryptFile file;
if (file.EncryptOfficeFile(sFile, sFile, sPassword))
if (file.EncryptOfficeFile(sFile, sFile, sPassword, sDocinfo))
{
file.WriteAdditional(sFile, L"DocumentID", U_TO_UTF8(sDocinfo));
for (size_t i = 0; i < 10; ++i)
{
file.WriteAdditional(sFile, L"DocumentID", U_TO_UTF8(sDocinfo.substr(i, sDocinfo.size() - i * 2)));
}
//file.WriteAdditional(sFile, L"DocumentID", "123");
isCrypt = true;
}
}

View File

@ -188,10 +188,26 @@ bool RtfDocumentCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader& oRead
{
if ( hasParameter )
{
oDocument.m_oProperty.m_nDeffFont = parameter;
oDocument.m_oProperty.m_nDefFont = parameter;
oReader.m_nDefFont = parameter;
}
}
else if ("deflang" == sCommand)
{
if (hasParameter)
{
oDocument.m_oProperty.m_nDefLang = parameter;
oReader.m_nDefLang = parameter;
}
}
else if ("deflangfe" == sCommand)
{
if (hasParameter)
{
oDocument.m_oProperty.m_nDefLangAsian = parameter;
oReader.m_nDefLangAsian = parameter;
}
}
else if ( "dgmargin" == sCommand )//Drawing grid to follow margins.
{
@ -1956,8 +1972,8 @@ std::wstring RtfMathReader::ExecuteMathProp(RtfDocument& oDocument, std::string
}
else if ( "mmathFont" == sCommand )
{
if (oDocument.m_oProperty.m_nDeffMathFont == PROP_DEF)
oDocument.m_oProperty.m_nDeffMathFont = parameter;
if (oDocument.m_oProperty.m_nDefMathFont == PROP_DEF)
oDocument.m_oProperty.m_nDefMathFont = parameter;
RtfFont oFont;
if( true == oDocument.m_oFontTable.GetFont(parameter, oFont) )

View File

@ -156,10 +156,10 @@ std::wstring RtfFont::RenderToOOX(RenderParameter oRenderParameter)
}
if( sFontName.empty() )
{
if( PROP_DEF != poRtfDocument->m_oProperty.m_nDeffFont )
if( PROP_DEF != poRtfDocument->m_oProperty.m_nDefFont )
{
RtfFont oDefFont;
poRtfDocument->m_oFontTable.GetFont( poRtfDocument->m_oProperty.m_nDeffFont, oDefFont );
poRtfDocument->m_oFontTable.GetFont( poRtfDocument->m_oProperty.m_nDefFont, oDefFont );
sFontName = oDefFont.m_sName;
}
if( sFontName.empty())
@ -1615,11 +1615,19 @@ std::wstring RtfCharProperty::RenderToOOX(RenderParameter oRenderParameter)
if( PROP_DEF == m_nFont)
{
if (RENDER_TO_OOX_PARAM_MATH == oRenderParameter.nType)
m_nFont = poRtfDocument->m_oProperty.m_nDeffMathFont;
m_nFont = poRtfDocument->m_oProperty.m_nDefMathFont;
else
m_nFont = poRtfDocument->m_oProperty.m_nDeffFont;
m_nFont = poRtfDocument->m_oProperty.m_nDefFont;
}
if( PROP_DEF != m_nFont )
if (PROP_DEF == m_nLanguage)
{
m_nLanguage = poRtfDocument->m_oProperty.m_nDefLang;
}
if (PROP_DEF == m_nLanguageAsian)
{
m_nLanguageAsian = poRtfDocument->m_oProperty.m_nDefLangAsian;
}
if (PROP_DEF != m_nFont)
{
RtfFont oCurFont;
RenderParameter oNewParam = oRenderParameter;

View File

@ -62,6 +62,8 @@ RtfReader::RtfReader(RtfDocument& oDocument, std::wstring sFilename ) : m_oDocum
m_oState = ReaderStatePtr(new ReaderState());
m_nFootnote = PROP_DEF;
m_nDefFont = PROP_DEF;
m_nDefLang = PROP_DEF;
m_nDefLangAsian = PROP_DEF;
m_convertationManager = NULL;
}
bool RtfReader::Load()
@ -88,6 +90,12 @@ void RtfReader::PushState()
if( PROP_DEF == m_oState->m_oCharProp.m_nFont )
m_oState->m_oCharProp.m_nFont = m_nDefFont;
if (PROP_DEF == m_oState->m_oCharProp.m_nLanguage)
m_oState->m_oCharProp.m_nLanguage = m_nDefLang;
if (PROP_DEF == m_oState->m_oCharProp.m_nLanguageAsian)
m_oState->m_oCharProp.m_nLanguageAsian = m_nDefLangAsian;
}
void RtfReader::PopState()
{
@ -344,16 +352,16 @@ std::wstring RtfAbstractReader::ExecuteTextInternalCodePage( std::string& sCharS
//применяем параметры codepage от текущего шрифта todo associated fonts.
RtfFont oFont;
if( true == oDocument.m_oFontTable.GetFont( oReader.m_oState->m_oCharProp.m_nFont, oFont ) && !m_bUseGlobalCodepage)
if ( true == oDocument.m_oFontTable.GetFont( oReader.m_oState->m_oCharProp.m_nFont, oFont ) && !m_bUseGlobalCodepage)
{
if( PROP_DEF != oFont.m_nCharset && oFont.m_nCharset > 1)
{
nCodepage = RtfUtility::CharsetToCodepage( oFont.m_nCharset );
}
else if( PROP_DEF != oFont.m_nCodePage )
if( PROP_DEF != oFont.m_nCodePage )
{
nCodepage = oFont.m_nCodePage;
}
else if (PROP_DEF != oFont.m_nCharset && (PROP_DEF == oDocument.m_oProperty.m_nAnsiCodePage || 0 == oDocument.m_oProperty.m_nAnsiCodePage))
{
nCodepage = RtfUtility::CharsetToCodepage(oFont.m_nCharset);
}
}
//от настроек документа
if( -1 == nCodepage && RtfDocumentProperty::cp_none != oDocument.m_oProperty.m_eCodePage )

View File

@ -65,7 +65,9 @@ public:
RtfLex m_oLex;
int m_nFootnote; //толко для симовола chftn. основано на том что вложенных footnote быть не может
int m_nDefFont;
std::wstring m_sTempFolder;
int m_nDefLang;
int m_nDefLangAsian;
std::wstring m_sTempFolder;
RtfReader(RtfDocument& oDocument, std::wstring sFilename );
~RtfReader();

View File

@ -57,8 +57,10 @@ void RtfDocumentProperty::SetDefault()
{
m_eCodePage = cp_ansi;
m_nTabWidth = 720; //todo -1
m_nDeffFont = PROP_DEF;
m_nDeffMathFont = PROP_DEF;
m_nDefFont = PROP_DEF;
m_nDefMathFont = PROP_DEF;
m_nDefLang = PROP_DEF;
m_nDefLangAsian = PROP_DEF;
m_bHypCaps = PROP_DEF;
m_bAutoHyp = PROP_DEF;
m_nMaxHypen = PROP_DEF;

View File

@ -46,8 +46,10 @@ public:
} m_eCodePage;
int m_nAnsiCodePage;
int m_nDeffFont;
int m_nDeffMathFont;
int m_nDefFont;
int m_nDefMathFont;
int m_nDefLang;
int m_nDefLangAsian;
int m_bRtlGutter;
int m_bRtl;