Commit bd90de85 authored by ElenaSubbotina's avatar ElenaSubbotina

Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop

parents 634098a6 57f2ec7b
......@@ -61,6 +61,26 @@ enum ETblStyleOverrideType
tblstyleoverridetypeSwCell = 11,
tblstyleoverridetypeWholeTable = 12
};
class SdtWraper
{
public:
OOX::Logic::CSdt m_oSdt;
rPr* m_oEndPr;
rPr* m_oRPr;
int m_nType;
SdtWraper(int nType)
{
m_nType = nType;
m_oEndPr = NULL;
m_oRPr = NULL;
}
~SdtWraper()
{
RELEASEOBJECT(m_oEndPr)
RELEASEOBJECT(m_oRPr)
}
};
#define READ1_DEF(stLen, fReadFunction, arg, res) {\
res = c_oSerConstants::ReadOk;\
......@@ -3635,6 +3655,11 @@ public:
//сбрасываем Shd
oBinary_tblPrReader.m_sCurTableShd.clear();
}
else if(c_oSerParType::Sdt == type)
{
SdtWraper oSdt(0);
res = Read1(length, &Binary_DocumentTableReader::ReadSdt, this, &oSdt);
}
else if ( c_oSerParType::sectPr == type )
{
SectPr oSectPr;
......@@ -3746,6 +3771,11 @@ public:
res = Read1(length, &Binary_DocumentTableReader::ReadDelIns, this, &oTrackRevision);
oTrackRevision.Write(&GetRunStringWriter(), _T("w:del"));
}
else if(c_oSerParType::Sdt == type)
{
SdtWraper oSdt(1);
res = Read1(length, &Binary_DocumentTableReader::ReadSdt, this, &oSdt);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
......@@ -6412,6 +6442,11 @@ public:
res = Read1(length, &Binary_DocumentTableReader::Read_Row, this, poResult);
pCStringWriter->WriteString(std::wstring(_T("</w:tr>")));
}
else if(c_oSerDocTableType::Sdt == type)
{
SdtWraper oSdt(2);
res = Read1(length, &Binary_DocumentTableReader::ReadSdt, this, &oSdt);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
......@@ -6444,6 +6479,11 @@ public:
res = Read1(length, &Binary_DocumentTableReader::ReadCell, this, poResult);
pCStringWriter->WriteString(std::wstring(_T("</w:tc>")));
}
else if(c_oSerDocTableType::Sdt == type)
{
SdtWraper oSdt(3);
res = Read1(length, &Binary_DocumentTableReader::ReadSdt, this, &oSdt);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
......@@ -7147,6 +7187,306 @@ public:
{
return oBinary_pPrReader.Read_SecPr(type, length, poResult);
}
int ReadSdt(BYTE type, long length, void* poResult)
{
int res = 0;
SdtWraper* pSdt = static_cast<SdtWraper*>(poResult);
if (c_oSerSdt::Pr == type)
{
pSdt->m_oSdt.m_oSdtPr.Init();
res = Read1(length, &Binary_DocumentTableReader::ReadSdtPr, this, pSdt);
}
else if (c_oSerSdt::EndPr == type)
{
pSdt->m_oEndPr = new rPr(m_oFontTableWriter.m_mapFonts);
res = oBinary_rPrReader.Read(length, pSdt->m_oEndPr);
}
else if (c_oSerSdt::Content == type)
{
m_oDocumentWriter.m_oContent.WriteString(L"<w:sdt>");
if ( pSdt->m_oSdt.m_oSdtPr.IsInit() )
{
m_oDocumentWriter.m_oContent.WriteString(pSdt->m_oSdt.m_oSdtPr->toXMLStart());
if (NULL != pSdt->m_oRPr)
{
pSdt->m_oRPr->Write(&m_oDocumentWriter.m_oContent);
}
m_oDocumentWriter.m_oContent.WriteString(pSdt->m_oSdt.m_oSdtPr->toXMLEnd());
}
if (NULL != pSdt->m_oEndPr)
{
m_oDocumentWriter.m_oContent.WriteString(L"<w:sdtEndPr>");
pSdt->m_oEndPr->Write(&m_oDocumentWriter.m_oContent);
m_oDocumentWriter.m_oContent.WriteString(L"</w:sdtEndPr>");
}
m_oDocumentWriter.m_oContent.WriteString(L"<w:sdtContent>");
switch(pSdt->m_nType)
{
case 0:
res = Read1(length, &Binary_DocumentTableReader::ReadDocumentContent, this, this);
break;
case 1:
res = Read1(length, &Binary_DocumentTableReader::ReadParagraphContent, this, this);
break;
case 2:
res = Read1(length, &Binary_DocumentTableReader::Read_TableContent, this, &m_oDocumentWriter.m_oContent);
break;
case 3:
res = Read1(length, &Binary_DocumentTableReader::ReadRowContent, this, &m_oDocumentWriter.m_oContent);
break;
}
m_oDocumentWriter.m_oContent.WriteString(L"</w:sdtContent>");
m_oDocumentWriter.m_oContent.WriteString(L"</w:sdt>");
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadSdtPr(BYTE type, long length, void* poResult)
{
int res = 0;
SdtWraper* pSdtWraper = static_cast<SdtWraper*>(poResult);
OOX::Logic::CSdtPr* pSdtPr = pSdtWraper->m_oSdt.m_oSdtPr.GetPointer();
if (c_oSerSdt::Type == type)
{
pSdtPr->m_eType = (OOX::Logic::ESdtType)m_oBufferedStream.GetUChar();
}
else if (c_oSerSdt::Alias == type)
{
pSdtPr->m_oAlias.Init();
pSdtPr->m_oAlias->m_sVal.Init();
pSdtPr->m_oAlias->m_sVal->append(m_oBufferedStream.GetString3(length));
}
else if (c_oSerSdt::ComboBox == type)
{
pSdtPr->m_oComboBox.Init();
res = Read1(length, &Binary_DocumentTableReader::ReadSdtComboBox, this, pSdtPr->m_oComboBox.GetPointer());
}
else if (c_oSerSdt::DataBinding == type)
{
pSdtPr->m_oDataBinding.Init();
res = Read1(length, &Binary_DocumentTableReader::ReadSdtPrDataBinding, this, pSdtPr->m_oDataBinding.GetPointer());
}
else if (c_oSerSdt::PrDate == type)
{
pSdtPr->m_oDate.Init();
res = Read1(length, &Binary_DocumentTableReader::ReadSdtPrDate, this, pSdtPr->m_oDate.GetPointer());
}
else if (c_oSerSdt::DocPartList == type)
{
pSdtPr->m_oDocPartList.Init();
res = Read1(length, &Binary_DocumentTableReader::ReadDocPartList, this, pSdtPr->m_oDocPartList.GetPointer());
}
else if (c_oSerSdt::DocPartObj == type)
{
pSdtPr->m_oDocPartObj.Init();
res = Read1(length, &Binary_DocumentTableReader::ReadDocPartList, this, pSdtPr->m_oDocPartObj.GetPointer());
}
else if (c_oSerSdt::DropDownList == type)
{
pSdtPr->m_oDropDownList.Init();
res = Read1(length, &Binary_DocumentTableReader::ReadDropDownList, this, pSdtPr->m_oDropDownList.GetPointer());
}
else if (c_oSerSdt::Id == type)
{
pSdtPr->m_oId.Init();
pSdtPr->m_oId->m_oVal.Init();
pSdtPr->m_oId->m_oVal->SetValue(m_oBufferedStream.GetULong());
}
else if (c_oSerSdt::Label == type)
{
pSdtPr->m_oLabel.Init();
pSdtPr->m_oLabel->m_oVal.Init();
pSdtPr->m_oLabel->m_oVal->SetValue(m_oBufferedStream.GetULong());
}
else if (c_oSerSdt::Lock == type)
{
pSdtPr->m_oLock.Init();
pSdtPr->m_oLock->m_oVal.SetValue((SimpleTypes::ELock)m_oBufferedStream.GetUChar());
}
else if (c_oSerSdt::PlaceHolder == type)
{
pSdtPr->m_oPlaceHolder.Init();
pSdtPr->m_oPlaceHolder->m_oDocPart.Init();
pSdtPr->m_oPlaceHolder->m_oDocPart->m_sVal.Init();
pSdtPr->m_oPlaceHolder->m_oDocPart->m_sVal->append(m_oBufferedStream.GetString3(length));
}
else if (c_oSerSdt::RPr == type)
{
pSdtWraper->m_oRPr = new rPr(m_oFontTableWriter.m_mapFonts);
res = oBinary_rPrReader.Read(length, pSdtWraper->m_oRPr);
}
else if (c_oSerSdt::ShowingPlcHdr == type)
{
pSdtPr->m_oShowingPlcHdr.Init();
pSdtPr->m_oShowingPlcHdr->m_oVal.FromBool(m_oBufferedStream.GetBool());
}
else if (c_oSerSdt::TabIndex == type)
{
pSdtPr->m_oTabIndex.Init();
pSdtPr->m_oTabIndex->m_oVal.Init();
pSdtPr->m_oTabIndex->m_oVal->SetValue(m_oBufferedStream.GetULong());
}
else if (c_oSerSdt::Tag == type)
{
pSdtPr->m_oTag.Init();
pSdtPr->m_oTag->m_sVal.Init();
pSdtPr->m_oTag->m_sVal->append(m_oBufferedStream.GetString3(length));
}
else if (c_oSerSdt::Temporary == type)
{
pSdtPr->m_oTemporary.Init();
pSdtPr->m_oTemporary->m_oVal.FromBool(m_oBufferedStream.GetBool());
}
else if (c_oSerSdt::MultiLine == type)
{
pSdtPr->m_oText.Init();
pSdtPr->m_oText->m_oMultiLine.Init();
pSdtPr->m_oText->m_oMultiLine->FromBool(m_oBufferedStream.GetBool());
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadSdtComboBox(BYTE type, long length, void* poResult)
{
int res = 0;
OOX::Logic::CSdtComboBox* pSdtComboBox = static_cast<OOX::Logic::CSdtComboBox*>(poResult);
if (c_oSerSdt::LastValue == type)
{
pSdtComboBox->m_sLastValue.Init();
pSdtComboBox->m_sLastValue->append(m_oBufferedStream.GetString3(length));
}
else if (c_oSerSdt::SdtListItem == type)
{
ComplexTypes::Word::CSdtListItem* pSdtListItem = new ComplexTypes::Word::CSdtListItem();
res = Read1(length, &Binary_DocumentTableReader::ReadSdtListItem, this, pSdtListItem);
pSdtComboBox->m_arrListItem.push_back(pSdtListItem); }
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadSdtListItem(BYTE type, long length, void* poResult)
{
int res = 0;
ComplexTypes::Word::CSdtListItem* pSdtListItem = static_cast<ComplexTypes::Word::CSdtListItem*>(poResult);
if (c_oSerSdt::DisplayText == type)
{
pSdtListItem->m_sDisplayText.Init();
pSdtListItem->m_sDisplayText->append(m_oBufferedStream.GetString3(length));
}
else if (c_oSerSdt::Value == type)
{
pSdtListItem->m_sValue.Init();
pSdtListItem->m_sValue->append(m_oBufferedStream.GetString3(length));
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadSdtPrDataBinding(BYTE type, long length, void* poResult)
{
int res = 0;
ComplexTypes::Word::CDataBinding* pDataBinding = static_cast<ComplexTypes::Word::CDataBinding*>(poResult);
if (c_oSerSdt::PrefixMappings == type)
{
pDataBinding->m_sPrefixMappings.Init();
pDataBinding->m_sPrefixMappings->append(m_oBufferedStream.GetString3(length));
}
else if (c_oSerSdt::StoreItemID == type)
{
pDataBinding->m_sStoreItemID.Init();
pDataBinding->m_sStoreItemID->append(m_oBufferedStream.GetString3(length));
}
else if (c_oSerSdt::XPath == type)
{
pDataBinding->m_sXPath.Init();
pDataBinding->m_sXPath->append(m_oBufferedStream.GetString3(length));
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadSdtPrDate(BYTE type, long length, void* poResult)
{
int res = 0;
OOX::Logic::CDate* pDate = static_cast<OOX::Logic::CDate*>(poResult);
if (c_oSerSdt::FullDate == type)
{
pDate->m_oFullDate.Init();
pDate->m_oFullDate->SetValue(m_oBufferedStream.GetString3(length));
}
else if (c_oSerSdt::Calendar == type)
{
pDate->m_oCalendar.Init();
pDate->m_oCalendar->m_oVal.SetValue((SimpleTypes::ECalendarType)m_oBufferedStream.GetUChar());
}
else if (c_oSerSdt::DateFormat == type)
{
pDate->m_oDateFormat.Init();
pDate->m_oDateFormat->m_sVal.Init();
pDate->m_oDateFormat->m_sVal->append(m_oBufferedStream.GetString3(length));
}
else if (c_oSerSdt::Lid == type)
{
pDate->m_oLid.Init();
pDate->m_oLid->m_oVal.Init();
pDate->m_oLid->m_oVal->SetValue(m_oBufferedStream.GetString3(length));
}
else if (c_oSerSdt::StoreMappedDataAs == type)
{
pDate->m_oStoreMappedDateAs.Init();
pDate->m_oStoreMappedDateAs->m_oVal.SetValue((SimpleTypes::ESdtDateMappingType)m_oBufferedStream.GetUChar());
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadDocPartList(BYTE type, long length, void* poResult)
{
int res = 0;
OOX::Logic::CSdtDocPart* pDocPart = static_cast<OOX::Logic::CSdtDocPart*>(poResult);
if (c_oSerSdt::DocPartCategory == type)
{
pDocPart->m_oDocPartCategory.Init();
pDocPart->m_oDocPartCategory->m_sVal.Init();
pDocPart->m_oDocPartCategory->m_sVal->append(m_oBufferedStream.GetString3(length));
}
else if (c_oSerSdt::DocPartGallery == type)
{
pDocPart->m_oDocPartGallery.Init();
pDocPart->m_oDocPartGallery->m_sVal.Init();
pDocPart->m_oDocPartGallery->m_sVal->append(m_oBufferedStream.GetString3(length));
}
else if (c_oSerSdt::DocPartUnique == type)
{
pDocPart->m_oDocPartUnique.Init();
pDocPart->m_oDocPartUnique->m_oVal.FromBool(m_oBufferedStream.GetBool());
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadDropDownList(BYTE type, long length, void* poResult)
{
int res = 0;
OOX::Logic::CSdtDropDownList* pDropDownList = static_cast<OOX::Logic::CSdtDropDownList*>(poResult);
if (c_oSerSdt::LastValue == type)
{
pDropDownList->m_sLastValue.Init();
pDropDownList->m_sLastValue->append(m_oBufferedStream.GetString3(length));
}
else if (c_oSerSdt::SdtListItem == type)
{
ComplexTypes::Word::CSdtListItem* pSdtListItem = new ComplexTypes::Word::CSdtListItem();
res = Read1(length, &Binary_DocumentTableReader::ReadSdtListItem, this, pSdtListItem);
pDropDownList->m_arrListItem.push_back(pSdtListItem);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
};
class Binary_NotesTableReader : public Binary_CommonReader<Binary_NotesTableReader>
{
......
......@@ -463,7 +463,8 @@ extern int g_nCurFormatVersion;
FldSimple = 11,
Del = 12,
Ins = 13,
Background = 14
Background = 14,
Sdt = 15
};}
namespace c_oSerDocTableType{enum c_oSerDocTableType
{
......@@ -477,7 +478,8 @@ extern int g_nCurFormatVersion;
Cell = 6,
Cell_Pr = 7,
Cell_Content = 8,
tblGridChange = 9
tblGridChange = 9,
Sdt = 10
};}
namespace c_oSerRunType{enum c_oSerRunType
{
......@@ -1003,6 +1005,45 @@ extern int g_nCurFormatVersion;
Data = 1,
Program = 2
};}
namespace c_oSerSdt{enum c_oSerSdt
{
Pr = 0,
EndPr = 1,
Content = 2,
Type = 3,
Alias = 4,
ComboBox = 5,
LastValue = 6,
SdtListItem = 7,
DisplayText = 8,
Value = 9,
DataBinding = 10,
PrefixMappings = 11,
StoreItemID = 12,
XPath = 13,
PrDate = 14,
FullDate = 15,
Calendar = 16,
DateFormat = 17,
Lid = 18,
StoreMappedDataAs = 19,
DocPartList = 20,
DocPartObj = 21,
DocPartCategory = 22,
DocPartGallery = 23,
DocPartUnique = 24,
DropDownList = 25,
Id = 26,
Label = 27,
Lock = 28,
PlaceHolder = 29,
RPr = 30,
ShowingPlcHdr = 31,
TabIndex = 32,
Tag = 33,
Temporary = 34,
MultiLine = 35
};}
}
#endif // #ifndef DOCX_BIN_READER_WRITER_DEFINES
......@@ -3047,8 +3047,9 @@ namespace BinDocxRW
case OOX::et_w_sdt:
{
OOX::Logic::CSdt* pStd = static_cast<OOX::Logic::CSdt*>(item);
if(pStd->m_oSdtContent.IsInit())
WriteDocumentContent(pStd->m_oSdtContent.get().m_arrItems);
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::Sdt);
WriteSdt(pStd, 0, NULL, 0, 0, 0);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}break;
case OOX::et_w_smartTag:
{
......@@ -3189,8 +3190,9 @@ namespace BinDocxRW
case OOX::et_w_sdt:
{
OOX::Logic::CSdt* pStd = static_cast<OOX::Logic::CSdt*>(item);
if(pStd->m_oSdtContent.IsInit())
WriteParagraphContent(pStd->m_oSdtContent.get().m_arrItems);
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::Sdt);
WriteSdt(pStd, 1, NULL, 0, 0, 0);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
break;
}
case OOX::et_w_smartTag:
......@@ -6366,8 +6368,9 @@ namespace BinDocxRW
else if(OOX::et_w_sdt == item->getType())
{
OOX::Logic::CSdt* pStd = static_cast<OOX::Logic::CSdt*>(item);
if(pStd->m_oSdtContent.IsInit())
WriteTableContent(pStd->m_oSdtContent->m_arrItems, pTblPr, nRows, nCols);
nCurPos = m_oBcw.WriteItemStart(c_oSerDocTableType::Sdt);
WriteSdt(pStd, 2, pTblPr, 0, nRows, nCols);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
else if(OOX::et_w_smartTag == item->getType())
{
......@@ -6425,8 +6428,9 @@ namespace BinDocxRW
else if(OOX::et_w_sdt == item->getType())
{
OOX::Logic::CSdt* pStd = static_cast<OOX::Logic::CSdt*>(item);
if(pStd->m_oSdtContent.IsInit())
WriteRowContent(pStd->m_oSdtContent.get().m_arrItems, pTblPr, nCurRowIndex, nRows, nCols);
nCurPos = m_oBcw.WriteItemStart(c_oSerDocTableType::Sdt);
WriteSdt(pStd, 3, pTblPr, nCurRowIndex, nRows, nCols);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
else if(OOX::et_w_smartTag == item->getType())
{
......@@ -6462,6 +6466,287 @@ namespace BinDocxRW
oBinaryDocumentTableWriter.WriteDocumentContent(tc.m_arrItems);
m_oBcw.WriteItemEnd(nCurPos);
}
void WriteSdt(OOX::Logic::CSdt* pStd, int type, OOX::Logic::CTableProperty* pTblPr, int nCurRowIndex, int nRows, int nCols)
{
int nCurPos = 0;
if(pStd->m_oSdtPr.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Pr);
WriteSdtPr(pStd->m_oSdtPr.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(pStd->m_oSdtEndPr.IsInit() && pStd->m_oSdtEndPr->m_oRPr.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::EndPr);
brPrs.Write_rPr(pStd->m_oSdtEndPr->m_oRPr.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(pStd->m_oSdtContent.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Content);
switch(type)
{
case 0:
{
BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, m_oParamsDocumentWriter, m_mapIgnoreComments, bpPrs.m_oBinaryHeaderFooterTableWriter);
oBinaryDocumentTableWriter.WriteDocumentContent(pStd->m_oSdtContent.get().m_arrItems);
break;
}
case 1:
{
WriteParagraphContent(pStd->m_oSdtContent.get().m_arrItems);
break;
}
case 2:
{
WriteTableContent(pStd->m_oSdtContent->m_arrItems, pTblPr, nRows, nCols);
break;
}
case 3:
{
WriteRowContent(pStd->m_oSdtContent.get().m_arrItems, pTblPr, nCurRowIndex, nRows, nCols);
break;
}
}
m_oBcw.WriteItemEnd(nCurPos);
}
}
void WriteSdtPr(const OOX::Logic::CSdtPr& oStdPr)
{
int nCurPos = 0;
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Type);
m_oBcw.m_oStream.WriteBYTE(oStdPr.m_eType);
m_oBcw.WriteItemEnd(nCurPos);
if(oStdPr.m_oAlias.IsInit() && oStdPr.m_oAlias->m_sVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Alias);
m_oBcw.m_oStream.WriteStringW3(oStdPr.m_oAlias->m_sVal.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oComboBox.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::ComboBox);
WriteSdtComboBox(oStdPr.m_oComboBox.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oDataBinding.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DataBinding);
WriteSdtPrDataBinding(oStdPr.m_oDataBinding.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oDate.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::PrDate);
WriteSdtPrDate(oStdPr.m_oDate.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oDocPartList.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DocPartList);
WriteDocPartList(oStdPr.m_oDocPartList.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oDocPartObj.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DocPartObj);
WriteDocPartList(oStdPr.m_oDocPartObj.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oDropDownList.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DropDownList);
WriteDropDownList(oStdPr.m_oDropDownList.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oId.IsInit() && oStdPr.m_oId->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Id);
m_oBcw.m_oStream.WriteULONG(oStdPr.m_oId->m_oVal->GetValue());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oLabel.IsInit() && oStdPr.m_oLabel->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Label);
m_oBcw.m_oStream.WriteULONG(oStdPr.m_oLabel->m_oVal->GetValue());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oLock.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Lock);
m_oBcw.m_oStream.WriteBYTE(oStdPr.m_oLock->m_oVal.GetValue());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oPlaceHolder.IsInit() && oStdPr.m_oPlaceHolder->m_oDocPart.IsInit() && oStdPr.m_oPlaceHolder->m_oDocPart->m_sVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::PlaceHolder);
m_oBcw.m_oStream.WriteStringW3(oStdPr.m_oPlaceHolder->m_oDocPart->m_sVal.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oRPr.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::RPr);
brPrs.Write_rPr(oStdPr.m_oRPr.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oShowingPlcHdr.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::ShowingPlcHdr);
m_oBcw.m_oStream.WriteBOOL(oStdPr.m_oShowingPlcHdr->m_oVal.ToBool());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oTabIndex.IsInit() && oStdPr.m_oTabIndex->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::TabIndex);
m_oBcw.m_oStream.WriteULONG(oStdPr.m_oTabIndex->m_oVal->GetValue());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oTag.IsInit() && oStdPr.m_oTag->m_sVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Tag);
m_oBcw.m_oStream.WriteStringW3(oStdPr.m_oTag->m_sVal.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oTemporary.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Temporary);
m_oBcw.m_oStream.WriteBOOL(oStdPr.m_oTemporary->m_oVal.ToBool());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oText.IsInit() && oStdPr.m_oText->m_oMultiLine.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::MultiLine);
m_oBcw.m_oStream.WriteBOOL(oStdPr.m_oText->m_oMultiLine->ToBool());
m_oBcw.WriteItemEnd(nCurPos);
}
}
void WriteSdtComboBox(const OOX::Logic::CSdtComboBox& oSdtComboBox)
{
int nCurPos = 0;
if(oSdtComboBox.m_sLastValue.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::LastValue);
m_oBcw.m_oStream.WriteStringW3(oSdtComboBox.m_sLastValue.get());
m_oBcw.WriteItemEnd(nCurPos);
}
for(size_t i = 0; i < oSdtComboBox.m_arrListItem.size(); ++i)
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::SdtListItem);
WriteSdtListItem(*oSdtComboBox.m_arrListItem[i]);
m_oBcw.WriteItemEnd(nCurPos);
}
}
void WriteSdtListItem(const ComplexTypes::Word::CSdtListItem& oSdtListItem)
{
int nCurPos = 0;
if(oSdtListItem.m_sDisplayText.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DisplayText);
m_oBcw.m_oStream.WriteStringW3(oSdtListItem.m_sDisplayText.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oSdtListItem.m_sValue.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Value);
m_oBcw.m_oStream.WriteStringW3(oSdtListItem.m_sValue.get());
m_oBcw.WriteItemEnd(nCurPos);
}
}
void WriteSdtPrDataBinding(const ComplexTypes::Word::CDataBinding& oDataBinding)
{
int nCurPos = 0;
if(oDataBinding.m_sPrefixMappings.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::PrefixMappings);
m_oBcw.m_oStream.WriteStringW3(oDataBinding.m_sPrefixMappings.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oDataBinding.m_sStoreItemID.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::StoreItemID);
m_oBcw.m_oStream.WriteStringW3(oDataBinding.m_sStoreItemID.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oDataBinding.m_sXPath.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::XPath);
m_oBcw.m_oStream.WriteStringW3(oDataBinding.m_sXPath.get());
m_oBcw.WriteItemEnd(nCurPos);
}
}
void WriteSdtPrDate(const OOX::Logic::CDate& oDate)
{
int nCurPos = 0;
if(oDate.m_oFullDate.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::FullDate);
m_oBcw.m_oStream.WriteStringW3(oDate.m_oFullDate->GetValue());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oDate.m_oCalendar.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Calendar);
m_oBcw.m_oStream.WriteBYTE(oDate.m_oCalendar->m_oVal.GetValue());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oDate.m_oDateFormat.IsInit() && oDate.m_oDateFormat->m_sVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DateFormat);
m_oBcw.m_oStream.WriteStringW3(oDate.m_oDateFormat->m_sVal.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oDate.m_oLid.IsInit() && oDate.m_oLid->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Lid);
m_oBcw.m_oStream.WriteStringW3(oDate.m_oLid->m_oVal->GetValue());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oDate.m_oStoreMappedDateAs.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::StoreMappedDataAs);
m_oBcw.m_oStream.WriteBYTE(oDate.m_oStoreMappedDateAs->m_oVal.GetValue());
m_oBcw.WriteItemEnd(nCurPos);
}
}
void WriteDocPartList(const OOX::Logic::CSdtDocPart& oSdtDocPart)
{
int nCurPos = 0;
if(oSdtDocPart.m_oDocPartCategory.IsInit() && oSdtDocPart.m_oDocPartCategory->m_sVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DocPartCategory);
m_oBcw.m_oStream.WriteStringW3(oSdtDocPart.m_oDocPartCategory->m_sVal.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oSdtDocPart.m_oDocPartGallery.IsInit() && oSdtDocPart.m_oDocPartGallery->m_sVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DocPartGallery);
m_oBcw.m_oStream.WriteStringW3(oSdtDocPart.m_oDocPartGallery->m_sVal.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oSdtDocPart.m_oDocPartUnique.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DocPartUnique);
m_oBcw.m_oStream.WriteBOOL(oSdtDocPart.m_oDocPartUnique->m_oVal.ToBool());
m_oBcw.WriteItemEnd(nCurPos);
}
}
void WriteDropDownList(const OOX::Logic::CSdtDropDownList& oDropDownList)
{
int nCurPos = 0;
if(oDropDownList.m_sLastValue.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::LastValue);
m_oBcw.m_oStream.WriteStringW3(oDropDownList.m_sLastValue.get());
m_oBcw.WriteItemEnd(nCurPos);
}
for(size_t i = 0; i < oDropDownList.m_arrListItem.size(); ++i)
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::SdtListItem);
WriteSdtListItem(*oDropDownList.m_arrListItem[i]);
m_oBcw.WriteItemEnd(nCurPos);
}
}
};
class BinaryCommentsTableWriter
{
......
......@@ -142,7 +142,7 @@ namespace PPTX
pWriter->EndAttributes();
pWriter->StartNode(namespaceLock_ + L"graphicFrameLocks");
pWriter->StartNode(namespaceLock_ + L":graphicFrameLocks");
pWriter->StartAttributes();
......@@ -236,4 +236,4 @@ namespace PPTX
} // namespace Logic
} // namespace PPTX
#endif // PPTX_LOGIC_CNVGRAPHICFRAMESPPR_INCLUDE_H
\ No newline at end of file
#endif // PPTX_LOGIC_CNVGRAPHICFRAMESPPR_INCLUDE_H
......@@ -340,7 +340,11 @@ namespace ComplexTypes
}
virtual std::wstring ToString() const
{
std::wstring sResult = _T("w:multiLine=\"") + m_oMultiLine.ToString() + _T("\"");
std::wstring sResult;
if(m_oMultiLine.IsInit())
{
sResult = _T("w:multiLine=\"") + m_oMultiLine->ToString() + _T("\"");
}
return sResult;
}
......@@ -356,7 +360,7 @@ namespace ComplexTypes
public:
SimpleTypes::COnOff<SimpleTypes::onoffFalse> m_oMultiLine;
nullable<SimpleTypes::COnOff<SimpleTypes::onoffFalse>> m_oMultiLine;
};
} // Word
......@@ -503,7 +507,7 @@ namespace OOX
WritingElement_ReadNode( oNode, oChild, _T("w:calendar"), m_oCalendar );
WritingElement_ReadNode( oNode, oChild, _T("w:dateFormat"), m_oDateFormat );
WritingElement_ReadNode( oNode, oChild, _T("w:lid"), m_oLid );
WritingElement_ReadNode( oNode, oChild, _T("w:storeMappedDataAs"), m_oStoreMappedDataAs );
WritingElement_ReadNode( oNode, oChild, _T("w:storeMappedDateAs"), m_oStoreMappedDateAs );
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -523,8 +527,8 @@ namespace OOX
m_oDateFormat = oReader;
else if ( _T("w:lid") == sName )
m_oLid = oReader;
else if ( _T("w:storeMappedDataAs") == sName )
m_oStoreMappedDataAs = oReader;
else if ( _T("w:storeMappedDateAs") == sName )
m_oStoreMappedDateAs = oReader;
}
}
virtual std::wstring toXML() const
......@@ -543,7 +547,7 @@ namespace OOX
WritingElement_WriteNode_1( _T("<w:calendar "), m_oCalendar );
WritingElement_WriteNode_1( _T("<w:dateFormat "), m_oDateFormat );
WritingElement_WriteNode_1( _T("<w:lid "), m_oLid );
WritingElement_WriteNode_1( _T("<w:storeMappedDataAs "), m_oStoreMappedDataAs );
WritingElement_WriteNode_1( _T("<w:storeMappedDateAs "), m_oStoreMappedDateAs );
sResult += _T("</w:date>");
......@@ -573,7 +577,7 @@ namespace OOX
nullable<ComplexTypes::Word::CCalendarType > m_oCalendar;
nullable<ComplexTypes::Word::String > m_oDateFormat;
nullable<ComplexTypes::Word::CLang > m_oLid;
nullable<ComplexTypes::Word::CSdtDateMappingType> m_oStoreMappedDataAs;
nullable<ComplexTypes::Word::CSdtDateMappingType> m_oStoreMappedDateAs;
};
//--------------------------------------------------------------------------------
......@@ -630,6 +634,18 @@ namespace OOX
return sResult;
}
std::wstring toXML2(const std::wstring& sName) const
{
std::wstring sResult = L"<" + sName + L">";
WritingElement_WriteNode_1( _T("<w:docPartCategory "), m_oDocPartCategory );
WritingElement_WriteNode_1( _T("<w:docPartGallery "), m_oDocPartGallery );
WritingElement_WriteNode_1( _T("<w:docPartUnique "), m_oDocPartUnique );
sResult += L"</" + sName + L">";;
return sResult;
}
virtual EElementType getType() const
{
......@@ -1013,7 +1029,7 @@ namespace OOX
m_eType = sdttypeBibliography;
else if ( sdttypeUnknown == m_eType && _T("w:citation") == sName )
m_eType = sdttypeCitation;
else if ( sdttypeUnknown == m_eType && _T("w:alias") == sName )
else if ( sdttypeUnknown == m_eType && _T("w:comboBox") == sName )
{
m_oComboBox = oReader;
m_eType = sdttypeComboBox;
......@@ -1073,7 +1089,7 @@ namespace OOX
}
}
}
virtual std::wstring toXML() const
std::wstring toXMLStart() const
{
std::wstring sResult = _T("<w:sdtPr>");
......@@ -1093,7 +1109,7 @@ namespace OOX
{
case sdttypeBibliography:
{
sResult += _T("<bibliography/>");
sResult += _T("<w:bibliography/>");
break;
}
case sdttypeCitation:
......@@ -1118,14 +1134,14 @@ namespace OOX
case sdttypeDocPartList:
{
if ( m_oDocPartList.IsInit() )
sResult += m_oDocPartList->toXML();
sResult += m_oDocPartList->toXML2(L"w:docPartList");
break;
}
case sdttypeDocPartObj:
{
if ( m_oDocPartObj.IsInit() )
sResult += m_oDocPartObj->toXML();
sResult += m_oDocPartObj->toXML2(L"w:docPartObj");
break;
}
......@@ -1158,21 +1174,27 @@ namespace OOX
}
case sdttypeText:
{
sResult += _T("<w:text ");
if ( m_oText.IsInit() )
{
sResult += _T("<w:text ");
sResult += m_oText->ToString();
sResult += _T("/>");
}
sResult += _T("/>");
break;
}
}
sResult += _T("</w:sdtPr>");
return sResult;
}
std::wstring toXMLEnd() const
{
return _T("</w:sdtPr>");
}
virtual std::wstring toXML() const
{
return toXMLStart() + toXMLEnd();
}
virtual EElementType getType() const
{
return et_w_sdtPr;
......
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