Commit c30be9db authored by ElenaSubbotina's avatar ElenaSubbotina

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

parents e646e21e ed505fe4
......@@ -41,7 +41,7 @@ namespace Writers
class ChartElem
{
public:
CString content;
std::wstring content;
CString filename;
int index;
};
......@@ -79,9 +79,9 @@ namespace Writers
OOX::CPath filePath = pathChartDir + FILE_SEPARATOR_STR + elem->filename;
CFile oFile;
oFile.CreateFile(filePath.GetPath());
oFile.WriteStringUTF8(CString(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n")));
NSFile::CFileBinary oFile;
oFile.CreateFileW(string2std_string(filePath.GetPath()));
oFile.WriteStringUTF8(L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n");
oFile.WriteStringUTF8(elem->content);
oFile.CloseFile();
......@@ -91,7 +91,7 @@ namespace Writers
}
}
}
void AddChart(CString& content, CString& sRelsName, CString& sFileName, int& index)
void AddChart(std::wstring& content, CString& sRelsName, CString& sFileName, int& index)
{
ChartElem* pChartElem = new ChartElem();
pChartElem->content = content;
......
......@@ -6590,21 +6590,21 @@ public:
m_oFileWriter.m_pDrawingConverter->WriteRels(bstrChartsWorksheetRelType, std_string2string(sChartsWorksheetRelsName), CString(), &rIdXlsx);
pChartSpace->m_oChartSpace.m_externalData = new OOX::Spreadsheet::CT_ExternalData();
pChartSpace->m_oChartSpace.m_externalData->m_id = new CString();
pChartSpace->m_oChartSpace.m_externalData->m_id->AppendFormat(L"rId%d", rIdXlsx);
pChartSpace->m_oChartSpace.m_externalData->m_id = new std::wstring();
pChartSpace->m_oChartSpace.m_externalData->m_id->append(L"rId");
pChartSpace->m_oChartSpace.m_externalData->m_id->append(std::to_wstring(rIdXlsx));
pChartSpace->m_oChartSpace.m_externalData->m_autoUpdate = new OOX::Spreadsheet::CT_Boolean();
pChartSpace->m_oChartSpace.m_externalData->m_autoUpdate->m_val = new bool(false);
//save chart.xml
XmlUtils::CStringWriter sw;
NSStringUtils::CStringBuilder sw;
pChartSpace->toXML(sw);
CString sChartContent = sw.GetData();
CString sFilename;
CString sRelsName;
int nChartIndex;
m_oFileWriter.m_oChartWriter.AddChart(sChartContent, sRelsName, sFilename, nChartIndex);
m_oFileWriter.m_oChartWriter.AddChart(sw.GetData(), sRelsName, sFilename, nChartIndex);
m_oFileWriter.m_oContentTypesWriter.AddOverrideRaw(oSaveParams.sAdditionalContentTypes);
OOX::CPath pathChartsRels = pathChartsRelsDir.GetPath() + FILE_SEPARATOR_STR + sFilename + _T(".rels");
......
......@@ -66,10 +66,10 @@ namespace BinXlsxRW {
class ChartWriter
{
public:
std::map<CString, std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>*> m_mapSheets;
std::map<CString, int> m_mapFormats;
std::map<std::wstring, std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>*> m_mapSheets;
std::map<std::wstring, int> m_mapFormats;
std::vector<OOX::Spreadsheet::CXfs*> m_aXfs;
std::vector<CString> m_aTableNames;
std::vector<std::wstring> m_aTableNames;
int m_nRow1;
int m_nCol1;
int m_nRow2;
......@@ -80,10 +80,10 @@ namespace BinXlsxRW {
void toXlsx(OOX::Spreadsheet::CXlsx& oXlsx);
void parseChart(const OOX::Spreadsheet::CT_Chart* pChart);
private:
OOX::Spreadsheet::CWorksheet* toXlsxGetSheet(std::map<CString, OOX::Spreadsheet::CWorksheet*>& mapWorksheets, const CString& sName);
void toXlsxSheetdata(OOX::Spreadsheet::CWorksheet* pWorksheet, const std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>& rows, std::vector<CString>& aSharedStrings);
void parseCell(const CString& sheet, const int& nRow, const int& nCol, const CString& val, CString* format);
OOX::Spreadsheet::CCell* parseCreateCell(const int& nRow, const int& nCol, const CString& val, CString* format);
OOX::Spreadsheet::CWorksheet* toXlsxGetSheet(std::map<std::wstring, OOX::Spreadsheet::CWorksheet*>& mapWorksheets, const std::wstring& sName);
void toXlsxSheetdata(OOX::Spreadsheet::CWorksheet* pWorksheet, const std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>& rows, std::vector<std::wstring>& aSharedStrings);
void parseCell(const std::wstring& sheet, const int& nRow, const int& nCol, const std::wstring& val, std::wstring* format);
OOX::Spreadsheet::CCell* parseCreateCell(const int& nRow, const int& nCol, const std::wstring& val, std::wstring* format);
void parseStrRef(const OOX::Spreadsheet::CT_StrRef* pStrRef, bool bUpdateRange, const wchar_t* cRangeName);
void parseNumRef(const OOX::Spreadsheet::CT_NumRef* pNumRef, bool bUpdateRange, const wchar_t* cRangeName);
void parseMultiLvlStrRef(const OOX::Spreadsheet::CT_MultiLvlStrRef* pMultiLvlStrRef, bool bUpdateRange, const wchar_t* cRangeName);
......
......@@ -95,7 +95,7 @@ namespace DocWrapper {
sFontName = pTheme->GetMinorFont();
}
if(sFontName.IsEmpty() && oRFont.IsInit() && oRFont->m_sVal.IsInit())
sFontName = oRFont->ToString2();
sFontName = std_string2string(oRFont->ToString2());
if(sFontName.IsEmpty())
sFontName = CString(gc_sNoNameFont);
//подбор перенесен в js
......
......@@ -218,8 +218,9 @@ namespace BinXlsxRW{
m_pExternalDrawingConverter->WriteRels(bstrChartsWorksheetRelType, std_string2string(sChartsWorksheetRelsName), CString(), &rId);
oChartSpace.m_oChartSpace.m_externalData = new OOX::Spreadsheet::CT_ExternalData();
oChartSpace.m_oChartSpace.m_externalData->m_id = new CString();
oChartSpace.m_oChartSpace.m_externalData->m_id->AppendFormat(L"rId%d", rId);
oChartSpace.m_oChartSpace.m_externalData->m_id = new std::wstring();
oChartSpace.m_oChartSpace.m_externalData->m_id->append(L"rId");
oChartSpace.m_oChartSpace.m_externalData->m_id->append(std::to_wstring(rId));
oChartSpace.m_oChartSpace.m_externalData->m_autoUpdate = new OOX::Spreadsheet::CT_Boolean();
oChartSpace.m_oChartSpace.m_externalData->m_autoUpdate->m_val = new bool(false);
}
......
......@@ -452,7 +452,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Bar3DChart *chart)
odf_context()->chart_context()->set_chart_bar_direction(*chart->m_barDir->m_val);
if (chart->m_gapWidth && chart->m_gapWidth->m_val)
odf_context()->chart_context()->set_chart_bar_gap_width(string2std_string(*chart->m_gapWidth->m_val));
odf_context()->chart_context()->set_chart_bar_gap_width(*chart->m_gapWidth->m_val);
//if (chart->m_overlap && chart->m_overlap->m_val)
// odf_context()->chart_context()->set_chart_bar_overlap(string2std_string(*chart->m_overlap->m_val));
......@@ -483,10 +483,10 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_BarChart *chart)
odf_context()->chart_context()->set_chart_bar_direction(*chart->m_barDir->m_val);
if (chart->m_gapWidth && chart->m_gapWidth->m_val)
odf_context()->chart_context()->set_chart_bar_gap_width(string2std_string(*chart->m_gapWidth->m_val));
odf_context()->chart_context()->set_chart_bar_gap_width(*chart->m_gapWidth->m_val);
if (chart->m_overlap && chart->m_overlap->m_val)
odf_context()->chart_context()->set_chart_bar_overlap(string2std_string(*chart->m_overlap->m_val));
odf_context()->chart_context()->set_chart_bar_overlap(*chart->m_overlap->m_val);
odf_context()->chart_context()->start_group_series();
convert(chart->m_dLbls);
......@@ -723,7 +723,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_StockChart *chart)
std::wstring gap_width;
if (chart->m_upDownBars->m_gapWidth && chart->m_upDownBars->m_gapWidth->m_val)
{
gap_width = string2std_string(*chart->m_upDownBars->m_gapWidth->m_val);
gap_width = *chart->m_upDownBars->m_gapWidth->m_val;
/*odf_context()->chart_context()->set_chart_bar_gap_width(gap_width);*/
}
......@@ -1039,7 +1039,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_SerTx* ser_tx)
if (ser_tx->m_strRef)
{
if (ser_tx->m_strRef->m_f)
odf_context()->chart_context()->set_series_label_formula(string2std_string(*ser_tx->m_strRef->m_f));
odf_context()->chart_context()->set_series_label_formula(*ser_tx->m_strRef->m_f);
convert(ser_tx->m_strRef->m_strCache, false, true);
}
......@@ -1064,14 +1064,14 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_AxDataSource* cat, int type)
else if (cat->m_strRef)
{
if (cat->m_strRef->m_f)
odf_context()->chart_context()->set_category_axis_formula(string2std_string(*cat->m_strRef->m_f), type);
odf_context()->chart_context()->set_category_axis_formula(*cat->m_strRef->m_f, type);
convert(cat->m_strRef->m_strCache, true, false);
}
else if (cat->m_numRef)
{
if (cat->m_numRef->m_f)
odf_context()->chart_context()->set_category_axis_formula(string2std_string(*cat->m_numRef->m_f), type);
odf_context()->chart_context()->set_category_axis_formula(*cat->m_numRef->m_f, type);
convert(cat->m_numRef->m_numCache, true, false);
}
......@@ -1089,7 +1089,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_NumDataSource* val)
}
else if (val->m_numRef)
{
if (val->m_numRef->m_f)odf_context()->chart_context()->set_series_value_formula(string2std_string(*val->m_numRef->m_f));
if (val->m_numRef->m_f)odf_context()->chart_context()->set_series_value_formula(*val->m_numRef->m_f);
convert(val->m_numRef->m_numCache, false, false);
}
......@@ -1144,7 +1144,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_NumData *num_data, bool categori
{
if (num_data->m_pt[i] && num_data->m_pt[i]->m_v)
{
data.push_back(string2std_string(*num_data->m_pt[i]->m_v));
data.push_back(*num_data->m_pt[i]->m_v);
//double val=0;
//try
//{
......@@ -1156,7 +1156,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_NumData *num_data, bool categori
}
}
std::wstring format;
if (num_data->m_formatCode) format = string2std_string(*num_data->m_formatCode);
if (num_data->m_formatCode) format = *num_data->m_formatCode;
odf_context()->chart_context()->set_cash(format, data, categories, label);
}
......@@ -1169,7 +1169,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_StrData *str_data, bool categori
for (unsigned int i=0; i < str_data->m_pt.size(); i++)
{
if (str_data->m_pt[i] && str_data->m_pt[i]->m_v)
data.push_back(string2std_string(*str_data->m_pt[i]->m_v));
data.push_back(*str_data->m_pt[i]->m_v);
}
std::wstring format;
......
......@@ -687,6 +687,10 @@ namespace NSBinPptxRW
m_lPosition += lSizeMem;
m_pStreamCur += lSizeMem;
}
void CBinaryFileWriter::WriteStringWStd(const std::wstring& sBuffer)
{
WriteStringW(sBuffer.c_str());
}
void CBinaryFileWriter::WriteBYTEArray(const BYTE* pBuffer, size_t len)
{
......@@ -845,6 +849,10 @@ namespace NSBinPptxRW
{
WriteStringW3(sBuffer.GetBuffer());
}
void CBinaryFileWriter::WriteStringW4(const std::wstring& sBuffer)
{
WriteStringW3(sBuffer.c_str());
}
CBinaryFileWriter::CBinaryFileWriter()
{
m_strMainFolder = _T("");
......@@ -1749,6 +1757,58 @@ namespace NSBinPptxRW
return res;
}
}
std::wstring CBinaryFileReader::GetString4(_INT32 len)//len in byte for utf16
{
if (len < 1)
return _T("");
if (m_lPos + len > m_lSize)
return _T("");
_UINT32 lSize = len >> 1; //string in char
if (sizeof(wchar_t) == 4)
{
wchar_t * sBuffer = new wchar_t[lSize + 1];
memset(sBuffer, 0, lSize + 1);
UTF16* pStrUtf16 = (UTF16 *)m_pDataCur;
UTF32 *pStrUtf32 = (UTF32 *)sBuffer;
// this values will be modificated
const UTF16 *pStrUtf16_Conv = pStrUtf16;
UTF32 *pStrUtf32_Conv = pStrUtf32;
ConversionResult eUnicodeConversionResult =
ConvertUTF16toUTF32(&pStrUtf16_Conv
, &pStrUtf16[lSize]
, &pStrUtf32_Conv
, &pStrUtf32[lSize]
, strictConversion);
if (conversionOK != eUnicodeConversionResult)
{
delete[]sBuffer;
return _T("");
}
std::wstring res((WCHAR*)sBuffer, lSize);
delete[]sBuffer;
m_lPos += len;
m_pDataCur += len;
return res;
}
else
{
std::wstring res((WCHAR*)m_pDataCur, lSize);
m_lPos += len;
m_pDataCur += len;
return res;
}
}
bool CBinaryFileReader::GetArray(BYTE **pBuffer, _INT32 len)
{
......
......@@ -288,6 +288,7 @@ namespace NSBinPptxRW
void WriteDoubleReal(const double& dValue);
void WriteStringW(const WCHAR* sBuffer);
void WriteStringWStd(const std::wstring& sBuffer);
void WriteBYTEArray(const BYTE* pBuffer, size_t len);
void WriteStringA(const char* sBuffer);
void WriteStringA(CStringA& sBuffer);
......@@ -300,6 +301,7 @@ namespace NSBinPptxRW
void WriteStringW3(CString& sBuffer);
void WriteStringW3_2(const WCHAR* sBuffer);
void WriteStringW3_4(const WCHAR* sBuffer);
void WriteStringW4(const std::wstring& sBuffer);
// --------------------------------------------------------
void WriteLONG64(const _INT64& lValue);
void WriteDouble64(const double& dValue);
......@@ -520,6 +522,7 @@ namespace NSBinPptxRW
CStringA GetString1(_INT32 len);
CString GetString2();
CString GetString3(_INT32 len);
std::wstring GetString4(_INT32 len);
//LPSAFEARRAY GetArray(_INT32 len);
bool GetArray(BYTE **pBuffer, _INT32 len);
......
......@@ -480,6 +480,10 @@ namespace SimpleTypes
sResult.Format( _T("%f"), m_dValue);
return sResult;
}
virtual std::wstring ToString2() const
{
return std::to_wstring(m_dValue);
}
void SetValue(double dValue)
{
......
......@@ -68,6 +68,12 @@ namespace SimpleTypes
{
return m_sValue;
}
std::wstring ToString2()
{
std::wstring sRes(m_sValue.GetBuffer());
m_sValue.ReleaseBuffer();
return sRes;
}
SimpleType_FromString2 (CString)
SimpleType_Operator_Equal (CRelationshipId)
......@@ -551,6 +557,46 @@ namespace SimpleTypes
}
}
CString ToString2(EOnOffToString eType) const
{
if (onofftostringTrue == eType)
{
switch (this->m_eValue)
{
case onoffFalse: return _T("false");
case onoffTrue: return _T("true");
default: return _T("false");
}
}
else if (onofftostring1 == eType)
{
switch (this->m_eValue)
{
case onoffFalse: return _T("0");
case onoffTrue: return _T("1");
default: return _T("0");
}
}
else if (onofftostringOn == eType)
{
switch (this->m_eValue)
{
case onoffFalse: return _T("off");
case onoffTrue: return _T("on");
default: return _T("off");
}
}
else if (onofftostringT == eType)
{
switch (this->m_eValue)
{
case onoffFalse: return _T("f");
case onoffTrue: return _T("t");
default: return _T("f");
}
}
return _T("false");
}
std::wstring ToString3(EOnOffToString eType) const
{
if(onofftostringTrue == eType)
{
......
......@@ -88,9 +88,9 @@ namespace OOX
}
if(m_oSparklineGroups.IsInit())
{
XmlUtils::CStringWriter writer;
NSStringUtils::CStringBuilder writer;
m_oSparklineGroups->toXML(writer);
sResult += writer.GetData();
sResult += writer.GetData().c_str();
}
sResult += _T("</");
......
......@@ -312,7 +312,7 @@ namespace OOX
long nIndex = m_lObjectIdVML;
if(NULL != m_mapComments && m_mapComments->size() > 0)
{
for (std::map<CString, OOX::Spreadsheet::CCommentItem*>::const_iterator it = m_mapComments->begin(); it != m_mapComments->end(); ++it)
for (std::map<std::wstring, OOX::Spreadsheet::CCommentItem*>::const_iterator it = m_mapComments->begin(); it != m_mapComments->end(); ++it)
{
OOX::Spreadsheet::CCommentItem* comment = it->second;
CString sStyle;
......@@ -413,7 +413,7 @@ namespace OOX
public:
CPath m_oReadPath;
std::map<CString, OOX::Spreadsheet::CCommentItem*>* m_mapComments;
std::map<std::wstring, OOX::Spreadsheet::CCommentItem*>* m_mapComments;
std::map<CString, int> m_mapShapes; //связь id (_x0000_s1025) с номером объекта для комментов
std::map<CString,CString> m_mapShapesXml; //связь id (_x0000_s1025) с xml для OfficeDrawing
std::vector<CString> m_aXml;
......
......@@ -606,26 +606,26 @@ namespace XmlUtils
return sResult;
}
//inline std::wstring GetText3()
//{
// if ( !IsValid() )
// return _T("");
inline std::wstring GetText3()
{
if ( !IsValid() )
return _T("");
// std::wstring sResult;
std::wstring sResult;
// if ( 0 != xmlTextReaderIsEmptyElement(reader) )
// return sResult;
if ( 0 != xmlTextReaderIsEmptyElement(reader) )
return sResult;
// int nDepth = GetDepth();
// XmlNodeType eNodeType = XmlNodeType_EndElement;
// while ( Read( eNodeType ) && GetDepth() >= nDepth && XmlNodeType_EndElement != eNodeType )
// {
// if ( eNodeType == XmlNodeType_Text || eNodeType == XmlNodeType_Whitespace || eNodeType == XmlNodeType_SIGNIFICANT_WHITESPACE )
// sResult += GetText();
// }
int nDepth = GetDepth();
XmlNodeType eNodeType = XmlNodeType_EndElement;
while ( Read( eNodeType ) && GetDepth() >= nDepth && XmlNodeType_EndElement != eNodeType )
{
if ( eNodeType == XmlNodeType_Text || eNodeType == XmlNodeType_Whitespace || eNodeType == XmlNodeType_SIGNIFICANT_WHITESPACE )
sResult += GetText();
}
// return sResult;
//}
return sResult;
}
inline CString GetOuterXml()
{
return GetXml(false);
......
......@@ -55,7 +55,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -90,7 +90,7 @@ namespace OOX
nullable<SimpleTypes::COnOff<>> m_oArray;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oSheetId;
nullable<SimpleTypes::COnOff<>> m_oDependencyLevel;
nullable<CString> m_oRef;
nullable<std::wstring> m_oRef;
nullable<SimpleTypes::COnOff<>> m_oChildChain;
nullable<SimpleTypes::COnOff<>> m_oNewThread;
};
......
......@@ -85,14 +85,15 @@ namespace OOX
}
virtual void write2(CString& sFilename) const
{
XmlUtils::CStringWriter sXml;
NSStringUtils::CStringBuilder sXml;
sXml.WriteString(L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n");
toXML(sXml);
CDirectory::SaveToFile( sFilename, _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n") + sXml.GetData() );
NSFile::CFileBinary::SaveToFile(sFilename.GetBuffer(), sXml.GetData());
sFilename.ReleaseBuffer();
}
void toXML(XmlUtils::CStringWriter& writer) const
void toXML(NSStringUtils::CStringBuilder& writer) const
{
CString sNodeName = _T("c:chartSpace");
m_oChartSpace.toXML (sNodeName, writer);
m_oChartSpace.toXML(_T("c:chartSpace"), writer);
}
bool isValid() const
{
......
......@@ -59,7 +59,7 @@ namespace OOX
nullable<double> m_dTopMM;
nullable<double> m_dWidthMM;
nullable<double> m_dHeightMM;
nullable<CString> m_sAuthor;
nullable<std::wstring> m_sAuthor;
nullable<unsigned int> m_nRow;
nullable<unsigned int> m_nCol;
nullable<bool> m_bMove;
......@@ -74,7 +74,7 @@ namespace OOX
return m_nRow.IsInit() && m_nCol.IsInit() && m_sAuthor.IsInit();
}
};
class CAuthors : public WritingElementWithChilds<CString>
class CAuthors : public WritingElementWithChilds<std::wstring>
{
public:
WritingElementSpreadsheet_AdditionConstructors(CAuthors)
......@@ -90,18 +90,16 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(CString("<authors>"));
writer.WriteString(L"<authors>");
for(unsigned int i = 0, length = m_arrItems.size(); i < length; ++i)
{
CString sAuthor;
sAuthor.Append(_T("<author>"));
sAuthor.Append(XmlUtils::EncodeXmlString(*m_arrItems[i]));
sAuthor.Append(_T("</author>"));
writer.WriteString(sAuthor);
writer.WriteString(L"<author>");
writer.WriteEncodeXmlString(*m_arrItems[i]);
writer.WriteString(L"</author>");
}
writer.WriteString(CString("</authors>"));
writer.WriteString(L"</authors>");
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
......@@ -116,7 +114,7 @@ namespace OOX
CString sName = XmlUtils::GetNameNoNS(oReader.GetName());
if ( _T("author") == sName )
m_arrItems.push_back(new CString(oReader.GetText2()));
m_arrItems.push_back(new std::wstring(oReader.GetText3()));
}
}
......@@ -146,27 +144,19 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
if(m_oRef.IsInit() && m_oAuthorId.IsInit() && m_oText.IsInit())
{
writer.WriteString(CString("<comment"));
if(m_oRef.IsInit())
{
CString sRef;sRef.Format(_T(" ref=\"%ls\""), XmlUtils::EncodeXmlString(m_oRef->GetValue()));
writer.WriteString(sRef);
}
if(m_oAuthorId.IsInit())
{
CString sAuthorId;sAuthorId.Format(_T(" authorId=\"%d\""), m_oAuthorId->GetValue());
writer.WriteString(sAuthorId);
}
writer.WriteString(CString(">"));
writer.WriteString(L"<comment");
WritingStringNullableAttrEncodeXmlString(L"ref", m_oRef, m_oRef->ToString2());
WritingStringNullableAttrInt(L"authorId", m_oAuthorId, m_oAuthorId->GetValue());
writer.WriteString(L">");
writer.WriteString(CString("<text>"));
writer.WriteString(L"<text>");
m_oText->toXML2(writer);
writer.WriteString(CString("</text>"));
writer.WriteString(CString("</comment>"));
writer.WriteString(L"</text>");
writer.WriteString(L"</comment>");
}
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -224,14 +214,14 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(CString("<commentList>"));
writer.WriteString(L"<commentList>");
for(unsigned int i = 0, length = m_arrItems.size(); i < length; ++i)
{
m_arrItems[i]->toXML(writer);
}
writer.WriteString(CString("</commentList>"));
writer.WriteString(L"</commentList>");
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
......@@ -316,7 +306,7 @@ namespace OOX
}
virtual void write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const
{
XmlUtils::CStringWriter sXml;
NSStringUtils::CStringBuilder sXml;
sXml.WriteString(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><comments xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">"));
if(m_oAuthors.IsInit())
m_oAuthors->toXML(sXml);
......@@ -324,7 +314,9 @@ namespace OOX
m_oCommentList->toXML(sXml);
sXml.WriteString(_T("</comments>"));
CDirectory::SaveToFile( oPath.GetPath(), sXml.GetData() );
CString sPath = oPath.GetPath();
NSFile::CFileBinary::SaveToFile(sPath.GetBuffer(), sXml.GetData());
sPath.ReleaseBuffer();
oContent.Registration( type().OverrideType(), oDirectory, oPath.GetFilename() );
IFileContainer::Write(oPath, oDirectory, oContent);
}
......@@ -370,12 +362,13 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
if(m_oId.IsInit())
{
CString sVal = _T("<legacyDrawing r:id=\"") + m_oId->GetValue() + _T("\"/>");
writer.WriteString(sVal);
writer.WriteString(L"<legacyDrawing r:id=\"");
writer.WriteString(m_oId->ToString2());
writer.WriteString(L"\"/>");
}
}
......
......@@ -38,6 +38,16 @@ namespace ComplexTypes
{
namespace Spreadsheet
{
class ComplexType
{
public:
ComplexType(){};
virtual ~ComplexType() {};
virtual void FromXML(XmlUtils::CXmlNode& oNode) = 0;
virtual std::wstring ToString() const = 0;
};
template<SimpleTypes::EOnOff eDefValue = SimpleTypes::onoffTrue>
class COnOff2 : public ComplexType
{
......@@ -61,9 +71,9 @@ namespace ComplexTypes
WritingElement_ReadAttributes_ReadSingle( oReader, _T("val"), m_oVal )
WritingElement_ReadAttributes_End( oReader )
}
virtual CString ToString() const
virtual std::wstring ToString() const
{
CString sResult;
std::wstring sResult;
sResult += _T("val=\"");
sResult += m_oVal.ToString();
......@@ -104,9 +114,9 @@ namespace ComplexTypes
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual CString ToString() const
virtual std::wstring ToString() const
{
CString sResult;
std::wstring sResult;
if ( m_oVal.IsInit() )
{
......@@ -152,22 +162,22 @@ namespace ComplexTypes
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual CString ToString() const
virtual std::wstring ToString() const
{
CString sResult;
std::wstring sResult;
if ( m_sVal.IsInit() )
{
sResult += _T("val=\"");
sResult += m_sVal->GetString();
sResult += m_sVal.get();
sResult += _T("\" ");
}
return sResult;
}
CString ToString2() const
std::wstring ToString2() const
{
CString sResult;
std::wstring sResult;
if ( m_sVal.IsInit() )
sResult += m_sVal.get();
......@@ -186,7 +196,7 @@ namespace ComplexTypes
public:
nullable<CString> m_sVal;
nullable<std::wstring> m_sVal;
};
class CDouble : public ComplexType
{
......@@ -210,9 +220,9 @@ namespace ComplexTypes
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual CString ToString() const
virtual std::wstring ToString() const
{
CString sResult;
std::wstring sResult;
if ( m_oVal.IsInit() )
{
......@@ -259,9 +269,9 @@ namespace ComplexTypes
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual CString ToString() const
virtual std::wstring ToString() const
{
CString sResult;
std::wstring sResult;
if ( m_oVal.IsInit() )
{
......@@ -308,9 +318,9 @@ namespace ComplexTypes
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual CString ToString() const
virtual std::wstring ToString() const
{
CString sResult;
std::wstring sResult;
if ( m_oVal.IsInit() )
{
......@@ -357,9 +367,9 @@ namespace ComplexTypes
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual CString ToString() const
virtual std::wstring ToString() const
{
CString sResult;
std::wstring sResult;
if ( m_oVal.IsInit() )
{
......@@ -406,9 +416,9 @@ namespace ComplexTypes
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual CString ToString() const
virtual std::wstring ToString() const
{
CString sResult;
std::wstring sResult;
if ( m_oVal.IsInit() )
{
......@@ -455,9 +465,9 @@ namespace ComplexTypes
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual CString ToString() const
virtual std::wstring ToString() const
{
CString sResult;
std::wstring sResult;
if ( m_oVal.IsInit() )
{
......@@ -504,9 +514,9 @@ namespace ComplexTypes
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual CString ToString() const
virtual std::wstring ToString() const
{
CString sResult;
std::wstring sResult;
if ( m_oVal.IsInit() )
{
......@@ -553,9 +563,9 @@ namespace ComplexTypes
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual CString ToString() const
virtual std::wstring ToString() const
{
CString sResult;
std::wstring sResult;
if ( m_oVal.IsInit() )
{
......
......@@ -61,12 +61,12 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
if(isValid())
{
CString sStart;
CString sEnd;
std::wstring sStart;
std::wstring sEnd;
if(m_oFrom.IsInit() && m_oTo.IsInit())
{
sStart = _T("<xdr:twoCellAnchor editAs=\"") + m_oAnchorType.ToString() + _T("\">");
......@@ -80,7 +80,7 @@ namespace OOX
}
else if(m_oFrom.IsInit() && m_oExt.IsInit())
{
sStart.Append(_T("<xdr:oneCellAnchor>"));
sStart.append(_T("<xdr:oneCellAnchor>"));
sEnd = _T("</xdr:oneCellAnchor>");
writer.WriteString(sStart);
if(m_oFrom.IsInit())
......@@ -90,7 +90,7 @@ namespace OOX
}
else if(m_oPos.IsInit() && m_oExt.IsInit())
{
sStart.Append(_T("<xdr:absoluteAnchor>"));
sStart.append(_T("<xdr:absoluteAnchor>"));
sEnd = _T("</xdr:absoluteAnchor>");
writer.WriteString(sStart);
if(m_oPos.IsInit())
......@@ -161,7 +161,7 @@ namespace OOX
xmlString += L"xmlns:xdr=\"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing\" ";
xmlString += L"xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" ";
xmlString += L">";
xmlString += *m_oXml;
xmlString += m_oXml->c_str();
xmlString += L"</root>";
bool result =oShapeReader.FromString(xmlString);
......@@ -186,7 +186,7 @@ namespace OOX
{
//собственно это и есть ссылка на обеъект -> переложим ее "повыше" (для удобства)
m_oXml.reset();
m_sSpId = pExt->m_oCompatExt->m_sSpId;
m_sSpId = string2std_string(pExt->m_oCompatExt->m_sSpId.get());
}
}
}
......@@ -291,10 +291,10 @@ namespace OOX
nullable<OOX::Spreadsheet::CConnShape> m_oConnShape;
// для pptx:ObjectDrawingConverter
nullable<CString> m_oXml;
nullable<std::wstring> m_oXml;
//для удобства
nullable<CString> m_sSpId;
nullable<std::wstring> m_sSpId;
};
} //Spreadsheet
} // namespace OOX
......
......@@ -60,12 +60,13 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
if(m_oId.IsInit())
{
CString sVal = _T("<drawing r:id=\"") + m_oId->GetValue() + _T("\"/>");
writer.WriteString(sVal);
writer.WriteString(L"<drawing r:id=\"");
writer.WriteString(m_oId->ToString2());
writer.WriteString(L"\"/>");
}
}
......@@ -207,13 +208,15 @@ namespace OOX
}
virtual void write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const
{
XmlUtils::CStringWriter sXml;
NSStringUtils::CStringBuilder sXml;
sXml.WriteString(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><xdr:wsDr xmlns:xdr=\"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\">"));
for(unsigned int i = 0, length = m_arrItems.size(); i < length; ++i)
m_arrItems[i]->toXML(sXml);
sXml.WriteString(_T("</xdr:wsDr>"));
CDirectory::SaveToFile( oPath.GetPath(), sXml.GetData() );
CString sPath = oPath.GetPath();
NSFile::CFileBinary::SaveToFile(sPath.GetBuffer(), sXml.GetData());
sPath.ReleaseBuffer();
oContent.Registration( type().OverrideType(), oDirectory, oPath.GetFilename() );
IFileContainer::Write(oPath, oDirectory, oContent);
}
......
......@@ -55,35 +55,33 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
}
virtual void toXML2(XmlUtils::CStringWriter& writer, CString sName) const
virtual void toXML2(NSStringUtils::CStringBuilder& writer, const std::wstring& sName) const
{
CString sStart = _T("<") + sName + _T(">");
writer.WriteString(sStart);
writer.WriteString(L"<");
writer.WriteString(sName);
writer.WriteString(L">");
if(m_oCol.IsInit())
{
CString sVal;sVal.Format(_T("<xdr:col>%d</xdr:col>"), m_oCol->GetValue());
writer.WriteString(sVal);
WritingStringValInt(L"xdr:col", m_oCol->GetValue());
}
if(m_oColOff.IsInit())
{
CString sVal;sVal.Format(_T("<xdr:colOff>%lld</xdr:colOff>"), m_oColOff->ToEmu());
writer.WriteString(sVal);
WritingStringValInt64(L"xdr:colOff", m_oColOff->ToEmu());
}
if(m_oRow.IsInit())
{
CString sVal;sVal.Format(_T("<xdr:row>%d</xdr:row>"), m_oRow->GetValue());
writer.WriteString(sVal);
WritingStringValInt(L"xdr:row", m_oRow->GetValue());
}
if(m_oRowOff.IsInit())
{
CString sVal;sVal.Format(_T("<xdr:rowOff>%lld</xdr:rowOff>"), m_oRowOff->ToEmu());
writer.WriteString(sVal);
WritingStringValInt64(L"xdr:rowOff", m_oRowOff->ToEmu());
}
CString sEnd = _T("</") + sName + _T(">");
writer.WriteString(sEnd);
writer.WriteString(L"</");
writer.WriteString(sName);
writer.WriteString(L">");
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
......@@ -139,19 +137,11 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<xdr:ext"));
if(m_oCx.IsInit())
{
CString sVal;sVal.Format(_T(" cx=\"%lld\""), m_oCx->ToEmu());
writer.WriteString(sVal);
}
if(m_oCy.IsInit())
{
CString sVal;sVal.Format(_T(" cy=\"%lld\""), m_oCy->ToEmu());
writer.WriteString(sVal);
}
WritingStringNullableAttrInt64(L"cx", m_oCx, m_oCx->GetValue());
WritingStringNullableAttrInt64(L"cy", m_oCy, m_oCy->GetValue());
writer.WriteString(_T("/>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......
......@@ -58,7 +58,7 @@ namespace OOX
{
return _T("<xdr:cNvGraphicFramePr/>");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<xdr:cNvGraphicFramePr/>"));
}
......@@ -120,11 +120,16 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<xdr:nvGraphicFramePr>"));
if (m_oCNvPr.IsInit()) m_oCNvPr->toXML(writer);
if (m_oCNvPr.IsInit())
{
CString sCNvPr = m_oCNvPr->toXML();
writer.WriteString(sCNvPr.GetBuffer());
sCNvPr.ReleaseBuffer();
}
else writer.WriteString(_T("<xdr:cNvPr id=\"1\" name=\"diagram\"/>"));
if (m_oCNvGraphicFramePr.IsInit()) m_oCNvGraphicFramePr->toXML(writer);
......@@ -184,7 +189,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -233,7 +238,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -276,7 +281,7 @@ namespace OOX
}
public:
nullable<CGraphicChart> m_oChart;
nullable<CString> m_sSpId;
nullable<std::wstring> m_sSpId;
//Any element in any namespace
};
......@@ -299,7 +304,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -351,7 +356,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
if(m_oChartGraphic.IsInit() && m_oChartGraphic->m_oGraphicData.IsInit() && m_oChartGraphic->m_oGraphicData->m_oChart.IsInit() && m_oChartGraphic->m_oGraphicData->m_oChart->m_oRId.IsInit())
{
......@@ -368,7 +373,7 @@ namespace OOX
writer.WriteString(_T("<a:graphic><a:graphicData uri=\"http://schemas.openxmlformats.org/drawingml/2006/chart\">"));
writer.WriteString(_T("<c:chart xmlns:c=\"http://schemas.openxmlformats.org/drawingml/2006/chart\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" "));
writer.WriteString(_T("r:id=\""));
writer.WriteString(m_oChartGraphic->m_oGraphicData->m_oChart->m_oRId->ToString());
writer.WriteString(m_oChartGraphic->m_oGraphicData->m_oChart->m_oRId->ToString2());
writer.WriteString(_T("\"/>"));
writer.WriteString(_T("</a:graphicData>"));
writer.WriteString(_T("</a:graphic>"));
......
......@@ -58,7 +58,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -121,7 +121,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -177,7 +177,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -246,14 +246,13 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
if(m_oBlipFill.IsInit() && m_oBlipFill->m_oBlip.IsInit())
{
CString sRes = _T("<xdr:pic><xdr:nvPicPr><xdr:cNvPr id=\"1\" name=\"image\"/><xdr:cNvPicPr><a:picLocks noChangeAspect=\"1\"/></xdr:cNvPicPr></xdr:nvPicPr><xdr:blipFill><a:blip xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" r:embed=\"");
sRes += m_oBlipFill->m_oBlip->m_oEmbed.GetValue();
sRes += _T("\" cstate=\"print\"><a:extLst><a:ext uri=\"{28A0092B-C50C-407E-A947-70E740481C1C}\"><a14:useLocalDpi xmlns:a14=\"http://schemas.microsoft.com/office/drawing/2010/main\" val=\"0\"/></a:ext></a:extLst></a:blip><a:stretch><a:fillRect/></a:stretch></xdr:blipFill><xdr:spPr><a:prstGeom prst=\"rect\"><a:avLst/></a:prstGeom></xdr:spPr></xdr:pic><xdr:clientData/>");
writer.WriteString(sRes);
writer.WriteString(L"<xdr:pic><xdr:nvPicPr><xdr:cNvPr id=\"1\" name=\"image\"/><xdr:cNvPicPr><a:picLocks noChangeAspect=\"1\"/></xdr:cNvPicPr></xdr:nvPicPr><xdr:blipFill><a:blip xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" r:embed=\"");
writer.WriteString(m_oBlipFill->m_oBlip->m_oEmbed.ToString2());
writer.WriteString(L"\" cstate=\"print\"><a:extLst><a:ext uri=\"{28A0092B-C50C-407E-A947-70E740481C1C}\"><a14:useLocalDpi xmlns:a14=\"http://schemas.microsoft.com/office/drawing/2010/main\" val=\"0\"/></a:ext></a:extLst></a:blip><a:stretch><a:fillRect/></a:stretch></xdr:blipFill><xdr:spPr><a:prstGeom prst=\"rect\"><a:avLst/></a:prstGeom></xdr:spPr></xdr:pic><xdr:clientData/>");
}
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......
......@@ -57,19 +57,11 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<xdr:pos"));
if(m_oX.IsInit())
{
CString sVal;sVal.Format(_T(" x=\"%lld\""), m_oX->ToEmu());
writer.WriteString(sVal);
}
if(m_oY.IsInit())
{
CString sVal;sVal.Format(_T(" y=\"%lld\""), m_oY->ToEmu());
writer.WriteString(sVal);
}
WritingStringNullableAttrInt64(L"x", m_oX, m_oX->GetValue());
WritingStringNullableAttrInt64(L"y", m_oY, m_oY->GetValue());
writer.WriteString(_T("/>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......
......@@ -58,7 +58,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -116,7 +116,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -177,7 +177,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -237,7 +237,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -295,7 +295,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -356,7 +356,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -418,7 +418,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -476,7 +476,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -532,7 +532,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -591,7 +591,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......
......@@ -69,25 +69,22 @@ namespace OOX
CString sName = oReader.GetName();
}
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
CString str = toXML();
writer.WriteString(str);
writer.WriteString(L"<externalBook");
if (m_oRid.IsInit())
{
writer.WriteString(L" r:id=\"");
writer.WriteString(m_oRid->ToString2());
writer.WriteString(L"\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"");
}
writer.WriteString(L"/>");
}
virtual CString toXML() const
{
CString sResult = _T("<externalBook");
if(m_oRid.IsInit())
{
CString sVal = _T(" r:id=\"") + m_oRid->GetValue() + _T("\"");
sResult += sVal;
sResult += _T(" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" ");
}
sResult += _T("/>");
return sResult;
NSStringUtils::CStringBuilder writer;
toXML(writer);
return writer.GetData().c_str();
}
virtual EElementType getType() const
{
......@@ -161,7 +158,7 @@ namespace OOX
}
virtual void write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const
{
XmlUtils::CStringWriter sXml;
NSStringUtils::CStringBuilder sXml;
sXml.WriteString(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"));
sXml.WriteString(_T("<externalLink xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">"));
......@@ -172,7 +169,9 @@ namespace OOX
sXml.WriteString(_T("</externalLink>"));
CDirectory::SaveToFile( oPath.GetPath(), sXml.GetData() );
CString sPath = oPath.GetPath();
NSFile::CFileBinary::SaveToFile(sPath.GetBuffer(), sXml.GetData());
sPath.ReleaseBuffer();
oContent.Registration( type().OverrideType(), oDirectory, oPath.GetFilename() );
IFileContainer::Write(oPath, oDirectory, oContent);
}
......
......@@ -55,59 +55,23 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
CString sRoot;
writer.WriteString(CString(_T("<oleObject")));
if(m_oProgId.IsInit())
{
writer.WriteString(L" progId=\"");
writer.WriteEncodeXmlString(m_oProgId.get());
writer.WriteString(L"\"");
}
if(m_oDvAspect.IsInit())
{
writer.WriteString(L" dvAspect=\"");
writer.WriteString(m_oDvAspect->ToString());
writer.WriteString(L"\"");
}
if(m_oLink.IsInit())
{
writer.WriteString(L" link=\"");
writer.WriteEncodeXmlString(m_oLink.get());
writer.WriteString(L"\"");
}
if(m_oOleUpdate.IsInit())
{
writer.WriteString(L" oleUpdate=\"");
writer.WriteString(m_oOleUpdate->ToString());
writer.WriteString(L"\"");
}
if(m_oAutoLoad.IsInit())
{
writer.WriteString(L" autoLoad=\"");
writer.WriteString(m_oAutoLoad->ToString2(SimpleTypes::onofftostring1));
writer.WriteString(L"\"");
}
if(m_oShapeId.IsInit())
{
writer.WriteString(L" shapeId=\"");
writer.WriteString(m_oShapeId->ToString());
writer.WriteString(L"\"");
}
if(m_oRid.IsInit())
{
writer.WriteString(L" r:id=\"");
writer.WriteString(m_oRid->GetValue());
writer.WriteString(L"\"");
}
writer.WriteString(CString(_T("/>")));
}
void toXMLPptx(XmlUtils::CStringWriter& writer, CString qqq) const
writer.WriteString(L"<oleObject");
WritingStringNullableAttrEncodeXmlString(L"progId", m_oProgId, m_oProgId.get());
WritingStringNullableAttrString(L"dvAspect", m_oDvAspect, m_oDvAspect->ToString());
WritingStringNullableAttrEncodeXmlString(L"link", m_oLink, m_oLink.get());
WritingStringNullableAttrString(L"oleUpdate", m_oOleUpdate, m_oOleUpdate->ToString());
WritingStringNullableAttrBool(L"autoLoad", m_oAutoLoad);
WritingStringNullableAttrInt(L"shapeId", m_oShapeId, m_oShapeId->GetValue());
WritingStringNullableAttrString(L"r:id", m_oRid, m_oRid->ToString2());
writer.WriteString(L"/>");
}
void toXMLPptx(NSStringUtils::CStringBuilder& writer, CString qqq) const
{
CString sRoot;
writer.WriteString(CString(_T("<o:OLEObject")));
writer.WriteString(L"<o:OLEObject");
if(m_oDvAspect.IsInit())
{
writer.WriteString(L" DrawAspect=\"");
......@@ -117,24 +81,9 @@ namespace OOX
writer.WriteString(L"Icon");
writer.WriteString(L"\"");
}
if(m_oRid.IsInit())
{
writer.WriteString(L" r:id=\"");
writer.WriteString(m_oRid->GetValue());
writer.WriteString(L"\"");
}
if(m_oProgId.IsInit())
{
writer.WriteString(L" ProgID=\"");
writer.WriteEncodeXmlString(m_oProgId.get());
writer.WriteString(L"\"");
}
if(m_oShapeId.IsInit())
{
writer.WriteString(L" ShapeID=\"");
writer.WriteString(m_oShapeId->ToString());
writer.WriteString(L"\"");
}
WritingStringNullableAttrString(L"r:id", m_oRid, m_oRid->ToString2());
WritingStringNullableAttrEncodeXmlString(L"ProgID", m_oProgId, m_oProgId.get());
WritingStringNullableAttrInt(L"ShapeID", m_oShapeId, m_oShapeId->GetValue());
writer.WriteString(L" Type=\"Embed\"");
if(m_oOleUpdate.IsInit())
{
......@@ -145,28 +94,11 @@ namespace OOX
writer.WriteString(L"OnCall");
writer.WriteString(L"\"");
}
if(m_oFilepathBin.IsInit())
{
writer.WriteString(L" pathbin=\"");
writer.WriteEncodeXmlString(m_oFilepathBin.get());
writer.WriteString(L"\"");
}
if(m_oFilepathImg.IsInit())
{
writer.WriteString(L" pathimg=\"");
writer.WriteEncodeXmlString(m_oFilepathImg.get());
writer.WriteString(L"\"");
}
if(m_oRidImg.IsInit())
{
writer.WriteString(L" idimg=\"");
writer.WriteString(m_oRidImg->GetValue());
writer.WriteString(L"\"");
}
WritingStringNullableAttrEncodeXmlString(L"pathbin", m_oFilepathBin, m_oFilepathBin.get());
WritingStringNullableAttrEncodeXmlString(L"pathimg", m_oFilepathImg, m_oFilepathImg.get());
WritingStringNullableAttrString(L"idimg", m_oRidImg, m_oRidImg->ToString2());
writer.WriteString(CString(_T("/>")));
writer.WriteString(L"/>");
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
......@@ -204,16 +136,16 @@ namespace OOX
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<CString > m_oProgId;
nullable<std::wstring > m_oProgId;
nullable<SimpleTypes::Spreadsheet::ST_DvAspect<> > m_oDvAspect;
nullable<CString > m_oLink;
nullable<std::wstring > m_oLink;
nullable<SimpleTypes::Spreadsheet::ST_OleUpdate<> > m_oOleUpdate;
nullable<SimpleTypes::COnOff<> > m_oAutoLoad;
nullable<SimpleTypes::CUnsignedDecimalNumber<> > m_oShapeId;
nullable<SimpleTypes::CRelationshipId > m_oRid;
//internal
nullable<CString > m_oFilepathBin;
nullable<CString > m_oFilepathImg;
nullable<std::wstring > m_oFilepathBin;
nullable<std::wstring > m_oFilepathImg;
nullable<SimpleTypes::CRelationshipId > m_oRidImg;
};
......@@ -238,7 +170,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
if(m_mapOleObjects.size() > 0)
{
......@@ -247,7 +179,7 @@ namespace OOX
{
it->second->toXML(writer);
}
writer.WriteString(CString(_T("</oleObjects>")));
writer.WriteString(L"</oleObjects>");
}
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......
......@@ -58,7 +58,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -107,7 +107,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......
......@@ -59,7 +59,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<r>"));
if(m_oRPr.IsInit())
......
......@@ -102,26 +102,19 @@ namespace OOX
}
virtual void write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const
{
XmlUtils::CStringWriter sXml;
sXml.WriteString(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><sst xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\""));
if(m_oCount.IsInit())
{
CString sVal;sVal.Format(_T(" count=\"%d\""), m_oCount->GetValue());
sXml.WriteString(sVal);
}
if(m_oUniqueCount.IsInit())
{
CString sVal;sVal.Format(_T(" uniqueCount=\"%d\""), m_oUniqueCount->GetValue());
sXml.WriteString(sVal);
}
sXml.WriteString(_T(">"));
NSStringUtils::CStringBuilder writer;
writer.WriteString(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><sst xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\""));
WritingStringNullableAttrInt(L"count", m_oCount, m_oCount->GetValue());
WritingStringNullableAttrInt(L"uniqueCount", m_oUniqueCount, m_oUniqueCount->GetValue());
writer.WriteString(_T(">"));
for(unsigned int i = 0, length = m_arrItems.size(); i < length; ++i)
m_arrItems[i]->toXML(sXml);
sXml.WriteString(_T("</sst>"));
m_arrItems[i]->toXML(writer);
CDirectory::SaveToFile( oPath.GetPath(), sXml.GetData() );
writer.WriteString(_T("</sst>"));
CString sPath = oPath.GetPath();
NSFile::CFileBinary::SaveToFile(sPath.GetBuffer(), writer.GetData());
sPath.ReleaseBuffer();
oContent.Registration( type().OverrideType(), oDirectory, oPath.GetFilename() );
}
virtual const OOX::FileType type() const
......
......@@ -60,21 +60,21 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<si>"));
for(unsigned int i = 0, length = m_arrItems.size(); i < length; ++i)
m_arrItems[i]->toXML(writer);
writer.WriteString(_T("</si>"));
}
virtual void toXML2(XmlUtils::CStringWriter& writer) const
virtual void toXML2(NSStringUtils::CStringBuilder& writer) const
{
for(unsigned int i = 0, length = m_arrItems.size(); i < length; ++i)
m_arrItems[i]->toXML(writer);
}
CString ToString()
std::wstring ToString()
{
CString sRes;
std::wstring sRes;
for(unsigned int i = 0, length = m_arrItems.size(); i < length; ++i)
{
WritingElement* we = m_arrItems[i];
......@@ -84,13 +84,13 @@ namespace OOX
for(unsigned int j = 0, length2 = pRun->m_arrItems.size(); j < length2; ++j)
{
CText* pText = pRun->m_arrItems[j];
sRes.Append(pText->ToString());
sRes.append(pText->ToString());
}
}
else if(OOX::Spreadsheet::et_t == we->getType())
{
CText* pText = static_cast<CText*>(we);
sRes.Append(pText->ToString());
sRes.append(pText->ToString());
}
}
return sRes;
......
......@@ -34,7 +34,7 @@
#define OOX_TEXT_FILE_INCLUDE_H_
#include "../CommonInclude.h"
#include "../../../.././DesktopEditor/common/String.h"
namespace OOX
{
......@@ -53,23 +53,23 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<t"));
if(-1 != m_sText.Find(' ') || -1 != m_sText.Find('\n'))
if(std::wstring::npos != m_sText.find(' ') || std::wstring::npos != m_sText.find('\n'))
writer.WriteString(_T(" xml:space=\"preserve\""));
writer.WriteString(_T(">"));
writer.WriteString(XmlUtils::EncodeXmlString(m_sText));
writer.WriteEncodeXmlString(m_sText);
writer.WriteString(_T("</t>"));
}
virtual void toXML2(XmlUtils::CStringWriter& writer, CString name) const
virtual void toXML2(NSStringUtils::CStringBuilder& writer, const wchar_t* name) const
{
writer.WriteString(_T("<"));
writer.WriteString(name);
if(-1 != m_sText.Find(' ') || -1 != m_sText.Find('\n'))
if(std::wstring::npos != m_sText.find(' ') || std::wstring::npos != m_sText.find('\n'))
writer.WriteString(_T(" xml:space=\"preserve\""));
writer.WriteString(_T(">"));
writer.WriteString(XmlUtils::EncodeXmlString(m_sText));
writer.WriteEncodeXmlString(m_sText);
writer.WriteString(_T("</"));
writer.WriteString(name);
writer.WriteString(_T(">"));
......@@ -81,12 +81,12 @@ namespace OOX
if ( oReader.IsEmptyNode() )
return;
m_sText = oReader.GetText2();
m_sText.Replace(_T("\t"), _T(""));
m_sText = oReader.GetText3();
NSStringExt::Replace(m_sText, L"\t", L"");
if(!(m_oSpace.IsInit() && SimpleTypes::xmlspacePreserve == m_oSpace->GetValue()))
{
//убираем пробелы и переносы строк в начале и в конце
int nLength = m_sText.GetLength();
//trim ' ', '\r', '\n'
int nLength = m_sText.length();
int nStartIndex = 0;
int nEndIndex = nLength - 1;
for(int i = nStartIndex; i < nLength; ++i)
......@@ -107,14 +107,14 @@ namespace OOX
}
if(0 != nStartIndex || nLength - 1 != nEndIndex)
{
if(nStartIndex <= nEndIndex)
m_sText = m_sText.Mid(nStartIndex, nEndIndex - nStartIndex + 1);
if (nStartIndex <= nEndIndex)
m_sText = m_sText.substr(nStartIndex, nEndIndex - nStartIndex + 1);
else
m_sText.Empty();
m_sText.clear();
}
}
}
CString ToString() const
std::wstring ToString() const
{
return m_sText;
}
......@@ -156,7 +156,7 @@ namespace OOX
nullable<SimpleTypes::CXmlSpace<> > m_oSpace;
// Value
CString m_sText;
std::wstring m_sText;
};
} //Spreadsheet
......
......@@ -79,7 +79,7 @@ namespace OOX
public:
nullable<SimpleTypes::COnOff<>> m_oAuto;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oIndexed;
nullable<CString> m_oRgb;
nullable<std::wstring> m_oRgb;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oTheme;
nullable<SimpleTypes::CDouble> m_oTint;
};
......
......@@ -57,18 +57,14 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
}
void toXML2(XmlUtils::CStringWriter& writer, CString sName) const
void toXML2(NSStringUtils::CStringBuilder& writer, const std::wstring& sName) const
{
writer.WriteString(_T("<"));
writer.WriteString(sName);
if(m_oStyle.IsInit())
{
CString sVal;sVal.Format(_T(" style=\"%ls\""), m_oStyle->ToString());
writer.WriteString(sVal);
}
WritingStringNullableAttrString(L"style", m_oStyle, m_oStyle->ToString());
writer.WriteString(_T(">"));
if(m_oColor.IsInit())
m_oColor->toXML2(writer, _T("color"));
......@@ -133,18 +129,16 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<border"));
if(m_oDiagonalDown.IsInit() && SimpleTypes::onoffTrue == m_oDiagonalDown->GetValue())
if (m_oDiagonalDown.IsInit() && SimpleTypes::onoffTrue == m_oDiagonalDown->GetValue())
{
CString sVal;sVal.Format(_T(" diagonalDown=\"%ls\""), m_oDiagonalDown->ToString2( SimpleTypes::onofftostring1));
writer.WriteString(sVal);
WritingStringAttrString(L"diagonalDown", m_oDiagonalDown->ToString3(SimpleTypes::onofftostring1));
}
if(m_oDiagonalUp.IsInit() && SimpleTypes::onoffTrue == m_oDiagonalUp->GetValue())
if (m_oDiagonalUp.IsInit() && SimpleTypes::onoffTrue == m_oDiagonalUp->GetValue())
{
CString sVal;sVal.Format(_T(" diagonalUp=\"%ls\""), m_oDiagonalUp->ToString2( SimpleTypes::onofftostring1));
writer.WriteString(sVal);
WritingStringAttrString(L"diagonalUp", m_oDiagonalUp->ToString3(SimpleTypes::onofftostring1));
}
writer.WriteString(_T(">"));
if(m_oStart.IsInit() && false == m_oStart->IsEmpty())
......@@ -249,14 +243,10 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<borders"));
if(m_oCount.IsInit())
{
CString sVal;sVal.Format(_T(" count=\"%d\""), m_oCount->GetValue());
writer.WriteString(sVal);
}
WritingStringNullableAttrInt(L"count", m_oCount, m_oCount->GetValue());
writer.WriteString(_T(">"));
for(unsigned int i = 0, length = m_arrItems.size(); i < length; ++i)
m_arrItems[i]->toXML(writer);
......
......@@ -57,29 +57,12 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<cellStyle"));
if(m_oName.IsInit())
{
//CString sVal;sVal.Format(_T(" name=\"%ls\""), XmlUtils::EncodeXmlString(m_oName.get()));
CString sVal(_T(" name=\""));
sVal += XmlUtils::EncodeXmlString(m_oName.get());
sVal += CString(_T("\""));
writer.WriteString(sVal);
}
if(m_oXfId.IsInit())
{
CString sVal;sVal.Format(_T(" xfId=\"%d\""), m_oXfId->GetValue());
writer.WriteString(sVal);
}
if(m_oBuiltinId.IsInit())
{
CString sVal;sVal.Format(_T(" builtinId=\"%d\""), m_oBuiltinId->GetValue());
writer.WriteString(sVal);
}
WritingStringNullableAttrEncodeXmlString(L"name", m_oName, m_oName.get());
WritingStringNullableAttrInt(L"xfId", m_oXfId, m_oXfId->GetValue());
WritingStringNullableAttrInt(L"builtinId", m_oBuiltinId, m_oBuiltinId->GetValue());
writer.WriteString(_T("/>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -115,7 +98,7 @@ namespace OOX
nullable<SimpleTypes::COnOff<>> m_oCustomBuiltin;
nullable<SimpleTypes::COnOff<>> m_oHidden;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oILevel;
nullable<CString> m_oName;
nullable<std::wstring> m_oName;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oXfId;
};
......@@ -135,14 +118,10 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<cellStyles"));
if(m_oCount.IsInit())
{
CString sVal;sVal.Format(_T(" count=\"%d\""), m_oCount->GetValue());
writer.WriteString(sVal);
}
WritingStringNullableAttrInt(L"count", m_oCount, m_oCount->GetValue());
writer.WriteString(_T(">"));
for(unsigned int i = 0, length = m_arrItems.size(); i < length; ++i)
m_arrItems[i]->toXML(writer);
......
......@@ -57,7 +57,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......
......@@ -57,14 +57,10 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<patternFill"));
if(m_oPatternType.IsInit())
{
CString sVal;sVal.Format(_T(" patternType=\"%ls\""), m_oPatternType->ToString());
writer.WriteString(sVal);
}
WritingStringNullableAttrString(L"patternType", m_oPatternType, m_oPatternType->ToString());
if(m_oBgColor.IsInit() || m_oFgColor.IsInit())
{
writer.WriteString(_T(">"));
......@@ -144,7 +140,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -199,7 +195,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -263,7 +259,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<fill>"));
if(m_oPatternFill.IsInit())
......@@ -318,14 +314,10 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<fills"));
if(m_oCount.IsInit())
{
CString sVal;sVal.Format(_T(" count=\"%d\""), m_oCount->GetValue());
writer.WriteString(sVal);
}
WritingStringNullableAttrInt(L"count", m_oCount, m_oCount->GetValue());
writer.WriteString(_T(">"));
for(unsigned int i = 0, length = m_arrItems.size(); i < length; ++i)
m_arrItems[i]->toXML(writer);
......
......@@ -57,23 +57,20 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<font>"));
if(m_oRFont.IsInit() && m_oRFont->m_sVal.IsInit())
{
CString sVal;sVal.Format(_T("<name val=\"%ls\"/>"), XmlUtils::EncodeXmlString(m_oRFont->m_sVal.get()));
writer.WriteString(sVal);
WritingStringValAttrEncodeXmlString(L"name", m_oRFont->m_sVal.get());
}
if(m_oCharset.IsInit() && m_oCharset->m_oCharset.IsInit())
{
CString sVal;sVal.Format(_T("<charset val=\"%ls\"/>"), m_oCharset->m_oCharset->ToString());
writer.WriteString(sVal);
WritingStringValAttrString(L"charset", m_oCharset->m_oCharset->ToString());
}
if(m_oFamily.IsInit() && m_oFamily->m_oFontFamily.IsInit())
{
CString sVal;sVal.Format(_T("<family val=\"%ls\"/>"), m_oFamily->m_oFontFamily->ToString());
writer.WriteString(sVal);
WritingStringValAttrString(L"family", m_oFamily->m_oFontFamily->ToString());
}
if(m_oBold.IsInit())
{
......@@ -128,27 +125,31 @@ namespace OOX
m_oColor->toXML2(writer, _T("color"));
if(m_oSz.IsInit() && m_oSz->m_oVal.IsInit())
{
CString sVal;sVal.Format(_T("<sz val=\"%ls\"/>"), SpreadsheetCommon::WriteDouble(m_oSz->m_oVal->GetValue()));
writer.WriteString(sVal);
WritingStringValAttrDouble(L"sz", m_oSz->m_oVal->GetValue());
}
if(m_oUnderline.IsInit() && m_oUnderline->m_oUnderline.IsInit())
{
CString sVal;
if( SimpleTypes::underlineSingle != m_oUnderline->m_oUnderline->GetValue())
sVal.Format(_T("<u val=\"%ls\"/>"), m_oUnderline->m_oUnderline->ToString());
if (SimpleTypes::underlineSingle != m_oUnderline->m_oUnderline->GetValue())
{
WritingStringValAttrString(L"u", m_oUnderline->m_oUnderline->ToString());
}
else
sVal.Format(_T("<u/>"), m_oUnderline->m_oUnderline->ToString());
writer.WriteString(sVal);
{
writer.WriteString(L"<u/>");
}
}
if(m_oVertAlign.IsInit() && m_oVertAlign->m_oVerticalAlign.IsInit())
{
CString sVal;sVal.Format(_T("<vertAlign val=\"%ls\"/>"), m_oVertAlign->m_oVerticalAlign->ToString());
writer.WriteString(sVal);
writer.WriteString(L"<vertAlign val=\"");
CString sAlign = m_oVertAlign->m_oVerticalAlign->ToString();
writer.WriteString(sAlign.GetBuffer());
sAlign.ReleaseBuffer();
writer.WriteString(L"\"/>");
}
if(m_oScheme.IsInit() && m_oScheme->m_oFontScheme.IsInit())
{
CString sVal;sVal.Format(_T("<scheme val=\"%ls\"/>"), m_oScheme->m_oFontScheme->ToString());
writer.WriteString(sVal);
WritingStringValAttrString(L"scheme", m_oScheme->m_oFontScheme->ToString());
}
writer.WriteString(_T("</font>"));
}
......@@ -239,14 +240,10 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<fonts"));
if(m_oCount.IsInit())
{
CString sVal;sVal.Format(_T(" count=\"%d\""), m_oCount->GetValue());
writer.WriteString(sVal);
}
WritingStringNullableAttrInt(L"count", m_oCount, m_oCount->GetValue());
writer.WriteString(_T(">"));
for(unsigned int i = 0, length = m_arrItems.size(); i < length; ++i)
m_arrItems[i]->toXML(writer);
......
......@@ -57,34 +57,17 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
CString sHeader = _T("numFmt");
toXML2(writer, sHeader);
toXML2(writer, _T("numFmt"));
}
void toXML2(XmlUtils::CStringWriter& writer, CString& sHeader) const
void toXML2(NSStringUtils::CStringBuilder& writer, const wchar_t* sHeader) const
{
writer.WriteString(_T("<") + sHeader);
if(m_oNumFmtId.IsInit())
{
CString sVal;sVal.Format(_T(" numFmtId=\"%d\""), m_oNumFmtId->GetValue());
writer.WriteString(sVal);
}
if(m_oFormatCode.IsInit())
{
//CString sVal;sVal.Format(_T(" formatCode=\"%ls\""), XmlUtils::EncodeXmlString(m_oFormatCode.get()));
CString sVal(_T(" formatCode=\""));
sVal += XmlUtils::EncodeXmlString(m_oFormatCode.get());
sVal += CString(_T("\""));
writer.WriteString(sVal);
}
if(m_oSourceLinked.IsInit())
{
CString sVal = _T(" sourceLinked=\"") + m_oSourceLinked->ToString2(SimpleTypes::onofftostring1) + _T("\"");
writer.WriteString(sVal);
}
writer.WriteString(L"<");
writer.WriteString(sHeader);
WritingStringNullableAttrInt(L"numFmtId", m_oNumFmtId, m_oNumFmtId->GetValue());
WritingStringNullableAttrEncodeXmlString(L"formatCode", m_oFormatCode, m_oFormatCode.get());
WritingStringNullableAttrBool(L"sourceLinked", m_oSourceLinked);
writer.WriteString(_T("/>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -113,7 +96,7 @@ namespace OOX
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<CString > m_oFormatCode;
nullable<std::wstring > m_oFormatCode;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oNumFmtId;
nullable<SimpleTypes::COnOff<>> m_oSourceLinked;
};
......@@ -133,16 +116,12 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
if(m_arrItems.size() > 0 )
{
writer.WriteString(_T("<numFmts"));
if(m_oCount.IsInit())
{
CString sVal;sVal.Format(_T(" count=\"%d\""), m_oCount->GetValue());
writer.WriteString(sVal);
}
WritingStringNullableAttrInt(L"count", m_oCount, m_oCount->GetValue());
writer.WriteString(_T(">"));
for(unsigned int i = 0, length = m_arrItems.size(); i < length; ++i)
m_arrItems[i]->toXML(writer);
......
......@@ -125,7 +125,7 @@ namespace OOX
}
virtual void write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const
{
XmlUtils::CStringWriter sXml;
NSStringUtils::CStringBuilder sXml;
sXml.WriteString(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><styleSheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" mc:Ignorable=\"x14ac\" xmlns:x14ac=\"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac\">"));
if(m_oNumFmts.IsInit())
m_oNumFmts->toXML(sXml);
......@@ -149,7 +149,9 @@ namespace OOX
m_oTableStyles->toXML(sXml);
sXml.WriteString(_T("</styleSheet>"));
CDirectory::SaveToFile( oPath.GetPath(), sXml.GetData() );
CString sPath = oPath.GetPath();
NSFile::CFileBinary::SaveToFile(sPath.GetBuffer(), sXml.GetData());
sPath.ReleaseBuffer();
oContent.Registration( type().OverrideType(), oDirectory, oPath.GetFilename() );
}
void PrepareToWrite()
......@@ -167,7 +169,7 @@ namespace OOX
pFont->m_oColor->m_oThemeColor->SetValue(SimpleTypes::Spreadsheet::themecolorDark1);
pFont->m_oRFont.Init();
pFont->m_oRFont->m_sVal.Init();
pFont->m_oRFont->m_sVal->Append(L"Calibri");
pFont->m_oRFont->m_sVal->append(L"Calibri");
pFont->m_oFamily.Init();
pFont->m_oFamily->m_oFontFamily.Init();
pFont->m_oFamily->m_oFontFamily->SetValue(SimpleTypes::Spreadsheet::fontfamilySwiss);
......
......@@ -57,17 +57,15 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
if(m_oType.IsInit() && m_oDxfId.IsInit())
{
CString sXml = _T("<tableStyleElement type=\"") + m_oType->ToString() + _T("\"");
if(m_oSize.IsInit())
sXml.AppendFormat(_T(" size=\"%d\""), m_oSize->GetValue());
sXml.AppendFormat(_T(" dxfId=\"%d\"/>"), m_oDxfId->GetValue());
writer.WriteString(sXml);
writer.WriteString(L"<tableStyleElement");
WritingStringAttrString(L"type", m_oType->ToString());
WritingStringNullableAttrInt(L"size", m_oSize, m_oSize->GetValue());
WritingStringAttrInt(L"dxfId", m_oDxfId->GetValue());
writer.WriteString(L"/>");
}
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -116,29 +114,17 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
if(m_oName.IsInit() && m_arrItems.size() > 0)
{
writer.WriteString(_T("<tableStyle"));
if(m_oName.IsInit())
{
CString sName;
sName.Append(_T(" name=\""));
sName.Append(XmlUtils::EncodeXmlString(m_oName.get2()));
sName.Append(_T("\""));
writer.WriteString(sName);
}
WritingStringNullableAttrEncodeXmlString(L"name", m_oName, m_oName.get());
if((m_oPivot.IsInit() && true == m_oPivot->ToBool()) || (m_oTable.IsInit() && false == m_oTable->ToBool()))
writer.WriteString(_T(" table=\"0\""));
else
writer.WriteString(_T(" pivot=\"0\""));
if(m_oCount.IsInit())
{
CString sCount;
sCount.Format(_T(" count=\"%d\""), m_oCount->GetValue());
writer.WriteString(sCount);
}
WritingStringNullableAttrInt(L"count", m_oCount, m_oCount->GetValue());
writer.WriteString(_T(">"));
for(unsigned int i = 0, length = m_arrItems.size(); i < length; ++i)
m_arrItems[i]->toXML(writer);
......@@ -184,10 +170,10 @@ namespace OOX
}
public:
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCount;
nullable<CString> m_oName;
nullable<std::wstring> m_oName;
nullable<SimpleTypes::COnOff<>> m_oPivot;
nullable<SimpleTypes::COnOff<>> m_oTable;
nullable<CString> m_oDisplayName; // Используется только для дефалтовых стилей
nullable<std::wstring> m_oDisplayName; // Используется только для дефалтовых стилей
};
class CTableStyles : public WritingElementWithChilds<CTableStyle>
{
......@@ -205,30 +191,12 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<tableStyles"));
if(m_oCount.IsInit())
{
CString sVal;sVal.Format(_T(" count=\"%d\""), m_oCount->GetValue());
writer.WriteString(sVal);
}
if(m_oDefaultTableStyle.IsInit())
{
CString sVal;
sVal.Append(_T(" defaultTableStyle=\""));
sVal.Append(XmlUtils::EncodeXmlString(m_oDefaultTableStyle.get()));
sVal.Append(_T("\""));
writer.WriteString(sVal);
}
if(m_oDefaultPivotStyle.IsInit())
{
CString sVal;
sVal.Append(_T(" defaultPivotStyle=\""));
sVal.Append(XmlUtils::EncodeXmlString(m_oDefaultPivotStyle.get()));
sVal.Append(_T("\""));
writer.WriteString(sVal);
}
WritingStringNullableAttrInt(L"count", m_oCount, m_oCount->GetValue());
WritingStringNullableAttrEncodeXmlString(L"defaultTableStyle", m_oDefaultTableStyle, m_oDefaultTableStyle.get());
WritingStringNullableAttrEncodeXmlString(L"defaultPivotStyle", m_oDefaultPivotStyle, m_oDefaultPivotStyle.get());
if(m_arrItems.size() > 0)
{
writer.WriteString(_T(">"));
......@@ -275,8 +243,8 @@ namespace OOX
}
public:
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCount;
nullable<CString> m_oDefaultPivotStyle;
nullable<CString> m_oDefaultTableStyle;
nullable<std::wstring> m_oDefaultPivotStyle;
nullable<std::wstring> m_oDefaultTableStyle;
};
} //Spreadsheet
} // namespace OOX
......
......@@ -55,54 +55,18 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<alignment"));
if(m_oHorizontal.IsInit())
{
CString sVal;sVal.Format(_T(" horizontal=\"%ls\""), m_oHorizontal->ToString());
writer.WriteString(sVal);
}
if(m_oIndent.IsInit())
{
CString sVal;sVal.Format(_T(" indent=\"%d\""), m_oIndent->GetValue());
writer.WriteString(sVal);
}
if(m_oJustifyLastLine.IsInit())
{
CString sVal;sVal.Format(_T(" justifyLastLine=\"%ls\""), m_oJustifyLastLine->ToString2(SimpleTypes::onofftostring1));
writer.WriteString(sVal);
}
if(m_oReadingOrder.IsInit())
{
CString sVal;sVal.Format(_T(" readingOrder=\"%d\""), m_oReadingOrder->GetValue());
writer.WriteString(sVal);
}
if(m_oRelativeIndent.IsInit())
{
CString sVal;sVal.Format(_T(" relativeIndent=\"%d\""), m_oRelativeIndent->GetValue());
writer.WriteString(sVal);
}
if(m_oShrinkToFit.IsInit())
{
CString sVal;sVal.Format(_T(" shrinkToFit=\"%ls\""), m_oShrinkToFit->ToString2(SimpleTypes::onofftostring1));
writer.WriteString(sVal);
}
if(m_oTextRotation.IsInit())
{
CString sVal;sVal.Format(_T(" textRotation=\"%d\""), m_oTextRotation->GetValue());
writer.WriteString(sVal);
}
if(m_oVertical.IsInit())
{
CString sVal;sVal.Format(_T(" vertical=\"%ls\""), m_oVertical->ToString());
writer.WriteString(sVal);
}
if(m_oWrapText.IsInit())
{
CString sVal;sVal.Format(_T(" wrapText=\"%ls\""), m_oWrapText->ToString2(SimpleTypes::onofftostring1));
writer.WriteString(sVal);
}
WritingStringNullableAttrString(L"horizontal", m_oHorizontal, m_oHorizontal->ToString());
WritingStringNullableAttrInt(L"indent", m_oIndent, m_oIndent->GetValue());
WritingStringNullableAttrBool(L"justifyLastLine", m_oJustifyLastLine);
WritingStringNullableAttrInt(L"readingOrder", m_oReadingOrder, m_oReadingOrder->GetValue());
WritingStringNullableAttrInt(L"relativeIndent", m_oRelativeIndent, m_oRelativeIndent->GetValue());
WritingStringNullableAttrBool(L"shrinkToFit", m_oShrinkToFit);
WritingStringNullableAttrInt(L"textRotation", m_oTextRotation, m_oTextRotation->GetValue());
WritingStringNullableAttrString(L"vertical", m_oVertical, m_oVertical->ToString());
WritingStringNullableAttrBool(L"wrapText", m_oWrapText);
writer.WriteString(_T("/>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -167,7 +131,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -216,64 +180,20 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<xf"));
if(m_oFontId.IsInit())
{
CString sVal;sVal.Format(_T(" fontId=\"%d\""), m_oFontId->GetValue());
writer.WriteString(sVal);
}
if(m_oFillId.IsInit())
{
CString sVal;sVal.Format(_T(" fillId=\"%d\""), m_oFillId->GetValue());
writer.WriteString(sVal);
}
if(m_oBorderId.IsInit())
{
CString sVal;sVal.Format(_T(" borderId=\"%d\""), m_oBorderId->GetValue());
writer.WriteString(sVal);
}
if(m_oNumFmtId.IsInit())
{
CString sVal;sVal.Format(_T(" numFmtId=\"%d\""), m_oNumFmtId->GetValue());
writer.WriteString(sVal);
}
if(m_oXfId.IsInit())
{
CString sVal;sVal.Format(_T(" xfId=\"%d\""), m_oXfId->GetValue());
writer.WriteString(sVal);
}
if(m_oApplyNumberFormat.IsInit())
{
CString sVal;sVal.Format(_T(" applyNumberFormat=\"%ls\""), m_oApplyNumberFormat->ToString2(SimpleTypes::onofftostring1));
writer.WriteString(sVal);
}
if(m_oApplyFont.IsInit())
{
CString sVal;sVal.Format(_T(" applyFont=\"%ls\""), m_oApplyFont->ToString2(SimpleTypes::onofftostring1));
writer.WriteString(sVal);
}
if(m_oApplyFill.IsInit())
{
CString sVal;sVal.Format(_T(" applyFill=\"%ls\""), m_oApplyFill->ToString2(SimpleTypes::onofftostring1));
writer.WriteString(sVal);
}
if(m_oApplyBorder.IsInit())
{
CString sVal;sVal.Format(_T(" applyBorder=\"%ls\""), m_oApplyBorder->ToString2(SimpleTypes::onofftostring1));
writer.WriteString(sVal);
}
if(m_oApplyAlignment.IsInit())
{
CString sVal;sVal.Format(_T(" applyAlignment=\"%ls\""), m_oApplyAlignment->ToString2(SimpleTypes::onofftostring1));
writer.WriteString(sVal);
}
if(m_oQuotePrefix.IsInit())
{
CString sVal;sVal.Format(_T(" quotePrefix=\"%ls\""), m_oQuotePrefix->ToString2(SimpleTypes::onofftostring1));
writer.WriteString(sVal);
}
WritingStringNullableAttrInt(L"fontId", m_oFontId, m_oFontId->GetValue());
WritingStringNullableAttrInt(L"fillId", m_oFillId, m_oFillId->GetValue());
WritingStringNullableAttrInt(L"borderId", m_oBorderId, m_oBorderId->GetValue());
WritingStringNullableAttrInt(L"numFmtId", m_oNumFmtId, m_oNumFmtId->GetValue());
WritingStringNullableAttrInt(L"xfId", m_oXfId, m_oXfId->GetValue());
WritingStringNullableAttrBool(L"applyNumberFormat", m_oApplyNumberFormat);
WritingStringNullableAttrBool(L"applyFont", m_oApplyFont);
WritingStringNullableAttrBool(L"applyFill", m_oApplyFill);
WritingStringNullableAttrBool(L"applyBorder", m_oApplyBorder);
WritingStringNullableAttrBool(L"applyAlignment", m_oApplyAlignment);
WritingStringNullableAttrBool(L"quotePrefix", m_oQuotePrefix);
if(m_oAligment.IsInit())
{
writer.WriteString(_T(">"));
......@@ -365,14 +285,10 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<cellXfs"));
if(m_oCount.IsInit())
{
CString sVal;sVal.Format(_T(" count=\"%d\""), m_oCount->GetValue());
writer.WriteString(sVal);
}
WritingStringNullableAttrInt(L"count", m_oCount, m_oCount->GetValue());
writer.WriteString(_T(">"));
for(unsigned int i = 0, length = m_arrItems.size(); i < length; ++i)
m_arrItems[i]->toXML(writer);
......@@ -429,14 +345,10 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<cellStyleXfs"));
if(m_oCount.IsInit())
{
CString sVal;sVal.Format(_T(" count=\"%d\""), m_oCount->GetValue());
writer.WriteString(sVal);
}
WritingStringNullableAttrInt(L"count", m_oCount, m_oCount->GetValue());
writer.WriteString(_T(">"));
for(unsigned int i = 0, length = m_arrItems.size(); i < length; ++i)
m_arrItems[i]->toXML(writer);
......
......@@ -60,9 +60,9 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(CString(_T("<dxf>")));
writer.WriteString(L"<dxf>");
if(m_oFont.IsInit())
m_oFont->toXML(writer);
if(m_oNumFmt.IsInit())
......@@ -75,7 +75,7 @@ namespace OOX
m_oBorder->toXML(writer);
if(m_oProtection.IsInit())
m_oProtection->toXML(writer);
writer.WriteString(CString(_T("</dxf>")));
writer.WriteString(L"</dxf>");
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
......@@ -137,14 +137,10 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<dxfs"));
if(m_oCount.IsInit())
{
CString sVal;sVal.Format(_T(" count=\"%d\""), m_oCount->GetValue());
writer.WriteString(sVal);
}
WritingStringNullableAttrInt(L"count", m_oCount, m_oCount->GetValue());
writer.WriteString(_T(">"));
for(unsigned int i = 0, length = m_arrItems.size(); i < length; ++i)
m_arrItems[i]->toXML(writer);
......
......@@ -68,7 +68,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
......@@ -99,7 +99,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -370,49 +370,31 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
// вызовем по default
toXML2(writer, _T("color"));
}
void toXML2(XmlUtils::CStringWriter& writer, CString sName) const
void toXML2(NSStringUtils::CStringBuilder& writer, const std::wstring& sName) const
{
writer.WriteString(_T("<"));
writer.WriteString(sName);
if(m_oAuto.IsInit())
{
CString sVal;sVal.Format(_T(" auto=\"%ls\""), m_oAuto->ToString2(SimpleTypes::onofftostring1));
writer.WriteString(sVal);
}
if(m_oIndexed.IsInit())
{
CString sVal;sVal.Format(_T(" indexed=\"%d\""), m_oIndexed->GetValue());
writer.WriteString(sVal);
}
WritingStringNullableAttrBool(L"auto", m_oAuto);
WritingStringNullableAttrInt(L"indexed", m_oIndexed, m_oIndexed->GetValue());
if(m_oRgb.IsInit())
{
int nIndex = OOX::Spreadsheet::CIndexedColors::GetDefaultIndexByRGBA(m_oRgb->Get_R(), m_oRgb->Get_G(), m_oRgb->Get_B(), m_oRgb->Get_A());
if(-1 == nIndex)
{
CString sVal;sVal.Format(_T(" rgb=\"%ls\""), m_oRgb->ToString());
writer.WriteString(sVal);
WritingStringAttrString(L"rgb", m_oRgb->ToString());
}
else
{
CString sVal;sVal.Format(_T(" indexed=\"%d\""), nIndex);
writer.WriteString(sVal);
}
}
if(m_oThemeColor.IsInit())
{
CString sVal;sVal.Format(_T(" theme=\"%d\""), m_oThemeColor->GetValue());
writer.WriteString(sVal);
WritingStringAttrInt(L"indexed", nIndex);
}
if(m_oTint.IsInit())
{
CString sVal;sVal.Format(_T(" tint=\"%ls\""), SpreadsheetCommon::WriteDouble(m_oTint->GetValue()));
writer.WriteString(sVal);
}
WritingStringNullableAttrInt(L"theme", m_oThemeColor, m_oThemeColor->GetValue());
WritingStringNullableAttrDouble(L"tint", m_oTint, m_oTint->GetValue());
writer.WriteString(_T("/>"));
}
......@@ -465,7 +447,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -667,7 +649,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<rPr>"));
if(m_oBold.IsInit())
......@@ -679,8 +661,7 @@ namespace OOX
}
if(m_oCharset.IsInit() && m_oCharset->m_oCharset.IsInit())
{
CString sVal;sVal.Format(_T("<charset val=\"%ls\"/>"), m_oCharset->m_oCharset->ToString());
writer.WriteString(sVal);
WritingStringValAttrString(L"charset", m_oCharset->m_oCharset->ToString());
}
if(m_oColor.IsInit())
m_oColor->toXML2(writer, _T("color"));
......@@ -700,8 +681,7 @@ namespace OOX
}
if(m_oFamily.IsInit() && m_oFamily->m_oFontFamily.IsInit())
{
CString sVal;sVal.Format(_T("<family val=\"%ls\"/>"), m_oFamily->m_oFontFamily->ToString());
writer.WriteString(sVal);
WritingStringValAttrString(L"family", m_oFamily->m_oFontFamily->ToString());
}
if(m_oItalic.IsInit())
{
......@@ -719,16 +699,11 @@ namespace OOX
}
if(m_oRFont.IsInit() && m_oRFont->m_sVal.IsInit())
{
CString sVal;
sVal.Append(_T("<rFont val=\""));
sVal.Append( XmlUtils::EncodeXmlString(m_oRFont->m_sVal.get()));
sVal.Append(_T("\"/>"));
writer.WriteString(sVal);
WritingStringValAttrEncodeXmlString(L"rFont", m_oRFont->m_sVal.get());
}
if(m_oScheme.IsInit() && m_oScheme->m_oFontScheme.IsInit())
{
CString sVal;sVal.Format(_T("<scheme val=\"%ls\"/>"), m_oScheme->m_oFontScheme->ToString());
writer.WriteString(sVal);
WritingStringValAttrString(L"scheme", m_oScheme->m_oFontScheme->ToString());
}
if(m_oShadow.IsInit())
{
......@@ -746,22 +721,26 @@ namespace OOX
}
if(m_oSz.IsInit() && m_oSz->m_oVal.IsInit())
{
CString sVal;sVal.Format(_T("<sz val=\"%ls\"/>"), SpreadsheetCommon::WriteDouble(m_oSz->m_oVal->GetValue()));
writer.WriteString(sVal);
WritingStringValAttrDouble(L"sz", m_oSz->m_oVal->GetValue());
}
if(m_oUnderline.IsInit() && m_oUnderline->m_oUnderline.IsInit())
{
CString sVal;
if( SimpleTypes::underlineSingle != m_oUnderline->m_oUnderline->GetValue())
sVal.Format(_T("<u val=\"%ls\"/>"), m_oUnderline->m_oUnderline->ToString());
{
WritingStringValAttrString(L"u", m_oUnderline->m_oUnderline->ToString());
}
else
sVal.Format(_T("<u/>"), m_oUnderline->m_oUnderline->ToString());
writer.WriteString(sVal);
{
writer.WriteString(L"<u/>");
}
}
if(m_oVertAlign.IsInit() && m_oVertAlign->m_oVerticalAlign.IsInit())
{
CString sVal;sVal.Format(_T("<vertAlign val=\"%ls\"/>"), m_oVertAlign->m_oVerticalAlign->ToString());
writer.WriteString(sVal);
CString sVerticalAlign = m_oVertAlign->m_oVerticalAlign->ToString();
writer.WriteString(L" vertAlign=\"");
writer.WriteString(sVerticalAlign.GetBuffer());
writer.WriteString(L"\"");
sVerticalAlign.ReleaseBuffer();
}
writer.WriteString(_T("</rPr>"));
}
......
......@@ -58,34 +58,14 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<workbookView"));
if(m_oXWindow.IsInit())
{
CString sVal;sVal.Format(_T(" xWindow=\"%d\""), m_oXWindow->GetValue());
writer.WriteString(sVal);
}
if(m_oYWindow.IsInit())
{
CString sVal;sVal.Format(_T(" yWindow=\"%d\""), m_oYWindow->GetValue());
writer.WriteString(sVal);
}
if(m_oWindowWidth.IsInit())
{
CString sVal;sVal.Format(_T(" windowWidth=\"%d\""), m_oWindowWidth->GetValue());
writer.WriteString(sVal);
}
if(m_oWindowHeight.IsInit())
{
CString sVal;sVal.Format(_T(" windowHeight=\"%d\""), m_oWindowHeight->GetValue());
writer.WriteString(sVal);
}
if(m_oActiveTab.IsInit())
{
CString sVal;sVal.Format(_T(" activeTab=\"%d\""), m_oActiveTab->GetValue());
writer.WriteString(sVal);
}
WritingStringNullableAttrInt(L"xWindow", m_oXWindow, m_oXWindow->GetValue());
WritingStringNullableAttrInt(L"yWindow", m_oYWindow, m_oYWindow->GetValue());
WritingStringNullableAttrInt(L"windowWidth", m_oWindowWidth, m_oWindowWidth->GetValue());
WritingStringNullableAttrInt(L"windowHeight", m_oWindowHeight, m_oWindowHeight->GetValue());
WritingStringNullableAttrInt(L"activeTab", m_oActiveTab, m_oActiveTab->GetValue());
writer.WriteString(_T("/>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -157,7 +137,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<bookViews>"));
for(unsigned int i = 0, length = m_arrItems.size(); i < length; ++i)
......
......@@ -56,14 +56,10 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<externalReference"));
if(m_oRid.IsInit())
{
CString sVal;sVal.Format(_T(" r:id=\"%ls\""), m_oRid->GetValue());
writer.WriteString(sVal);
}
WritingStringNullableAttrString(L"r:id", m_oRid, m_oRid->ToString2());
writer.WriteString(_T("/>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -110,7 +106,7 @@ namespace OOX
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<externalReferences>"));
for(unsigned int i = 0, length = m_arrItems.size(); i < length; ++i)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -51,7 +51,7 @@
namespace CSVWriter
{
void WriteFile(NSFile::CFileBinary *pFile, WCHAR **pWriteBuffer, INT &nCurrentIndex, CString &sWriteString, UINT &nCodePage, bool bIsEnd = false);
void WriteFile(NSFile::CFileBinary *pFile, WCHAR **pWriteBuffer, INT &nCurrentIndex, std::wstring &sWriteString, UINT &nCodePage, bool bIsEnd = false);
void WriteFromXlsxToCsv(const CString &sFileDst, OOX::Spreadsheet::CXlsx &oXlsx, UINT nCodePage, const WCHAR wcDelimiter, bool bJSON);
}
......
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