mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-20 00:03:33 +08:00
PptFormatReader - fix shape geometry in files from newest ms office
This commit is contained in:
@ -175,6 +175,7 @@ SOURCES += \
|
||||
../Reader/SlidePersist.cpp \
|
||||
../Records/Animations/AnimationTypes.cpp \
|
||||
../Records/Drawing/ArtBlip.cpp \
|
||||
../Records/Drawing/ShapeContainer.cpp \
|
||||
../PPTXWriter/Converter.cpp \
|
||||
../PPTXWriter/ShapeWriter.cpp
|
||||
}
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
#include "../Reader/SlidePersist.cpp"
|
||||
#include "../Records/Animations/AnimationTypes.cpp"
|
||||
#include "../Records/Drawing/ArtBlip.cpp"
|
||||
#include "../Records/Drawing/ShapeContainer.cpp"
|
||||
|
||||
#include "../PPTXWriter/Converter.cpp"
|
||||
#include "../PPTXWriter/ShapeWriter.cpp"
|
||||
|
||||
@ -285,115 +285,128 @@ void NSPresentationEditor::CPPTXWriter::WriteApp(CFile& oFile)
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties");
|
||||
CP_XML_ATTR(L"xmlns:vt", L"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypess");
|
||||
}
|
||||
CP_XML_NODE(L"Application")
|
||||
{
|
||||
CP_XML_STREAM() << 0;
|
||||
}
|
||||
#if defined(INTVER)
|
||||
CP_XML_NODE(L"AppVersion")
|
||||
{
|
||||
|
||||
CP_XML_NODE(L"TotalTime")
|
||||
{
|
||||
CP_XML_STREAM() << 0;
|
||||
}
|
||||
CP_XML_NODE(L"Words")
|
||||
{
|
||||
CP_XML_STREAM() << 0;
|
||||
}
|
||||
std::wstring sApplication = L"ONLYOFFICE";
|
||||
#if defined(INTVER)
|
||||
std::string s = VALUE2STR(INTVER);
|
||||
CP_XML_STREAM() << std::wstring(s.begin(), s.end());
|
||||
}
|
||||
#endif
|
||||
CP_XML_NODE(L"TotalTime")
|
||||
{
|
||||
CP_XML_STREAM() << 0;
|
||||
}
|
||||
CP_XML_NODE(L"Words")
|
||||
{
|
||||
CP_XML_STREAM() << 0;
|
||||
}
|
||||
CP_XML_NODE(L"PresentationFormat")
|
||||
{
|
||||
CP_XML_STREAM() << L"On-screen Show (4:3)";
|
||||
}
|
||||
CP_XML_NODE(L"Paragraphs")
|
||||
{
|
||||
CP_XML_STREAM() << 0;
|
||||
}
|
||||
CP_XML_NODE(L"Slides")
|
||||
{
|
||||
CP_XML_STREAM() << m_pDocument->m_arSlides.size();
|
||||
}
|
||||
CP_XML_NODE(L"Notes")
|
||||
{
|
||||
CP_XML_STREAM() << m_pDocument->m_arNotes.size();
|
||||
}
|
||||
CP_XML_NODE(L"HiddenSlides")
|
||||
{
|
||||
CP_XML_STREAM() << 0;
|
||||
}
|
||||
CP_XML_NODE(L"MMClips")
|
||||
{
|
||||
CP_XML_STREAM() << 2;
|
||||
}
|
||||
CP_XML_NODE(L"ScaleCrop")
|
||||
{
|
||||
CP_XML_STREAM() << L"false";
|
||||
}
|
||||
CP_XML_NODE(L"HeadingPairs")
|
||||
{
|
||||
CP_XML_NODE(L"vt:vector")
|
||||
sApplication += L"/" + std::wstring(s.begin(), s.end());
|
||||
#endif
|
||||
CP_XML_NODE(L"Application")
|
||||
{
|
||||
CP_XML_ATTR(L"size", 4);
|
||||
CP_XML_ATTR(L"baseType", L"variant");
|
||||
|
||||
CP_XML_NODE(L"vt:variant")
|
||||
{
|
||||
CP_XML_ATTR(L"vt:lpstr", L"Theme");
|
||||
}
|
||||
CP_XML_NODE(L"vt:variant")
|
||||
{
|
||||
CP_XML_ATTR(L"vt:i4", m_pDocument->m_arThemes.size());
|
||||
}
|
||||
CP_XML_NODE(L"vt:variant")
|
||||
{
|
||||
CP_XML_ATTR(L"vt:lpstr", L"Slide Titles");
|
||||
}
|
||||
CP_XML_NODE(L"vt:variant")
|
||||
{
|
||||
CP_XML_ATTR(L"vt:i4", m_pDocument->m_arSlides.size());
|
||||
}
|
||||
CP_XML_STREAM() << sApplication;
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"TitlesOfParts")
|
||||
{
|
||||
CP_XML_NODE(L"vt:vector")
|
||||
//CP_XML_NODE(L"AppVersion")
|
||||
//{
|
||||
// CP_XML_STREAM() << L"1.0";
|
||||
//}
|
||||
CP_XML_NODE(L"Paragraphs")
|
||||
{
|
||||
CP_XML_ATTR(L"size", m_pDocument->m_arSlides.size() + m_pDocument->m_arThemes.size());
|
||||
CP_XML_ATTR(L"baseType", L"lpstr");
|
||||
|
||||
for (size_t i = 1; i <= m_pDocument->m_arThemes.size(); ++i)
|
||||
{
|
||||
CP_XML_NODE(L"vt:lpstr")
|
||||
{
|
||||
CP_XML_STREAM() << L"Theme " << i;
|
||||
}
|
||||
}
|
||||
for (size_t i = 1; i <= m_pDocument->m_arSlides.size(); ++i)
|
||||
{
|
||||
CP_XML_NODE(L"vt:lpstr")
|
||||
{
|
||||
CP_XML_STREAM() << L"Slide " << i;
|
||||
}
|
||||
}
|
||||
CP_XML_STREAM() << 0;
|
||||
}
|
||||
}
|
||||
//CP_XML_NODE(L"PresentationFormat")
|
||||
//{
|
||||
// CP_XML_STREAM() << L"On-screen Show (4:3)";
|
||||
//}
|
||||
//CP_XML_NODE(L"Slides")
|
||||
//{
|
||||
// CP_XML_STREAM() << m_pDocument->m_arSlides.size();
|
||||
//}
|
||||
//CP_XML_NODE(L"Notes")
|
||||
//{
|
||||
// CP_XML_STREAM() << m_pDocument->m_arNotes.size();
|
||||
//}
|
||||
//CP_XML_NODE(L"HiddenSlides")
|
||||
//{
|
||||
// CP_XML_STREAM() << 0;
|
||||
//}
|
||||
//CP_XML_NODE(L"MMClips")
|
||||
//{
|
||||
// CP_XML_STREAM() << 0;
|
||||
//}
|
||||
//CP_XML_NODE(L"ScaleCrop")
|
||||
//{
|
||||
// CP_XML_STREAM() << L"false";
|
||||
//}
|
||||
//CP_XML_NODE(L"HeadingPairs")
|
||||
//{
|
||||
// CP_XML_NODE(L"vt:vector")
|
||||
// {
|
||||
// CP_XML_ATTR(L"size", 4);
|
||||
// CP_XML_ATTR(L"baseType", L"variant");
|
||||
//
|
||||
// CP_XML_NODE(L"vt:variant")
|
||||
// {
|
||||
// CP_XML_NODE(L"vt:lpstr")
|
||||
// {
|
||||
// CP_XML_STREAM() << L"Theme";
|
||||
// }
|
||||
// }
|
||||
// CP_XML_NODE(L"vt:variant")
|
||||
// {
|
||||
// CP_XML_NODE(L"vt:i4")
|
||||
// {
|
||||
// CP_XML_STREAM() << m_pDocument->m_arThemes.size();
|
||||
// }
|
||||
// }
|
||||
// CP_XML_NODE(L"vt:variant")
|
||||
// {
|
||||
// CP_XML_NODE(L"vt:lpstr")
|
||||
// {
|
||||
// CP_XML_STREAM() << L"Slide Titles";
|
||||
// }
|
||||
// }
|
||||
// CP_XML_NODE(L"vt:variant")
|
||||
// {
|
||||
// CP_XML_NODE(L"vt:i4")
|
||||
// CP_XML_STREAM() << m_pDocument->m_arSlides.size();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//CP_XML_NODE(L"TitlesOfParts")
|
||||
//{
|
||||
// CP_XML_NODE(L"vt:vector")
|
||||
// {
|
||||
// CP_XML_ATTR(L"size", m_pDocument->m_arSlides.size() + m_pDocument->m_arThemes.size());
|
||||
// CP_XML_ATTR(L"baseType", L"lpstr");
|
||||
|
||||
CP_XML_NODE(L"Company");
|
||||
CP_XML_NODE(L"LinksUpToDate")
|
||||
{
|
||||
CP_XML_STREAM() << L"false";
|
||||
}
|
||||
CP_XML_NODE(L"SharedDoc")
|
||||
{
|
||||
CP_XML_STREAM() << L"false";
|
||||
}
|
||||
CP_XML_NODE(L"HyperlinksChanged")
|
||||
{
|
||||
CP_XML_STREAM() << L"false";
|
||||
// for (size_t i = 1; i <= m_pDocument->m_arThemes.size(); ++i)
|
||||
// {
|
||||
// CP_XML_NODE(L"vt:lpstr")
|
||||
// {
|
||||
// CP_XML_STREAM() << L"Theme " << i;
|
||||
// }
|
||||
// }
|
||||
// for (size_t i = 1; i <= m_pDocument->m_arSlides.size(); ++i)
|
||||
// {
|
||||
// CP_XML_NODE(L"vt:lpstr")
|
||||
// {
|
||||
// CP_XML_STREAM() << L"Slide " << i;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
////CP_XML_NODE(L"Company");
|
||||
//CP_XML_NODE(L"LinksUpToDate")
|
||||
//{
|
||||
// CP_XML_STREAM() << L"false";
|
||||
//}
|
||||
//CP_XML_NODE(L"SharedDoc")
|
||||
//{
|
||||
// CP_XML_STREAM() << L"false";
|
||||
//}
|
||||
//CP_XML_NODE(L"HyperlinksChanged")
|
||||
//{
|
||||
// CP_XML_STREAM() << L"false";
|
||||
//}
|
||||
}
|
||||
}
|
||||
oFile.WriteStringUTF8(L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");
|
||||
@ -577,14 +590,14 @@ void NSPresentationEditor::CPPTXWriter::WriteThemes()
|
||||
|
||||
for (size_t i = 0; i < m_pDocument->m_arThemes.size(); i++)
|
||||
{
|
||||
WriteTheme(&m_pDocument->m_arThemes[i], nIndexTheme, nStartLayout, 1);
|
||||
WriteTheme(&m_pDocument->m_arThemes[i], nIndexTheme, nStartLayout);
|
||||
}
|
||||
|
||||
WriteTheme(m_pDocument->m_pNotesMaster, nIndexTheme, nStartLayout, 2);
|
||||
WriteTheme(m_pDocument->m_pHandoutMaster, nIndexTheme, nStartLayout, 3);
|
||||
WriteTheme(m_pDocument->m_pNotesMaster, nIndexTheme, nStartLayout);
|
||||
WriteTheme(m_pDocument->m_pHandoutMaster, nIndexTheme, nStartLayout);
|
||||
}
|
||||
|
||||
void NSPresentationEditor::CPPTXWriter::WriteTheme(CTheme* pTheme, int & nIndexTheme, int & nStartLayout, int Type)
|
||||
void NSPresentationEditor::CPPTXWriter::WriteTheme(CTheme* pTheme, int & nIndexTheme, int & nStartLayout)
|
||||
{
|
||||
if (!pTheme) return;
|
||||
|
||||
@ -665,15 +678,15 @@ void NSPresentationEditor::CPPTXWriter::WriteTheme(CTheme* pTheme, int & nIndexT
|
||||
CStringWriter oWriter;
|
||||
oWriter.WriteString(L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>");
|
||||
|
||||
if (Type == 1)
|
||||
if (pTheme->m_eType == typeMaster)
|
||||
{
|
||||
oWriter.WriteString(L"<p:sldMaster xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:p=\"http://schemas.openxmlformats.org/presentationml/2006/main\">");
|
||||
}
|
||||
else if (Type == 2)
|
||||
else if (pTheme->m_eType == typeNotesMaster)
|
||||
{
|
||||
oWriter.WriteString(L"<p:notesMaster xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:p=\"http://schemas.openxmlformats.org/presentationml/2006/main\">");
|
||||
}
|
||||
else if (Type == 3)
|
||||
else if (pTheme->m_eType == typeHandoutMaster)
|
||||
{
|
||||
oWriter.WriteString(L"<p:handoutMaster xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:p=\"http://schemas.openxmlformats.org/presentationml/2006/main\">");
|
||||
}
|
||||
@ -688,12 +701,22 @@ void NSPresentationEditor::CPPTXWriter::WriteTheme(CTheme* pTheme, int & nIndexT
|
||||
|
||||
for (size_t nEl = 0; nEl < pTheme->m_arElements.size(); ++nEl)
|
||||
{
|
||||
if (!pTheme->m_arElements[nEl]) continue;
|
||||
|
||||
if (isBodyPlaceholder(pTheme->m_arElements[nEl]->m_lPlaceholderType))
|
||||
pTheme->m_arElements[nEl]->m_lPlaceholderType =100; //body тип прописывать !!
|
||||
pTheme->m_arElements[nEl]->m_lPlaceholderType = 100; //body тип прописывать !!
|
||||
|
||||
if (pTheme->m_arElements[nEl]->m_bBoundsEnabled == false)
|
||||
continue;
|
||||
|
||||
if (pTheme->m_eType == typeNotesMaster ||
|
||||
pTheme->m_eType == typeHandoutMaster)
|
||||
{
|
||||
pTheme->m_arElements[nEl]->m_lPlaceholderID = -1;
|
||||
|
||||
if (pTheme->m_eType == typeHandoutMaster)
|
||||
pTheme->m_arElements[nEl]->m_lPlaceholderSizePreset = -1;
|
||||
}
|
||||
WriteElement(oWriter, oRels, pTheme->m_arElements[nEl]);
|
||||
}
|
||||
|
||||
@ -702,7 +725,7 @@ void NSPresentationEditor::CPPTXWriter::WriteTheme(CTheme* pTheme, int & nIndexT
|
||||
std::wstring strOverrideColorScheme = _T("<p:clrMap bg1=\"lt1\" tx1=\"dk1\" bg2=\"lt2\" tx2=\"dk2\" accent1=\"accent1\" accent2=\"accent2\" accent3=\"accent3\" accent4=\"accent4\" accent5=\"accent5\" accent6=\"accent6\" hlink=\"hlink\" folHlink=\"folHlink\"/>");
|
||||
oWriter.WriteString(strOverrideColorScheme);
|
||||
|
||||
if (Type == 1)
|
||||
if (pTheme->m_eType == typeMaster)
|
||||
{
|
||||
oWriter.WriteString(std::wstring(L"<p:sldLayoutIdLst>"));
|
||||
|
||||
@ -726,7 +749,7 @@ void NSPresentationEditor::CPPTXWriter::WriteTheme(CTheme* pTheme, int & nIndexT
|
||||
if (!pTheme->m_bHasFooter) oWriter.WriteString(std::wstring(L" ftr=\"0\""));
|
||||
oWriter.WriteString(std::wstring(L"/>"));
|
||||
}
|
||||
if (Type == 1)
|
||||
if (pTheme->m_eType == typeMaster)
|
||||
{
|
||||
oWriter.WriteString(std::wstring(L"<p:txStyles>"));
|
||||
|
||||
@ -744,7 +767,7 @@ void NSPresentationEditor::CPPTXWriter::WriteTheme(CTheme* pTheme, int & nIndexT
|
||||
|
||||
oWriter.WriteString(std::wstring(L"</p:txStyles>"));
|
||||
}
|
||||
else if (Type == 2)
|
||||
else if (pTheme->m_eType == typeNotesMaster)
|
||||
{
|
||||
oWriter.WriteString(std::wstring(L"<p:notesStyle>"));
|
||||
CStylesWriter::ConvertStyles(pTheme->m_pStyles[1], pTheme->m_oInfo, oWriter, 9);
|
||||
@ -753,7 +776,8 @@ void NSPresentationEditor::CPPTXWriter::WriteTheme(CTheme* pTheme, int & nIndexT
|
||||
|
||||
std::wstring strSlideMasterFile;
|
||||
std::wstring strSlideMasterRelsFile;
|
||||
if (Type == 1)
|
||||
|
||||
if (pTheme->m_eType == typeMaster)
|
||||
{
|
||||
oWriter.WriteString(std::wstring(L"</p:sldMaster>"));
|
||||
|
||||
@ -763,7 +787,7 @@ void NSPresentationEditor::CPPTXWriter::WriteTheme(CTheme* pTheme, int & nIndexT
|
||||
strSlideMasterRelsFile = L"slideMaster" + std::to_wstring(nIndexTheme + 1) + L".xml.rels";
|
||||
strSlideMasterRelsFile = strPptDirectory + _T("slideMasters") + FILE_SEPARATOR_STR + _T("_rels") + FILE_SEPARATOR_STR + strSlideMasterRelsFile;
|
||||
}
|
||||
else if (Type == 2)
|
||||
else if (pTheme->m_eType == typeNotesMaster)
|
||||
{
|
||||
oWriter.WriteString(std::wstring(L"</p:notesMaster>"));
|
||||
|
||||
@ -773,7 +797,7 @@ void NSPresentationEditor::CPPTXWriter::WriteTheme(CTheme* pTheme, int & nIndexT
|
||||
strSlideMasterRelsFile = L"notesMaster1.xml.rels";
|
||||
strSlideMasterRelsFile = strPptDirectory + _T("notesMasters") + FILE_SEPARATOR_STR + _T("_rels") + FILE_SEPARATOR_STR + strSlideMasterRelsFile;
|
||||
}
|
||||
else if (Type == 3)
|
||||
else if (pTheme->m_eType == typeHandoutMaster)
|
||||
{
|
||||
oWriter.WriteString(std::wstring(L"</p:handoutMaster>"));
|
||||
|
||||
@ -933,6 +957,11 @@ void NSPresentationEditor::CPPTXWriter::WriteLayout(CLayout& oLayout, int nIndex
|
||||
size_t nElements = oLayout.m_arElements.size();
|
||||
for (size_t nEl = 0; nEl < nElements; ++nEl)
|
||||
{
|
||||
if (!oLayout.m_arElements[nEl])
|
||||
continue;
|
||||
|
||||
oLayout.m_arElements[nEl]->m_lPlaceholderSizePreset = -1;
|
||||
|
||||
WriteElement(oWriter, oRels, oLayout.m_arElements[nEl]);
|
||||
}
|
||||
|
||||
|
||||
@ -72,7 +72,7 @@ namespace NSPresentationEditor
|
||||
void WritePresInfo ();
|
||||
void WriteAll ();
|
||||
void WriteThemes ();
|
||||
void WriteTheme (CTheme* pTheme, int & nIndexTheme, int & nStartLayout, int Type = 1);
|
||||
void WriteTheme (CTheme* pTheme, int & nIndexTheme, int & nStartLayout);
|
||||
void WriteSlides ();
|
||||
void WriteNotes ();
|
||||
void WriteLayout (CLayout& oLayout, int nIndexLayout, int nStartLayout, int nIndexTheme);
|
||||
|
||||
@ -35,6 +35,11 @@
|
||||
#include "../../../ASCOfficeXlsFile2/source/XlsXlsxConverter/ShapeType.h"
|
||||
#include "../../../Common/MS-LCID.h"
|
||||
|
||||
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/SpTreeElem.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Shape.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/SpTree.h"
|
||||
|
||||
#ifndef EMU_MM
|
||||
#define EMU_MM 36000.0
|
||||
#endif
|
||||
@ -307,6 +312,10 @@ bool NSPresentationEditor::CShapeWriter::SetElement(CElementPtr pElem)
|
||||
m_bWordArt = false;
|
||||
m_bTextBox = false;
|
||||
|
||||
m_xmlGeomAlternative.clear();
|
||||
m_xmlTxBodyAlternative.clear();
|
||||
m_xmlAlternative.clear();
|
||||
|
||||
if (m_pShapeElement)
|
||||
{
|
||||
m_pShapeElement->m_pShape->GetTextRect(m_oTextRect);
|
||||
@ -811,6 +820,13 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
|
||||
{
|
||||
size_t nCount = m_pShapeElement->m_pShape->m_oText.m_arParagraphs.size();
|
||||
|
||||
if (false == m_xmlTxBodyAlternative.empty())
|
||||
{
|
||||
m_oWriter.WriteString(m_xmlTxBodyAlternative);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_oWriter.WriteString(std::wstring(L"<p:txBody>"));
|
||||
|
||||
m_oWriter.WriteString(std::wstring(L"<a:bodyPr" ));
|
||||
@ -1227,6 +1243,59 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
|
||||
m_oWriter.WriteString(str5);
|
||||
}
|
||||
|
||||
void NSPresentationEditor::CShapeWriter::ParseXmlAlternative(const std::wstring & xml)
|
||||
{
|
||||
XmlUtils::CXmlLiteReader oReader;
|
||||
|
||||
if ( !oReader.FromString( xml ) )
|
||||
return;
|
||||
if ( !oReader.ReadNextNode() )
|
||||
return;
|
||||
|
||||
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
|
||||
|
||||
nullable<PPTX::Logic::SpTreeElem> oElement;
|
||||
|
||||
if ( L"graphicFrame" == sName || L"pic" == sName || L"sp" == sName || L"grpSp" == sName || L"cxnSp" == sName || L"AlternateContent" == sName
|
||||
|| L"spTree" )
|
||||
{
|
||||
oElement = oReader;
|
||||
}
|
||||
|
||||
if (oElement.IsInit())
|
||||
{
|
||||
smart_ptr<PPTX::Logic::Shape> shape = oElement->GetElem().smart_dynamic_cast<PPTX::Logic::Shape>();
|
||||
if (shape.IsInit())
|
||||
{
|
||||
NSBinPptxRW::CXmlWriter writer(XMLWRITER_DOC_TYPE_PPTX);
|
||||
shape->spPr.Geometry.toXmlWriter(&writer);
|
||||
|
||||
if (shape->spPr.scene3d.IsInit())
|
||||
shape->spPr.scene3d->toXmlWriter(&writer);
|
||||
|
||||
if (shape->spPr.sp3d.IsInit())
|
||||
shape->spPr.sp3d->toXmlWriter(&writer);
|
||||
|
||||
m_xmlGeomAlternative = writer.GetXmlString();
|
||||
|
||||
writer.ClearNoAttack();
|
||||
if ((shape->txBody.IsInit()) && (shape->txBody->bodyPr.IsInit()) && (shape->txBody->bodyPr->prstTxWarp.IsInit()))
|
||||
{//только WordArt
|
||||
shape->txBody->toXmlWriter(&writer);
|
||||
m_xmlTxBodyAlternative = writer.GetXmlString();
|
||||
}
|
||||
}
|
||||
smart_ptr<PPTX::Logic::SpTree> groupShape = oElement->GetElem().smart_dynamic_cast<PPTX::Logic::SpTree>();
|
||||
if (groupShape.IsInit())
|
||||
{//smartArt
|
||||
NSBinPptxRW::CXmlWriter writer(XMLWRITER_DOC_TYPE_PPTX);
|
||||
groupShape->toXmlWriter(&writer);
|
||||
|
||||
m_xmlAlternative = writer.GetXmlString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::wstring NSPresentationEditor::CShapeWriter::ConvertShape()
|
||||
{
|
||||
if (m_pImageElement) return ConvertImage();
|
||||
@ -1256,6 +1325,12 @@ std::wstring NSPresentationEditor::CShapeWriter::ConvertShape()
|
||||
m_pShapeElement->m_bLine = true;
|
||||
}
|
||||
|
||||
|
||||
if (m_pShapeElement->m_pShape && !m_pShapeElement->m_pShape->m_strXmlString.empty())
|
||||
{
|
||||
ParseXmlAlternative(m_pShapeElement->m_pShape->m_strXmlString);
|
||||
}
|
||||
|
||||
m_oWriter.WriteString(std::wstring(L"<p:sp>"));
|
||||
|
||||
WriteShapeInfo();
|
||||
@ -1313,30 +1388,37 @@ std::wstring NSPresentationEditor::CShapeWriter::ConvertShape()
|
||||
m_pShapeElement->m_pShape->ToRenderer(dynamic_cast<IRenderer*>(this), oInfo, m_oMetricInfo, 0.0, 1.0);
|
||||
}
|
||||
|
||||
if ((prstGeom.empty() == false || m_pShapeElement->m_bShapePreset) && prstTxWarp.empty() && !shape->m_bCustomShape)
|
||||
if (!m_xmlGeomAlternative.empty())
|
||||
{
|
||||
if (prstGeom.empty()) prstGeom = L"rect";
|
||||
m_oWriter.WriteString(std::wstring(L"<a:prstGeom"));
|
||||
{
|
||||
m_oWriter.WriteString(std::wstring(L" prst=\"") + prstGeom + std::wstring(L"\">"));
|
||||
if (!m_bWordArt)
|
||||
{
|
||||
m_oWriter.WriteString(std::wstring(L"<a:avLst/>"));
|
||||
}
|
||||
}
|
||||
m_oWriter.WriteString(std::wstring(L"</a:prstGeom>"));
|
||||
}
|
||||
else if (prstTxWarp.empty())
|
||||
{
|
||||
m_oWriter.WriteString(m_pShapeElement->ConvertPPTShapeToPPTX());
|
||||
m_oWriter.WriteString(m_xmlGeomAlternative);
|
||||
}
|
||||
else
|
||||
{
|
||||
//word art
|
||||
m_oWriter.WriteString(std::wstring(L"<a:prstGeom prst=\"rect\"/>"));
|
||||
if ((prstGeom.empty() == false || m_pShapeElement->m_bShapePreset) && prstTxWarp.empty() && !shape->m_bCustomShape)
|
||||
{
|
||||
if (prstGeom.empty()) prstGeom = L"rect";
|
||||
m_oWriter.WriteString(std::wstring(L"<a:prstGeom"));
|
||||
{
|
||||
m_oWriter.WriteString(std::wstring(L" prst=\"") + prstGeom + std::wstring(L"\">"));
|
||||
if (!m_bWordArt)
|
||||
{
|
||||
m_oWriter.WriteString(std::wstring(L"<a:avLst/>"));
|
||||
}
|
||||
}
|
||||
m_oWriter.WriteString(std::wstring(L"</a:prstGeom>"));
|
||||
}
|
||||
else if (prstTxWarp.empty())
|
||||
{
|
||||
m_oWriter.WriteString(m_pShapeElement->ConvertPPTShapeToPPTX());
|
||||
}
|
||||
else
|
||||
{
|
||||
//word art
|
||||
m_oWriter.WriteString(std::wstring(L"<a:prstGeom prst=\"rect\"/>"));
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_bWordArt)
|
||||
if (false == m_bWordArt)
|
||||
{
|
||||
m_oWriter.WriteString(ConvertBrush(m_pShapeElement->m_oBrush));
|
||||
if (m_pShapeElement->m_bLine)
|
||||
|
||||
@ -138,6 +138,8 @@ namespace NSPresentationEditor
|
||||
class CShapeWriter : public IRenderer
|
||||
{
|
||||
private:
|
||||
void ParseXmlAlternative(const std::wstring & xml);
|
||||
|
||||
NSPresentationEditor::CStringWriter m_oWriterPath;
|
||||
NSPresentationEditor::CStringWriter m_oWriterVML;
|
||||
NSPresentationEditor::CStringWriter m_oWriter;
|
||||
@ -154,6 +156,10 @@ namespace NSPresentationEditor
|
||||
|
||||
bool m_bWordArt;
|
||||
bool m_bTextBox;
|
||||
|
||||
std::wstring m_xmlGeomAlternative;
|
||||
std::wstring m_xmlTxBodyAlternative;
|
||||
std::wstring m_xmlAlternative;
|
||||
public:
|
||||
|
||||
CShapeWriter();
|
||||
|
||||
@ -1559,7 +1559,7 @@ void CPPTUserInfo::LoadMasters(const LONG& lOriginWidth, const LONG& lOriginHeig
|
||||
{
|
||||
std::map<DWORD, CRecordSlide*>::iterator pPair = m_mapNotesMasters.begin();
|
||||
|
||||
LoadMaster(pPair->second, m_pNotesMasterWrapper, m_pNotesMaster);
|
||||
LoadMaster(typeNotesMaster, pPair->second, m_pNotesMasterWrapper, m_pNotesMaster);
|
||||
}
|
||||
|
||||
LoadHandoutMasterFromPrevUsers(0);
|
||||
@ -1567,10 +1567,10 @@ void CPPTUserInfo::LoadMasters(const LONG& lOriginWidth, const LONG& lOriginHeig
|
||||
{
|
||||
std::map<DWORD, CRecordSlide*>::iterator pPair = m_mapHandoutMasters.begin();
|
||||
|
||||
LoadMaster(pPair->second, m_pHandoutMasterWrapper, m_pHandoutMaster);
|
||||
LoadMaster(typeHandoutMaster, pPair->second, m_pHandoutMasterWrapper, m_pHandoutMaster);
|
||||
}
|
||||
}
|
||||
void CPPTUserInfo::LoadMaster(CRecordSlide* pMaster, CSlideInfo *& pMasterWrapper, CTheme *& pTheme)
|
||||
void CPPTUserInfo::LoadMaster(_typeMaster type, CRecordSlide* pMaster, CSlideInfo *& pMasterWrapper, CTheme *& pTheme)
|
||||
{
|
||||
if (pMaster == NULL)
|
||||
return;
|
||||
@ -1609,7 +1609,7 @@ void CPPTUserInfo::LoadMaster(CRecordSlide* pMaster, CSlideInfo *& pMasterWrappe
|
||||
}
|
||||
}
|
||||
|
||||
pTheme = new CTheme();
|
||||
pTheme = new CTheme(type);
|
||||
|
||||
pTheme->m_lOriginalWidth = lOriginWidth;
|
||||
pTheme->m_lOriginalHeight = lOriginHeight;
|
||||
@ -1970,8 +1970,8 @@ void CPPTUserInfo::LoadNoMainMaster(DWORD dwMasterID, const LONG& lOriginWidth,
|
||||
{
|
||||
if (pElement->m_lPlaceholderID >=0)
|
||||
{
|
||||
if (pElement->m_lPlaceholderType == MasterSlideNumber) pLayout->m_bHasSlideNumber = true;
|
||||
if (pElement->m_lPlaceholderType == MasterDate) pLayout->m_bHasDate = true;
|
||||
if (pElement->m_lPlaceholderType == MasterSlideNumber) pLayout->m_bHasSlideNumber = true;
|
||||
if (pElement->m_lPlaceholderType == MasterDate) pLayout->m_bHasDate = true;
|
||||
if (pElement->m_lPlaceholderType == MasterFooter) pLayout->m_bHasFooter = true;
|
||||
}
|
||||
pLayout->m_mapPlaceholders.insert(std::pair<int, int>(pElement->m_lPlaceholderType, pLayout->m_arElements.size()-1));
|
||||
|
||||
@ -44,6 +44,7 @@ using namespace NSPresentationEditor;
|
||||
class CPPTUserInfo : public CDocument
|
||||
{
|
||||
public:
|
||||
|
||||
CUserEdit m_oUser;
|
||||
std::map<DWORD, DWORD> m_mapOffsetInPIDs;
|
||||
CRecordDocument m_oDocument;
|
||||
@ -145,7 +146,7 @@ public:
|
||||
void LoadNoMainMaster (DWORD dwMasterID, const LONG& lOriginWidth, const LONG& lOriginHeight);
|
||||
void LoadMainMaster (DWORD dwMasterID, const LONG& lOriginWidth, const LONG& lOriginHeight);
|
||||
|
||||
void LoadMaster(CRecordSlide* pMaster, CSlideInfo *& pMasterWrapper, CTheme *& pTheme);
|
||||
void LoadMaster(_typeMaster type, CRecordSlide* pMaster, CSlideInfo *& pMasterWrapper, CTheme *& pTheme);
|
||||
|
||||
void LoadSlideFromPrevUsers (DWORD dwSlideID);
|
||||
void LoadMasterFromPrevUsers (DWORD dwSlideID);
|
||||
|
||||
2405
ASCOfficePPTFile/PPTFormatLib/Records/Drawing/ShapeContainer.cpp
Normal file
2405
ASCOfficePPTFile/PPTFormatLib/Records/Drawing/ShapeContainer.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -68,14 +68,6 @@ EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpsd", "..\..\DesktopEditor\cximage\libpsd\libpsd_vs2005.vcproj", "{9A037A69-D1DF-4505-AB2A-6CB3641C476E}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PPTFormatLib", "..\PPTFormatLib\Win32\PPTFormatLib.vcproj", "{7B27E40E-F70A-4A74-A77C-0944D7931D15}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{21663823-DE45-479B-91D0-B4FEF4916EF0} = {21663823-DE45-479B-91D0-B4FEF4916EF0}
|
||||
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} = {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}
|
||||
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} = {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}
|
||||
{C739151F-5384-41DF-A1A6-F089E2C1AD56} = {C739151F-5384-41DF-A1A6-F089E2C1AD56}
|
||||
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
|
||||
{36636678-AE25-4BE6-9A34-2561D1BCF302} = {36636678-AE25-4BE6-9A34-2561D1BCF302}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jbig", "..\..\DesktopEditor\cximage\jbig\jbig_vs2005.vcproj", "{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}"
|
||||
EndProject
|
||||
@ -85,15 +77,15 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OfficeUtilsLib", "..\..\Off
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PptFormatTest", "PptFormatTest.vcproj", "{0F49D5D1-A8D3-4F97-8BC1-E2F65BB00C10}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{7B27E40E-F70A-4A74-A77C-0944D7931D15} = {7B27E40E-F70A-4A74-A77C-0944D7931D15}
|
||||
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF} = {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}
|
||||
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C} = {C27E9A9F-3A17-4482-9C5F-BF15C01E747C}
|
||||
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} = {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}
|
||||
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} = {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}
|
||||
{36636678-AE25-4BE6-9A34-2561D1BCF302} = {36636678-AE25-4BE6-9A34-2561D1BCF302}
|
||||
{F8274B05-168E-4D6E-B843-AA7510725363} = {F8274B05-168E-4D6E-B843-AA7510725363}
|
||||
{21663823-DE45-479B-91D0-B4FEF4916EF0} = {21663823-DE45-479B-91D0-B4FEF4916EF0}
|
||||
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF} = {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}
|
||||
{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D} = {77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}
|
||||
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C} = {C27E9A9F-3A17-4482-9C5F-BF15C01E747C}
|
||||
{36636678-AE25-4BE6-9A34-2561D1BCF302} = {36636678-AE25-4BE6-9A34-2561D1BCF302}
|
||||
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} = {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}
|
||||
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
|
||||
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} = {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}
|
||||
{7B27E40E-F70A-4A74-A77C-0944D7931D15} = {7B27E40E-F70A-4A74-A77C-0944D7931D15}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libxml2", "..\..\DesktopEditor\xml\build\vs2005\libxml2.vcproj", "{21663823-DE45-479B-91D0-B4FEF4916EF0}"
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../DesktopEditor/xml/build/vs2005;../../DesktopEditor/xml/libxml2/include"
|
||||
AdditionalIncludeDirectories="../../DesktopEditor/xml/build/vs2005;../../DesktopEditor/xml/libxml2/include;"../../DesktopEditor/freetype-2.5.2/include""
|
||||
PreprocessorDefinitions="_DEBUG;_CONSOLE;_USE_MATH_DEFINES;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;_PRESENTATION_WRITER_;_SVG_CONVERT_TO_IMAGE_;DONT_WRITE_EMBEDDED_FONTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
|
||||
Reference in New Issue
Block a user