Commit 28263061 authored by ElenaSubbotina's avatar ElenaSubbotina

WordArt multiline->paragraphs

parent 3c7d9162
......@@ -224,8 +224,6 @@ namespace DocFileFormat
ChildAnchor* pAnchor = pContainer->FirstChildWithType<ChildAnchor>();
ClientAnchor* clientAnchor = pContainer->FirstChildWithType<ClientAnchor>();
XMLTools::XMLElement<wchar_t> *pMultiTextPath = NULL;
WriteBeginShapeNode (pShape);
m_pXmlWriter->WriteAttribute ( _T( "id"), GetShapeID(pShape).c_str());
......@@ -659,32 +657,8 @@ namespace DocFileFormat
if (0 <= text.find(_T("\n")))
{
pMultiTextPath = new XMLTools::XMLElement<wchar_t>(_T("v:multitextpaths"));
int pos1 = 0, pos2 = 0;
std::wstring s;
XMLTools::XMLElement<wchar_t> t_child;
while(pos1 < text.length() && pos2 < text.length())
{
pos2 = text.find(_T("\n"), pos1);
if (pos2 > 0)
{
std::wstring s = text.substr(pos1, pos2 - pos1);
t_child = XMLTools::XMLElement<wchar_t>(_T("v:textpart"));
t_child.AppendAttribute(_T("val"), s.c_str());
pMultiTextPath->AppendChild(t_child );
pos1 = pos2 + 1;
}
else break;
}
s = text.substr(pos1, text.length() - pos1);
t_child = XMLTools::XMLElement<wchar_t>(_T("v:textpart"));
t_child.AppendAttribute(_T("val"), s.c_str());
pMultiTextPath->AppendChild(t_child );
}
m_textpath.AppendText(text.c_str());
}
text = ReplaceString(text, _T("\n") , _T("&#xA;"));
appendValueAttribute(&m_textpath, L"string", text.c_str());
}break;
......@@ -741,7 +715,6 @@ namespace DocFileFormat
appendStyleProperty(&m_textPathStyle, L"font-weight", L"bold");
}
}break;
// PATH
case shapePath :
{
......@@ -783,8 +756,6 @@ namespace DocFileFormat
m_pXmlWriter->WriteAttribute( _T( "coordsize" ), ( FormatUtils::IntToWideString( xCoord ) + _T( "," ) + FormatUtils::IntToWideString( yCoord ) ).c_str() );
}
/// <!-- DOCX TAG 'adj' -->
int nCode = 0;
if (pShape->GetShapeType())
{
......@@ -821,14 +792,12 @@ namespace DocFileFormat
offset += FormatUtils::DoubleToWideString( ShadowOffsetX.ToPoints() );
offset += _T( "pt" );
}
if ( ShadowOffsetY != 0 )
{
offset += _T( "," );
offset += FormatUtils::DoubleToWideString( ShadowOffsetY.ToPoints() );
offset += _T( "pt" );
}
if ( !offset.empty() )
{
appendValueAttribute(&m_shadow, _T( "offset" ), offset.c_str());
......@@ -900,7 +869,6 @@ namespace DocFileFormat
appendValueAttribute(&m_3dstyle, _T( "viewpoint" ), viewPoint.c_str());
}
// write the viewpointorigin
if ( ( viewPointOriginX != 0 ) || ( viewPointOriginY != 0 ) )
{
......@@ -922,7 +890,6 @@ namespace DocFileFormat
m_pXmlWriter->WriteString(m_3dstyle.GetXMLString().c_str());
}
// write wrap
if (m_pSpa)
{
......@@ -935,31 +902,22 @@ namespace DocFileFormat
m_pXmlWriter->WriteNodeEnd ( _T( "w10:wrap" ), TRUE );
}
}
// write stroke
if (m_stroke.GetAttributeCount())
{
m_pXmlWriter->WriteString(m_stroke.GetXMLString().c_str());
}
// write fill
if (m_fill.GetAttributeCount())
{
m_pXmlWriter->WriteString(m_fill.GetXMLString().c_str());
}
// text path
if (m_textpath.GetAttributeCount())
{
appendValueAttribute(&m_textpath, _T( "style" ), FormatUtils::XmlEncode(m_textPathStyle).c_str());
m_pXmlWriter->WriteString(m_textpath.GetXMLString().c_str());
}
if (pMultiTextPath)
{
//m_pXmlWriter->WriteString(pMultiTextPath->GetXMLString().c_str());
delete pMultiTextPath;
}
// write imagedata
if (m_imagedata.GetAttributeCount())
{
......@@ -975,9 +933,7 @@ namespace DocFileFormat
m_pXmlWriter->WriteNodeEnd(L"", true);
}
}
// TEXTBOX
OfficeArtClientTextbox* pTextBox = pContainer->FirstChildWithType<OfficeArtClientTextbox>();
if (pTextBox)
{
......@@ -1019,7 +975,6 @@ namespace DocFileFormat
}
WriteEndShapeNode(pShape);
//ShapeType
if (NULL != pShape->GetShapeType() && !m_isInlineShape) //bullete only???
{
......
......@@ -1798,14 +1798,14 @@ PPTX::Logic::SpTreeElem CDrawingConverter::doc_LoadShape(XmlUtils::CXmlNode& oNo
if (oNodeShape.GetNodes(_T("*"), oChilds))
{
EFilltype eFillType = etSolidFill;
CString sTxbxContent = _T("<w:txbxContent><w:p>");
CString sParaRun = _T("<w:r>");
CString sTxbxContent = _T("<w:txbxContent>");
CString srPr;
CString sFont = (_T("Arial Black"));
//CString sDashStyle;
int nFontSize = 36;
LONG lChildsCount = oChilds.GetCount();
CString strString = _T("");
std::vector<CString> strString;
BYTE lAlpha;
bool bOpacity = false;
bool bOpacity2 = false;
......@@ -1869,13 +1869,33 @@ PPTX::Logic::SpTreeElem CDrawingConverter::doc_LoadShape(XmlUtils::CXmlNode& oNo
CString strNameP = XmlUtils::GetNameNoNS(oNodeP.GetName());
if (_T("textpath") == strNameP)
{
strString = oNodeP.GetText(); //для обхода &#xA пишется дубль в контент
CString tmpString = oNodeP.GetText(); //для обхода &#xA пишется дубль в контент
if (tmpString.IsEmpty())
{
tmpString = oNodeP.GetAttribute(_T("string"));
CorrectXmlString(tmpString ); // мы используем его в хмл
strString.push_back(tmpString );
}
else
{
CorrectXmlString(tmpString ); // мы используем его в хмл
int pos1 = 0, pos2 = 0;
if (strString.IsEmpty())
while(pos1 < tmpString.GetLength() && pos2 < tmpString.GetLength())
{
strString = oNodeP.GetAttribute(_T("string"));
pos2 = tmpString.Find(_T("\n"), pos1);
if (pos2 > 0)
{
strString.push_back(tmpString.Mid(pos1, pos2 - pos1));
pos1 = pos2 + 1;
}
else break;
}
CorrectXmlString(strString); // мы используем его в хмл
strString.push_back(tmpString.Mid(pos1, tmpString.GetLength() - pos1));
}
CString strStyle = oNodeP.GetAttribute(_T("style"));
PPTX::CCSS oCSSParser;
......@@ -2092,7 +2112,6 @@ PPTX::Logic::SpTreeElem CDrawingConverter::doc_LoadShape(XmlUtils::CXmlNode& oNo
}*/
}
//srPr += _T("<w:rPr>");
srPr += _T("<w:rFonts w:ascii=\"") + sFont + _T("\" w:hAnsi=\"") + sFont + _T("\"/>");
CString strSize;
strSize.Format(_T("%d"), nFontSize);
......@@ -2264,9 +2283,13 @@ PPTX::Logic::SpTreeElem CDrawingConverter::doc_LoadShape(XmlUtils::CXmlNode& oNo
srPr += _T("</w14:textOutline>");
//srPr += _T("</w:rPr>");
sParaRun += _T("<w:rPr>") + srPr + _T("</w:rPr>") + _T("<w:t>") + strString + _T("</w:t></w:r>");
sTxbxContent += _T("<w:pPr><w:rPr>") + srPr + _T("</w:rPr></w:pPr>") + sParaRun + _T("</w:p></w:txbxContent>");
for (int i = 0; i < strString.size(); i++)
{
CString sParaRun = _T("<w:r><w:rPr>") + srPr + _T("</w:rPr>") + _T("<w:t>") + strString[i] + _T("</w:t></w:r>");
sTxbxContent += _T("<w:p><w:pPr><w:rPr>") + srPr + _T("</w:rPr></w:pPr>") + sParaRun + _T("</w:p>");
}
sTxbxContent += _T("</w:txbxContent>");
pShape->TextBoxShape = sTxbxContent;
}
strXmlPPTX = _T("<a:prstGeom prst=\"rect\"><a:avLst/></a:prstGeom>");
......
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