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