Commit 8ecdeeed authored by ElenaSubbotina's avatar ElenaSubbotina

DocxFormat - small refactoring

parent 6778027d
......@@ -76,8 +76,7 @@ namespace OOX
}
virtual CString toXML() const
{
CString sResult;
sResult.Format( _T("<ds:schemaRef ds:uri=\"%ls\" />"), m_sUri );
CString sResult = _T("<ds:schemaRef ds:uri=\"") + m_sUri + _T("\" />");
return sResult;
}
virtual EElementType getType() const
......@@ -180,8 +179,9 @@ namespace OOX
}
virtual void write(const CPath& oFilePath, const CPath& oDirectory, CContentTypes& oContent) const
{
CString sXml;
sXml.Format( _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><ds:datastoreItem ds:itemID=\"%ls\" xmlns:ds=\"http://schemas.openxmlformats.org/officeDocument/2006/customXml\">"), m_oItemID.ToString() );
CString sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><ds:datastoreItem ds:itemID=\"");
sXml += m_oItemID.ToString();
sXml += _T("\" xmlns:ds=\"http://schemas.openxmlformats.org/officeDocument/2006/customXml\">");
if ( m_oShemaRefs.IsInit() )
sXml += m_oShemaRefs->toXML();
......
......@@ -449,7 +449,9 @@ namespace OOX
if ( SimpleTypes::conformanceclassTransitional != m_oConformance.GetValue() )
{
sXml.Format( _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:document w:conformance=\"%ls\" xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">"), m_oConformance.ToString() );
sXml += _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:document w:conformance=\"");
sXml += m_oConformance.ToString();
sXml += _T("\" xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">");
}
else
{
......
......@@ -75,7 +75,7 @@ namespace OOX
CString sResult;
if ( m_oSpace.IsInit() )
sResult.Format( _T("<a:t xml:space=\"%ls\">"), m_oSpace->ToString() );
sResult = _T("<a:t xml:space=\"") + m_oSpace->ToString() + _T("\">");
else
sResult = _T("<a:t>");
......
......@@ -1354,25 +1354,12 @@ namespace OOX
{
CString sResult = _T("<w:permStart ");
ComplexTypes_WriteAttribute( _T("w:colFirst=\""), m_oColFirst );
ComplexTypes_WriteAttribute( _T("w:colLast=\""), m_oColLast );
ComplexTypes_WriteAttribute( _T("w:displacedbyCustomXml=\""), m_oDisplacedByCustomXml );
if ( m_sEd.IsInit() )
{
sResult += _T("w:ed=\"");
sResult += m_sEd->GetString();
sResult += _T("\" ");
}
ComplexTypes_WriteAttribute( _T("w:edGrp=\""), m_oEdGrp );
if ( m_sId.IsInit() )
{
sResult += _T("w:id=\"");
sResult += m_sId->GetString();
sResult += _T("\" ");
}
ComplexTypes_WriteAttribute( _T("w:colFirst=\""), m_oColFirst );
ComplexTypes_WriteAttribute( _T("w:colLast=\""), m_oColLast );
ComplexTypes_WriteAttribute( _T("w:displacedbyCustomXml=\""), m_oDisplacedByCustomXml );
ComplexTypes_WriteAttribute2(_T("w:ed=\""), m_sEd);
ComplexTypes_WriteAttribute( _T("w:edGrp=\""), m_oEdGrp );
ComplexTypes_WriteAttribute2(_T("w:id=\""), m_sId);
sResult += _T("/>");
......
......@@ -153,9 +153,9 @@ namespace OOX
if(m_oVal.IsInit())
{
#if defined(_WIN32) || defined (_WIN64)
sResult.AppendFormat(_T(" val=\"%ls\""), m_oVal->ToString());
sResult += _T(" val=\"") + m_oVal->ToString() + _T("\"");
#else
sResult.AppendFormat(_T(" val=\"%ls\""), m_oVal->ToString().c_str());
sResult += _T(" val=\"") + m_oVal->ToString().c_str() + _T("\"");
#endif
}
sResult += _T(">");
......
......@@ -333,7 +333,7 @@ namespace OOX
CString sResult;
if ( m_oSpace.IsInit() )
sResult.Format( _T("<w:delText xml:space=\"%ls\">"), m_oSpace->ToString() );
sResult = _T("<w:delText xml:space=\"") + m_oSpace->ToString() + _T("\">");
else
sResult = _T("<w:delText>");
......@@ -798,7 +798,7 @@ namespace OOX
CString sResult;
if ( m_oSpace.IsInit() )
sResult.Format( _T("<w:t xml:space=\"%ls\">"), m_oSpace->ToString() );
sResult = _T("<w:t xml:space=\"") + m_oSpace->ToString() + _T("\">");
else
sResult = _T("<w:t>");
......@@ -1121,7 +1121,7 @@ namespace OOX
CString sResult;
if ( m_oSpace.IsInit() )
sResult.Format( _T("<w:delInstrText xml:space=\"%ls\">"), m_oSpace->ToString() );
sResult = _T("<w:delInstrText xml:space=\"") + m_oSpace->ToString() + _T("\">");
else
sResult = _T("<w:delInstrText>");
......@@ -1423,7 +1423,7 @@ namespace OOX
CString sResult;
if ( m_oSpace.IsInit() )
sResult.Format( _T("<w:instrText xml:space=\"%ls\">"), m_oSpace->ToString() );
sResult = _T("<w:instrText xml:space=\"") + m_oSpace->ToString() + _T("\">");
else
sResult = _T("<w:instrText>");
......
......@@ -204,10 +204,7 @@ namespace ComplexTypes
}
virtual CString ToString() const
{
CString sResult;
sResult.Format( _T("w:val=\"%ls\""), m_oVal.ToString() );
CString sResult = _T("w:val=\"") + m_oVal.ToString() + _T("\"");
return sResult;
}
private:
......@@ -252,10 +249,7 @@ namespace ComplexTypes
}
virtual CString ToString() const
{
CString sResult;
sResult.Format( _T("w:val=\"%ls\""), m_oVal.ToString() );
CString sResult = _T("w:val=\"") + m_oVal.ToString() + _T("\"");
return sResult;
}
private:
......@@ -300,9 +294,7 @@ namespace ComplexTypes
}
virtual CString ToString() const
{
CString sResult;
sResult.Format( _T("w:val=\"%ls\""), m_oVal.ToString() );
CString sResult = _T("w:val=\"") + m_oVal.ToString() + _T("\"");
return sResult;
}
......@@ -348,9 +340,7 @@ namespace ComplexTypes
}
virtual CString ToString() const
{
CString sResult;
sResult.Format( _T("w:multiLine=\"%ls\""), m_oMultiLine.ToString() );
CString sResult = _T("w:multiLine=\"") + m_oMultiLine.ToString() + _T("\"");
return sResult;
}
......
......@@ -1023,8 +1023,7 @@ namespace OOX
sResult += _T("<x:SizeWithCells/>");
if(m_oAnchor.IsInit())
{
CString sAnchor;sAnchor.Format(_T("<x:Anchor>%ls</x:Anchor>"), m_oAnchor.get());
sResult += sAnchor;
sResult += _T("<x:Anchor>") + m_oAnchor.get() + _T("</x:Anchor>");
}
if(m_oRow.IsInit())
{
......
......@@ -3293,7 +3293,7 @@ namespace OOX
CString sResult;
if ( m_oSpace.IsInit() )
sResult.Format( _T("<m:t xml:space=\"%ls\">"), m_oSpace->ToString() );
sResult = _T("<m:t xml:space=\"") + m_oSpace->ToString() + _T("\">");
else
sResult = _T("<m:t>");
......
......@@ -472,7 +472,13 @@ namespace OOX
virtual CString toXML() const
{
CString sResult;
sResult.Format( _T("<w:latentStyles w:count=\"%d\" w:defLockedState=\"%ls\" w:defQFormat=\"%ls\" w:defSemiHidden=\"%ls\" w:defUIPriority=\"%d\" w:defUnhideWhenUsed=\"%ls\">"), m_oCount.GetValue(), m_oDefLockedState.ToString(), m_oDefQFormat.ToString(), m_oDefSemiHidden.ToString(), m_oDefUiPriority.GetValue(), m_oDefUnhideWhenUsed.ToString() );
sResult.AppendFormat( _T("<w:latentStyles w:count=\"%d\""), m_oCount.GetValue());
sResult += _T(" w:defLockedState=\"") + m_oDefLockedState.ToString() + _T("\"");
sResult += _T(" w:defQFormat=\"") + m_oDefQFormat.ToString() + _T("\"");
sResult += _T(" w:defSemiHidden=\"") + m_oDefSemiHidden.ToString() + _T("\"");
sResult.AppendFormat(_T(" w:defUIPriority=\"%d\""), m_oDefUiPriority.GetValue());
sResult += _T(" w:defUnhideWhenUsed=\"")+ m_oDefUnhideWhenUsed.ToString();
sResult += _T("\">");
for (unsigned int nIndex = 0; nIndex < m_arrLsdException.size(); nIndex++ )
{
......
......@@ -131,7 +131,7 @@ namespace FileSystem
memset (pBuffer, 0, sizeof (TCHAR) * (MAX_PATH+1));
::GetTempPathW (MAX_PATH, pBuffer);
CString res;
res.AppendFormat(_T("%ls"), pBuffer);
res += CString(pBuffer);
int nSeparator1Pos = res.ReverseFind(_T('/'));
if (-1 == nSeparator1Pos)
......
......@@ -373,7 +373,7 @@ namespace OOX
{
if(m_oId.IsInit())
{
CString sVal;sVal.Format(_T("<legacyDrawing r:id=\"%ls\"/>"), m_oId->GetValue());
CString sVal = _T("<legacyDrawing r:id=\"") + m_oId->GetValue() + _T("\"/>");
writer.WriteString(sVal);
}
......
......@@ -69,8 +69,9 @@ namespace OOX
CString sEnd;
if(m_oFrom.IsInit() && m_oTo.IsInit())
{
sStart.Format(_T("<xdr:twoCellAnchor editAs=\"%ls\">"), m_oAnchorType.ToString());
sEnd = _T("</xdr:twoCellAnchor>");
sStart = _T("<xdr:twoCellAnchor editAs=\"") + m_oAnchorType.ToString() + _T("\">");
sEnd = _T("</xdr:twoCellAnchor>");
writer.WriteString(sStart);
if(m_oFrom.IsInit())
m_oFrom->toXML2(writer, _T("xdr:from"));
......
......@@ -64,7 +64,7 @@ namespace OOX
{
if(m_oId.IsInit())
{
CString sVal;sVal.Format(_T("<drawing r:id=\"%ls\"/>"), m_oId->GetValue());
CString sVal = _T("<drawing r:id=\"") + m_oId->GetValue() + _T("\"/>");
writer.WriteString(sVal);
}
......
......@@ -60,7 +60,7 @@ namespace OOX
}
virtual void toXML2(XmlUtils::CStringWriter& writer, CString sName) const
{
CString sStart;sStart.Format(_T("<%ls>"), sName);
CString sStart = _T("<") + sName + _T(">");
writer.WriteString(sStart);
if(m_oCol.IsInit())
{
......@@ -82,7 +82,7 @@ namespace OOX
CString sVal;sVal.Format(_T("<xdr:rowOff>%lld</xdr:rowOff>"), m_oRowOff->ToEmu());
writer.WriteString(sVal);
}
CString sEnd;sEnd.Format(_T("</%ls>"), sName);
CString sEnd = _T("</") + sName + _T(">");
writer.WriteString(sEnd);
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......
......@@ -250,12 +250,13 @@ namespace OOX
{
if(m_oBlipFill.IsInit() && m_oBlipFill->m_oBlip.IsInit())
{
CString sRes;
sRes.Format(_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=\"%ls\" 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/>"), m_oBlipFill->m_oBlip->m_oEmbed.GetValue());
CString sRes = _T("<xdr:pic><xdr:nvPicPr><xdr:cNvPr id=\"1\" name=\"image\"/><xdr:cNvPicPr><a:picLocks noChangeAspect=\"1\"/></xdr:cNvPicPr></xdr:nvPicPr><xdr:blipFill><a:blip xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" r:embed=\"");
sRes += m_oBlipFill->m_oBlip->m_oEmbed.GetValue();
sRes += _T("\" cstate=\"print\"><a:extLst><a:ext uri=\"{28A0092B-C50C-407E-A947-70E740481C1C}\"><a14:useLocalDpi xmlns:a14=\"http://schemas.microsoft.com/office/drawing/2010/main\" val=\"0\"/></a:ext></a:extLst></a:blip><a:stretch><a:fillRect/></a:stretch></xdr:blipFill><xdr:spPr><a:prstGeom prst=\"rect\"><a:avLst/></a:prstGeom></xdr:spPr></xdr:pic><xdr:clientData/>");
writer.WriteString(sRes);
}
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
......
......@@ -80,7 +80,7 @@ namespace OOX
if(m_oRid.IsInit())
{
CString sVal; sVal.Format(_T(" r:id=\"%ls\""), m_oRid->GetValue());
CString sVal = _T(" r:id=\"") + m_oRid->GetValue() + _T("\"");
sResult += sVal;
sResult += _T(" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" ");
}
......
......@@ -82,8 +82,7 @@ namespace OOX
}
if(m_oSourceLinked.IsInit())
{
CString sVal;
sVal.Format(_T(" sourceLinked=\"%ls\""), m_oSourceLinked->ToString2(SimpleTypes::onofftostring1));
CString sVal = _T(" sourceLinked=\"") + m_oSourceLinked->ToString2(SimpleTypes::onofftostring1) + _T("\"");
writer.WriteString(sVal);
}
writer.WriteString(_T("/>"));
......
......@@ -61,11 +61,12 @@ namespace OOX
{
if(m_oType.IsInit() && m_oDxfId.IsInit())
{
CString sXml;
CString sXml = _T("<tableStyleElement type=\"") + m_oType->ToString() + _T("\"");
if(m_oSize.IsInit())
sXml.Format(_T("<tableStyleElement type=\"%ls\" size=\"%d\" dxfId=\"%d\"/>"), m_oType->ToString(), m_oSize->GetValue(), m_oDxfId->GetValue());
else
sXml.Format(_T("<tableStyleElement type=\"%ls\" dxfId=\"%d\"/>"), m_oType->ToString(), m_oDxfId->GetValue());
sXml.AppendFormat(_T(" size=\"%d\""), m_oSize->GetValue());
sXml.AppendFormat(_T(" dxfId=\"%d\"/>"), m_oDxfId->GetValue());
writer.WriteString(sXml);
}
}
......
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