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; repeate = value & 0x0FFF;
value &= 0xFF00; value &= 0xFF00;
} }
else
{
value;
}
m_nCount = 0; m_nCount = 0;
switch (value) switch (value)
@ -94,26 +98,26 @@ namespace NSCustomVML
m_nCount = 3; m_nCount = 3;
break; break;
case 0xb300: // arcto case 0xb300: // arcto
m_eRuler = ODRAW::rtArc; //case 0xb100: // arcto ??
m_nCount = 2; m_eRuler = ODRAW::rtArc;
m_nCount = 0;
break; break;
case 0xac00: case 0xac00:
case 0xaa00: // nofill case 0xaa00: // nofill
case 0xad00: m_eRuler = ODRAW::rtNoFill;
m_eRuler = ODRAW::rtNoFill; break;
break; case 0xab00: // nostroke
case 0xab00: // nostroke m_eRuler = ODRAW::rtNoStroke;
m_eRuler = ODRAW::rtNoStroke; break;
break; case 0x6001: // close
case 0x6001: // close
m_eRuler = ODRAW::rtClose; m_eRuler = ODRAW::rtClose;
break; break;
case 0x8000: // end case 0x8000: // end
m_eRuler = ODRAW::rtEnd; m_eRuler = ODRAW::rtEnd;
break; break;
default: // given number of lineto elements default:
m_eRuler = ODRAW::rtLineTo; //m_eRuler = ODRAW::rtLineTo;
m_nCount = value; //m_nCount = value;
break; break;
} }
return (std::max)(1, repeate); 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) if (AVS_OFFICESTUDIO_FILE_OTHER_MS_OFFCRYPTO != oChecker.nFileType)
{ {
ECMACryptFile file; 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; isCrypt = true;
} }
} }

View File

@ -188,10 +188,26 @@ bool RtfDocumentCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader& oRead
{ {
if ( hasParameter ) if ( hasParameter )
{ {
oDocument.m_oProperty.m_nDeffFont = parameter; oDocument.m_oProperty.m_nDefFont = parameter;
oReader.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. 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 ) else if ( "mmathFont" == sCommand )
{ {
if (oDocument.m_oProperty.m_nDeffMathFont == PROP_DEF) if (oDocument.m_oProperty.m_nDefMathFont == PROP_DEF)
oDocument.m_oProperty.m_nDeffMathFont = parameter; oDocument.m_oProperty.m_nDefMathFont = parameter;
RtfFont oFont; RtfFont oFont;
if( true == oDocument.m_oFontTable.GetFont(parameter, 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( sFontName.empty() )
{ {
if( PROP_DEF != poRtfDocument->m_oProperty.m_nDeffFont ) if( PROP_DEF != poRtfDocument->m_oProperty.m_nDefFont )
{ {
RtfFont oDefFont; 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; sFontName = oDefFont.m_sName;
} }
if( sFontName.empty()) if( sFontName.empty())
@ -1615,11 +1615,19 @@ std::wstring RtfCharProperty::RenderToOOX(RenderParameter oRenderParameter)
if( PROP_DEF == m_nFont) if( PROP_DEF == m_nFont)
{ {
if (RENDER_TO_OOX_PARAM_MATH == oRenderParameter.nType) if (RENDER_TO_OOX_PARAM_MATH == oRenderParameter.nType)
m_nFont = poRtfDocument->m_oProperty.m_nDeffMathFont; m_nFont = poRtfDocument->m_oProperty.m_nDefMathFont;
else 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; RtfFont oCurFont;
RenderParameter oNewParam = oRenderParameter; RenderParameter oNewParam = oRenderParameter;

View File

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

View File

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

View File

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

View File

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