Commit 0c97a400 authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander Trofimov

(2.0.0.257): ASCOfficeDocxFile2

Записать и чтение в бинарник fldSimple; Экранирование спецсимволов в комментариях pptx

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@60877 954022d7-b5bf-4e40-9824-e11837661b57
parent 036880c6
......@@ -2385,5 +2385,26 @@ public:
}
}
};
class CFldSimple{
public:
CString sInstr;
XmlUtils::CStringWriter writer;
public:
CFldSimple()
{
}
void Write(XmlUtils::CStringWriter& wr)
{
if(false == sInstr.IsEmpty())
{
CString sCorrect_Instr = XmlUtils::EncodeXmlString(sInstr);
CString sStart;
sStart.Format(_T("<w:fldSimple w:instr=\"%s\">"), (const TCHAR *) sCorrect_Instr);
wr.WriteString(sStart);
wr.Write(writer);
wr.WriteString(CString(_T("</w:fldSimple>")));
}
}
};
}
#endif // #ifndef READER_CLASSES
\ No newline at end of file
......@@ -2865,7 +2865,7 @@ class Binary_DocumentTableReader : public Binary_CommonReader<Binary_DocumentTab
Binary_pPrReader oBinary_pPrReader;
Binary_rPrReader oBinary_rPrReader;
Binary_tblPrReader oBinary_tblPrReader;
CHyperlink* m_pCurHyperlink;
XmlUtils::CStringWriter* m_pCurWriter;
rPr m_oCur_rPr;
rPr m_oMath_rPr;
XmlUtils::CStringWriter m_oCur_pPr;
......@@ -2878,7 +2878,7 @@ public:
Binary_DocumentTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, Writers::ContentWriter& oDocumentWriter, CComments* pComments):Binary_CommonReader(poBufferedStream),m_oDocumentWriter(oDocumentWriter),m_oFileWriter(oFileWriter),m_oMediaWriter(oFileWriter.m_oMediaWriter),m_oFontTableWriter(oFileWriter.m_oFontTableWriter),oBinary_pPrReader(poBufferedStream, oFileWriter),oBinary_rPrReader(poBufferedStream), oBinary_tblPrReader(poBufferedStream, oFileWriter),m_oCur_rPr(m_oFontTableWriter.m_mapFonts),m_oMath_rPr(m_oFontTableWriter.m_mapFonts),m_pComments(pComments)
{
m_byteLastElemType = c_oSerParType::Content;
m_pCurHyperlink = NULL;
m_pCurWriter = NULL;
}
~Binary_DocumentTableReader()
{
......@@ -2889,8 +2889,8 @@ public:
};
XmlUtils::CStringWriter& GetRunStringWriter()
{
if(NULL != m_pCurHyperlink)
return m_pCurHyperlink->writer;
if(NULL != m_pCurWriter)
return *m_pCurWriter;
else
return m_oDocumentWriter.m_oContent;
}
......@@ -3004,6 +3004,29 @@ public:
res = Read1(length, &Binary_DocumentTableReader::ReadHyperlink, this, &oHyperlink);
oHyperlink.Write(GetRunStringWriter());
}
else if ( c_oSerParType::FldSimple == type )
{
CFldSimple oFldSimple;
res = Read1(length, &Binary_DocumentTableReader::ReadFldSimple, this, &oFldSimple);
oFldSimple.Write(GetRunStringWriter());
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadFldSimple(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
CFldSimple* pFldSimple = static_cast<CFldSimple*>(poResult);
if ( c_oSer_HyperlinkType::Link == type )
pFldSimple->sInstr = m_oBufferedStream.GetString3(length);
else if ( c_oSer_HyperlinkType::Content == type )
{
XmlUtils::CStringWriter* pPrevWriter = m_pCurWriter;
m_pCurWriter = &pFldSimple->writer;
res = Read1(length, &Binary_DocumentTableReader::ReadParagraphContent, this, NULL);
m_pCurWriter = pPrevWriter;
}
else
res = c_oSerConstants::ReadUnknown;
return res;
......@@ -3029,15 +3052,15 @@ public:
pHyperlink->sTgtFrame = m_oBufferedStream.GetString3(length);
else if ( c_oSer_HyperlinkType::Content == type )
{
CHyperlink* pPrevHyperlink = m_pCurHyperlink;
m_pCurHyperlink = pHyperlink;
XmlUtils::CStringWriter* pPrevWriter = m_pCurWriter;
m_pCurWriter = &pHyperlink->writer;
res = Read1(length, &Binary_DocumentTableReader::ReadParagraphContent, this, NULL);
long rId;
CString sHref = XmlUtils::EncodeXmlString(pHyperlink->sLink);
m_oFileWriter.m_pDrawingConverter->WriteRels(CString(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink")), sHref, CString(_T("External")), &rId);
CString srId;srId.Format(_T("rId%d"), rId);
pHyperlink->rId = srId;
m_pCurHyperlink = pPrevHyperlink;
m_pCurWriter = pPrevWriter;
}
else
res = c_oSerConstants::ReadUnknown;
......
......@@ -84,9 +84,7 @@ const int styletype_Table = 0x04;
const int fieldstruct_none = 0;
const int fieldstruct_toc = 1;
const int fieldstruct_pagenum = 2;
const int fieldstruct_hyperlink = 3;
const int fieldstruct_locallink = 4;
const int fieldstruct_hyperlink = 2;
const double g_dKoef_mm_to_pt = 72 / (2.54 * 10);
const double g_dKoef_mm_to_twips = 20 * g_dKoef_mm_to_pt;
......@@ -393,7 +391,8 @@ extern int g_nCurFormatVersion;
CommentEnd = 7,
OMathPara = 8,
OMath = 9,
Hyperlink = 10
Hyperlink = 10,
FldSimple = 11
};}
namespace c_oSerDocTableType{enum c_oSerDocTableType
{
......@@ -797,6 +796,11 @@ extern int g_nCurFormatVersion;
DocLocation = 5,
TgtFrame = 6
};}
namespace c_oSer_FldSimpleType{ enum c_oSer_FldSimpleType
{
Content = 0,
Instr = 1
};}
namespace c_oSer_ColorThemeType{ enum c_oSer_ColorThemeType
{
Auto = 0,
......
This diff is collapsed.
......@@ -2,6 +2,6 @@
//2
//0
//0
//256
#define INTVER 2,0,0,256
#define STRVER "2,0,0,256\0"
//257
#define INTVER 2,0,0,257
#define STRVER "2,0,0,257\0"
......@@ -124,7 +124,7 @@ namespace PPTX
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("authorId"), authorId);
pWriter->WriteAttribute(_T("dt"), dt);
pWriter->WriteAttribute2(_T("dt"), dt);
pWriter->WriteAttribute(_T("idx"), idx);
pWriter->EndAttributes();
......@@ -137,7 +137,7 @@ namespace PPTX
if (text.is_init())
{
pWriter->WriteString(_T("<p:text>"));
pWriter->WriteString(*text);
pWriter->WriteStringXML(*text);
pWriter->WriteString(_T("</p:text>"));
}
......
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