Compare commits

...

12 Commits

Author SHA1 Message Date
8efed345b0 fix bug #35412 2017-07-24 17:32:31 +03:00
f5dcb1bed7 Merge branch 'hotfix/v4.4.2' into develop
Conflicts:
	ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertDrawing.cpp
2017-07-24 15:46:05 +03:00
6b4695fc3a . 2017-07-24 15:06:01 +03:00
bed884007c PptxFormat - slide sections 2017-07-23 16:38:57 +03:00
1aa0b03901 XlsFormat - fix pivots after testing 2017-07-21 19:41:26 +03:00
e2ada4ca61 Merge commit '08e97b4a68950d969dce001f8e1ead84086c0244' into develop 2017-07-21 18:40:26 +03:00
d87649f08e no message 2017-07-21 18:37:34 +03:00
3982ac06d2 Merge pull request #35 from ONLYOFFICE/feature/lena_fix_2
fix not compiled
2017-07-21 17:38:16 +03:00
0a5d0af882 fix not compiled 2017-07-21 17:36:56 +03:00
08e97b4a68 Merge pull request #34 from ONLYOFFICE/feature/lenas-fixes
Feature/lenas fixes
2017-07-21 16:21:05 +03:00
c4447d7396 fix bug #35395 2017-07-21 16:12:28 +03:00
333d2fdbf0 fix 2017-07-21 15:36:47 +03:00
17 changed files with 601 additions and 168 deletions

View File

@ -594,8 +594,17 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle*
convert(oox_spPr->xfrm.GetPointer());
PPTX::Logic::PrstGeom* prstGeom = &oox_spPr->Geometry.as<PPTX::Logic::PrstGeom>();
PPTX::Logic::CustGeom* custGeom = &oox_spPr->Geometry.as<PPTX::Logic::CustGeom>();
PPTX::Logic::PrstGeom* prstGeom = NULL;
PPTX::Logic::CustGeom* custGeom = NULL;
if (oox_spPr->Geometry.is<PPTX::Logic::PrstGeom>())
{
prstGeom = &oox_spPr->Geometry.as<PPTX::Logic::PrstGeom>();
}
if (oox_spPr->Geometry.is<PPTX::Logic::CustGeom>())
{
custGeom = &oox_spPr->Geometry.as<PPTX::Logic::CustGeom>();
}
convert(prstGeom);
convert(custGeom);
@ -627,8 +636,13 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle*
}
odf_context()->drawing_context()->end_line_properties();
//-----------------------------------------------------------------------------------------------------------------------------
PPTX::Logic::EffectLst* effectLst = &oox_spPr->EffectList.as<PPTX::Logic::EffectLst>();
PPTX::Logic::EffectLst* effectLst = NULL;
if (oox_spPr->EffectList.is<PPTX::Logic::EffectLst>())
{
effectLst = &oox_spPr->EffectList.as<PPTX::Logic::EffectLst>();
}
if (effectLst) convert(effectLst);
else if (oox_sp_style) convert(&oox_sp_style->effectRef, 3);
@ -642,20 +656,14 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle*
void OoxConverter::convert(PPTX::Logic::UniFill *oox_fill, DWORD nARGB)
{
if (oox_fill == NULL) return;
PPTX::Logic::NoFill* noFill = &oox_fill->as<PPTX::Logic::NoFill>();
PPTX::Logic::BlipFill* blipFill = &oox_fill->as<PPTX::Logic::BlipFill>();
PPTX::Logic::GradFill* gradFill = &oox_fill->as<PPTX::Logic::GradFill>();
PPTX::Logic::SolidFill* solidFill = &oox_fill->as<PPTX::Logic::SolidFill>();
PPTX::Logic::PattFill* pattFill = &oox_fill->as<PPTX::Logic::PattFill>();
if (oox_fill == NULL) return;
if (solidFill) convert(solidFill, nARGB);
else if (blipFill) convert(blipFill);
else if (gradFill) convert(gradFill, nARGB);
else if (pattFill) convert(pattFill, nARGB);
else if (noFill) odf_context()->drawing_context()->set_no_fill();
if (oox_fill->is<PPTX::Logic::NoFill>()) odf_context()->drawing_context()->set_no_fill();
if (oox_fill->is<PPTX::Logic::BlipFill>()) convert(&oox_fill->as<PPTX::Logic::BlipFill>());
if (oox_fill->is<PPTX::Logic::GradFill>()) convert(&oox_fill->as<PPTX::Logic::GradFill>(), nARGB);
if (oox_fill->is<PPTX::Logic::SolidFill>()) convert(&oox_fill->as<PPTX::Logic::SolidFill>(),nARGB);
if (oox_fill->is<PPTX::Logic::PattFill>()) convert(&oox_fill->as<PPTX::Logic::PattFill>(), nARGB);
}
int OoxConverter::convert(PPTX::Logic::PrstTxWarp *oox_text_preset)
@ -783,8 +791,10 @@ void OoxConverter::convert(PPTX::Logic::Path2D *oox_geom_path)
for (size_t i = 0 ; i < oox_geom_path->Paths.size(); i++)
{
PPTX::Logic::PathBase* pathBase = &oox_geom_path->Paths[i].Path2D.as<PPTX::Logic::PathBase>();
convert(pathBase);
if (oox_geom_path->Paths[i].Path2D.is<PPTX::Logic::PathBase>())
{
convert(&oox_geom_path->Paths[i].Path2D.as<PPTX::Logic::PathBase>());
}
}
if (oox_geom_path->stroke.IsInit() && *oox_geom_path->stroke == false)
@ -1692,12 +1702,21 @@ void OoxConverter::convert(PPTX::Logic::RunProperties *oox_run_pr, odf_writer::s
_CP_OPT(double) opacityText;
std::wstring hexColorText;
PPTX::Logic::GradFill* gradFill = &oox_run_pr->Fill.as<PPTX::Logic::GradFill>();
PPTX::Logic::GradFill* gradFill = NULL;
PPTX::Logic::SolidFill* solidFill = NULL;
if (oox_run_pr->Fill.is<PPTX::Logic::GradFill>())
{
gradFill = &oox_run_pr->Fill.as<PPTX::Logic::GradFill>();
}
if (gradFill && !gradFill->GsLst.empty())
{
convert(&gradFill->GsLst[0].color, hexColorText, opacityText);
}
PPTX::Logic::SolidFill* solidFill = &oox_run_pr->Fill.as<PPTX::Logic::SolidFill>();
if (oox_run_pr->Fill.is<PPTX::Logic::SolidFill>())
{
solidFill = &oox_run_pr->Fill.as<PPTX::Logic::SolidFill>();
}
if (solidFill)
{
convert(&solidFill->Color, hexColorText, opacityText);

View File

@ -4581,10 +4581,13 @@ std::wstring CDrawingConverter::SaveObjectBackground(LONG lStart, LONG lLength)
NSBinPptxRW::CXmlWriter oXmlWriter;
SaveObjectExWriterInit(oXmlWriter, XMLWRITER_DOC_TYPE_DOCX);
oXmlWriter.m_bIsTop = true; // не забыть скинуть в самом шейпе
PPTX::Logic::Shape& oShape = oElem.as<PPTX::Logic::Shape>();
oShape.toXmlWriterVMLBackground(&oXmlWriter, *m_pTheme, *m_pClrMap);
if (oElem.is<PPTX::Logic::Shape>())
{
oXmlWriter.m_bIsTop = true; // не забыть скинуть в самом шейпе
PPTX::Logic::Shape& oShape = oElem.as<PPTX::Logic::Shape>();
oShape.toXmlWriterVMLBackground(&oXmlWriter, *m_pTheme, *m_pClrMap);
}
--m_nCurrentIndexObject;
SaveObjectExWriterRelease(oXmlWriter);
@ -4606,18 +4609,26 @@ void CDrawingConverter::ConvertShapeVML(PPTX::Logic::SpTreeElem& oElem, const st
{
ConvertMainPropsToVML(bsMainProps, oWriter, oElem);
oWriter.m_bIsTop = true; // не забыть скинуть в самом шейпе
PPTX::Logic::Shape& oShape = oElem.as<PPTX::Logic::Shape>();
oShape.toXmlWriterVML(&oWriter, *m_pTheme, *m_pClrMap, false, bSignature);
if (oElem.is<PPTX::Logic::Shape>())
{
oWriter.m_bIsTop = true; // не забыть скинуть в самом шейпе
PPTX::Logic::Shape& oShape = oElem.as<PPTX::Logic::Shape>();
oShape.toXmlWriterVML(&oWriter, *m_pTheme, *m_pClrMap, false, bSignature);
}
}
void CDrawingConverter::ConvertGroupVML(PPTX::Logic::SpTreeElem& oElem, const std::wstring& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter)
{
ConvertMainPropsToVML(bsMainProps, oWriter, oElem);
oWriter.m_bIsTop = true; // не забыть скинуть в самом шейпе (вместе с остальными параметрами)
PPTX::Logic::SpTree& oGroup = oElem.as<PPTX::Logic::SpTree>();
oGroup.toXmlWriterVML(&oWriter, *m_pTheme, *m_pClrMap);
if (oElem.is<PPTX::Logic::SpTree>())
{
oWriter.m_bIsTop = true; // не забыть скинуть в самом шейпе (вместе с остальными параметрами)
PPTX::Logic::SpTree& oGroup = oElem.as<PPTX::Logic::SpTree>();
oGroup.toXmlWriterVML(&oWriter, *m_pTheme, *m_pClrMap);
}
}
void CDrawingConverter::ConvertTextVML(XmlUtils::CXmlNode &nodeTextBox, PPTX::Logic::Shape* pShape)
{

View File

@ -415,11 +415,10 @@ namespace NSBinPptxRW
LONG lLayouts = (LONG)m_arSlideMasters_Theme[i].m_arLayouts.size();
for (LONG j = 0; j < lLayouts; ++j)
{
arrLays.push_back(PPTX::Logic::XmlId());
arrLays.push_back(PPTX::Logic::XmlId(L"p:sldLayoutId"));
std::wstring sId = std::to_wstring((_UINT64)(0x80000000 + __nCountLayouts + j + 1));
arrLays[j].m_name = _T("sldLayoutId");
arrLays[j].id = sId;
arrLays[j].rid = (size_t)(j + 1);
}
@ -755,11 +754,10 @@ namespace NSBinPptxRW
LONG nCountLayouts = 0;
for (LONG i = 0; i < nCountMasters; ++i)
{
m_oPresentation.sldMasterIdLst.push_back(PPTX::Logic::XmlId());
m_oPresentation.sldMasterIdLst.push_back(PPTX::Logic::XmlId(L"p:sldMasterId"));
std::wstring sId = std::to_wstring((_UINT64)(0x80000000 + nCountLayouts));
m_oPresentation.sldMasterIdLst[i].m_name = _T("sldMasterId");
m_oPresentation.sldMasterIdLst[i].id = sId;
m_oPresentation.sldMasterIdLst[i].rid = (size_t)(i + 1);
nCountLayouts += (LONG)(m_arSlideMasters_Theme[i].m_arLayouts.size() + 1);
@ -773,11 +771,10 @@ namespace NSBinPptxRW
m_oPresentation.sldIdLst.clear();
for (LONG i = 0; i < nCountSlides; ++i)
{
m_oPresentation.sldIdLst.push_back(PPTX::Logic::XmlId());
m_oPresentation.sldIdLst.push_back(PPTX::Logic::XmlId(L"p:sldId"));
std::wstring sId = std::to_wstring(256 + i);
m_oPresentation.sldIdLst[i].m_name = _T("sldId");
m_oPresentation.sldIdLst[i].id = sId;
m_oPresentation.sldIdLst[i].rid = (size_t)nCurrentRels;
++nCurrentRels;
@ -788,8 +785,8 @@ namespace NSBinPptxRW
m_oPresentation.notesMasterIdLst.clear();
if (bNotesMasterPresent)
{
m_oPresentation.notesMasterIdLst.push_back(PPTX::Logic::XmlId());
m_oPresentation.notesMasterIdLst[0].m_name = _T("notesMasterId");
m_oPresentation.notesMasterIdLst.push_back(PPTX::Logic::XmlId(L"p:notesMasterId"));
m_oPresentation.notesMasterIdLst[0].rid = (size_t)nCurrentRels;
++nCurrentRels;
}

View File

@ -32,15 +32,15 @@
#ifndef PPTX_LOGIC_EXTP_PROPERTIES_INCLUDE_H_
#define PPTX_LOGIC_EXTP_PROPERTIES_INCLUDE_H_
#include "./../WrapperWritingElement.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/RId.h"
#include "../Presentation/SectionLst.h"
//--------------------------------------------------------------------------------------------------------------
//<p:ext uri="{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}">
//<p14:media xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" r:embed="rId2">
//<p14:trim st="93333.0816" end="96583.4816"/>
//</p14:media>
//</p:ext>
//--------------------------------------------------------------------------------------------------------------
//<ext uri="{05C60535-1F16-4fd2-B633-F4F36F0B64E0}" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main">
// <x14:sparklineGroups xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main">
// <x14:sparklineGroup displayEmptyCellsAs="gap">
@ -61,10 +61,33 @@
// </x14:sparklineGroup>
// </x14:sparklineGroups>
//</ext>
//--------------------------------------------------------------------------------------------------------------
//<a:ext uri="{63B3BB69-23CF-44E3-9099-C40C66FF867C}">
// <a14:compatExt spid="_x0000_s1025"/>
//</a:ext>
//--------------------------------------------------------------------------------------------------------------
// <p:ext uri="{521415D9-36F7-43E2-AB2F-B90AF26B5E84}">
// <p14:sectionLst xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main">
// <p14:section name="123" id="{775558AA-D529-4C59-9762-B6F3CDAC8092}">
// <p14:sldIdLst>
// <p14:sldId id="256"/>
// <p14:sldId id="257"/>
// </p14:sldIdLst>
// </p14:section>
// <p14:section name="qwerty" id="{296A3C58-7D47-4848-A546-3C86980BE927}">
// <p14:sldIdLst>
// <p14:sldId id="258"/>
// </p14:sldIdLst>
// </p14:section>
// <p14:section name="Раздел без заголовка" id="{DA908BF8-2A15-4E46-B49B-C1BB4B4AAF31}">
// <p14:sldIdLst/>
// </p14:section>
// </p14:sectionLst>
// </p:ext>
// <p:ext uri="{EFAFB233-063F-42B5-8137-9DF3F51BA10A}">
// <p15:sldGuideLst xmlns:p15="http://schemas.microsoft.com/office/powerpoint/2012/main"/>
// </p:ext>
//</p:extLst>
namespace PPTX
{
@ -115,48 +138,61 @@ namespace PPTX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("uri"), uri)
WritingElement_ReadAttributes_ReadSingle ( oReader, L"uri", uri)
WritingElement_ReadAttributes_End( oReader )
}
void ReadAttributes1(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("r:embed"), link)
WritingElement_ReadAttributes_ReadSingle( oReader, L"r:embed", link)
WritingElement_ReadAttributes_End( oReader )
}
void ReadAttributes2(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("st"), st)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("end"), end)
WritingElement_ReadAttributes_Read_if ( oReader, L"st", st)
WritingElement_ReadAttributes_Read_else_if ( oReader, L"end", end)
WritingElement_ReadAttributes_End( oReader )
}
void ReadAttributes3(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("spid"), spid)
WritingElement_ReadAttributes_Start( oReader );
WritingElement_ReadAttributes_ReadSingle ( oReader, L"spid", spid)
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{//todooo списком ..
XmlUtils::CXmlNode media = node.ReadNodeNoNS(_T("media"));
if (media.IsValid())
{
XmlUtils::CXmlNodes oNodes;
if (node.GetNodes(L"*", oNodes))
{
link = media.GetAttribute(_T("r:embed"));
XmlUtils::CXmlNode trim = media.ReadNodeNoNS(_T("trim"));
if (trim.IsValid())
int nCount = oNodes.GetCount();
for (int i = 0; i < nCount; ++i)
{
trim.ReadAttributeBase(_T("st"), st);
trim.ReadAttributeBase(_T("end"), end);
XmlUtils::CXmlNode oNode;
oNodes.GetAt(i, oNode);
std::wstring strName = XmlUtils::GetNameNoNS(oNode.GetName());
if (L"media" == strName)
{
link = oNode.GetAttribute(L"r:embed");
XmlUtils::CXmlNode trim = oNode.ReadNodeNoNS(L"trim");
if (trim.IsValid())
{
trim.ReadAttributeBase(L"st", st);
trim.ReadAttributeBase(L"end", end);
}
}
else if (L"compatExt" == strName)
{
spid = oNode.GetAttribute(L"spid");
}
else if (L"sectionLst" == strName)
{
sectionLst = oNode;
}
}
return;
}
XmlUtils::CXmlNode compatExt = node.ReadNodeNoNS(_T("compatExt"));
if (compatExt.IsValid())
{
spid = media.GetAttribute(_T("spid"));
return;
}
}
@ -170,11 +206,11 @@ namespace PPTX
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
if (link.IsInit() && uri.IsInit())
if (link.IsInit())
{
pWriter->StartNode(L"p:ext");
pWriter->StartAttributes();
pWriter->WriteAttribute(L"uri", *uri);
pWriter->WriteAttribute(L"uri", std::wstring(L"{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}"));
pWriter->EndAttributes();
pWriter->StartNode(L"p14:media");
@ -185,6 +221,16 @@ namespace PPTX
pWriter->EndNode(L"p14:media");
pWriter->EndNode(L"p:ext");
}
if (sectionLst.IsInit())
{
pWriter->StartNode(L"p:ext");
pWriter->StartAttributes();
pWriter->WriteAttribute(L"uri", std::wstring(L"{521415D9-36F7-43E2-AB2F-B90AF26B5E84}"));
pWriter->EndAttributes();
sectionLst->toXmlWriter(pWriter);
pWriter->EndNode(L"p:ext");
}
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
@ -201,10 +247,11 @@ namespace PPTX
//media
nullable<OOX::RId> link;
nullable_double st;
nullable_double end;
nullable_double end;
//compatExt
nullable_string spid;
nullable<nsPresentation::SectionLst> sectionLst;
//dataModelExt
//table
//sparklineGroups

View File

@ -896,7 +896,6 @@ namespace PPTX
{
PPTX::Logic::Ext ext;
ext.link = OOX::RId(blipFill.blip->mediaRid);
ext.uri = L"{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}";
nvPicPr.nvPr.extLst.push_back(ext);
int nRId = -1;

View File

@ -45,9 +45,14 @@ namespace PPTX
public:
PPTX_LOGIC_BASE(XmlId)
XmlId(std::wstring name)
{
m_name = name;
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
m_name = XmlUtils::GetNameNoNS(node.GetName());
m_name = node.GetName();
node.ReadAttributeBase(L"r:id", rid);
node.ReadAttributeBase(L"id", id);
}
@ -57,7 +62,7 @@ namespace PPTX
oAttr.Write(_T("r:id"), rid.ToString());
oAttr.Write(_T("id"), id);
return XmlUtils::CreateNode(_T("p:") + m_name, oAttr);
return XmlUtils::CreateNode(m_name, oAttr);
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
@ -69,17 +74,48 @@ namespace PPTX
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
}
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
LONG _end_rec = pReader->GetPos() + pReader->GetLong() + 4;
pReader->Skip(1); // start attributes
while (true)
{
BYTE _at = pReader->GetUChar_TypeNode();
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
break;
switch (_at)
{
case 0:
id = pReader->GetString2();
break;
case 1:
rid = pReader->GetString2();
break;
default:
break;
}
}
pReader->Seek(_end_rec);
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(_T("p:") + m_name);
pWriter->StartNode( m_name );
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("id"), id);
pWriter->WriteAttribute(_T("r:id"), rid.ToString());
pWriter->WriteAttribute(_T("id"), id);
std::wstring sRid = rid.ToString();
if (sRid.empty() == false)
{
pWriter->WriteAttribute(_T("r:id"), sRid);
}
pWriter->EndAttributes();
pWriter->EndNode(_T("p:") + m_name);
pWriter->EndNode( m_name );
}
nullable_string id;

View File

@ -52,40 +52,42 @@ namespace PPTX
class Namespaces
{
public:
Namespaces() : a(L"a", L"http://schemas.openxmlformats.org/drawingml/2006/main"),
b(L"b", L"http://schemas.openxmlformats.org/officeDocument/2006/bibliography"),
cdr(L"cdr", L"http://schemas.openxmlformats.org/drawingml/2006/chartDrawing"),
cp(L"cp", L"http://schemas.openxmlformats.org/package/2006/metadata/core-properties"),
dc(L"dc", L"http://purl.org/dc/elements/1.1/"),
Namespaces() :
a (L"a", L"http://schemas.openxmlformats.org/drawingml/2006/main"),
b (L"b", L"http://schemas.openxmlformats.org/officeDocument/2006/bibliography"),
cdr (L"cdr", L"http://schemas.openxmlformats.org/drawingml/2006/chartDrawing"),
cp (L"cp", L"http://schemas.openxmlformats.org/package/2006/metadata/core-properties"),
dc (L"dc", L"http://purl.org/dc/elements/1.1/"),
dchrt(L"dchrt", L"http://schemas.openxmlformats.org/drawingml/2006/chart"),
dcmitype(L"dcmitype", L"http://purl.org/dc/dcmitype/"),
dcterms(L"dcterms", L"http://purl.org/dc/terms/"),
ddgrm(L"ddgrm", L"http://schemas.openxmlformats.org/drawingml/2006/diagram"),
dgm(L"dgm", L"http://schemas.openxmlformats.org/drawingml/2006/diagram"),
dgm (L"dgm", L"http://schemas.openxmlformats.org/drawingml/2006/diagram"),
dlckcnv(L"dlckcnv", L"http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas"),
dpct(L"dpct", L"http://schemas.openxmlformats.org/drawingml/2006/picture"),
ds(L"ds", L"http://schemas.openxmlformats.org/officeDocument/2006/customXml"),
m(L"m", L"http://schemas.openxmlformats.org/officeDocument/2006/math"),
o(L"o", L"urn:schemas-microsoft-com:office:office"),
p(L"p", L"http://schemas.openxmlformats.org/presentationml/2006/main"),
pic(L"pic", L"http://schemas.openxmlformats.org/drawingml/2006/picture"),
pvml(L"pvml", L"urn:schemas-microsoft-com:office:powerpoint"),
r(L"r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships"),
s(L"s", L"http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes"),
sl(L"sl", L"http://schemas.openxmlformats.org/schemaLibrary/2006/main"),
v(L"v", L"urn:schemas-microsoft-com:vml"),
ve(L"ve", L"http://schemas.openxmlformats.org/markup-compatibility/2006"),
vp(L"vp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"),
vt(L"vt", L"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"),
w(L"w", L"http://schemas.openxmlformats.org/wordprocessingml/2006/main"),
w10(L"w10", L"urn:schemas-microsoft-com:office:word"),
wne(L"wne", L"http://schemas.microsoft.com/office/word/2006/wordml"),
wp(L"wp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"),
x(L"x", L"urn:schemas-microsoft-com:office:excel"),
xdr(L"xdr", L"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"),
dpct(L"dpct", L"http://schemas.openxmlformats.org/drawingml/2006/picture"),
ds (L"ds", L"http://schemas.openxmlformats.org/officeDocument/2006/customXml"),
m (L"m", L"http://schemas.openxmlformats.org/officeDocument/2006/math"),
o (L"o", L"urn:schemas-microsoft-com:office:office"),
p (L"p", L"http://schemas.openxmlformats.org/presentationml/2006/main"),
pic (L"pic", L"http://schemas.openxmlformats.org/drawingml/2006/picture"),
pvml(L"pvml", L"urn:schemas-microsoft-com:office:powerpoint"),
r (L"r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships"),
s (L"s", L"http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes"),
sl (L"sl", L"http://schemas.openxmlformats.org/schemaLibrary/2006/main"),
v (L"v", L"urn:schemas-microsoft-com:vml"),
ve (L"ve", L"http://schemas.openxmlformats.org/markup-compatibility/2006"),
vp (L"vp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"),
vt (L"vt", L"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"),
w (L"w", L"http://schemas.openxmlformats.org/wordprocessingml/2006/main"),
w10 (L"w10", L"urn:schemas-microsoft-com:office:word"),
wne (L"wne", L"http://schemas.microsoft.com/office/word/2006/wordml"),
wp (L"wp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"),
x (L"x", L"urn:schemas-microsoft-com:office:excel"),
xdr (L"xdr", L"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"),
xmlns(L"xmlns", L"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"),
xsd(L"xsd", L"http://www.w3.org/2001/XMLSchema"),
xsi(L"xsi", L"http://www.w3.org/2001/XMLSchema-instance")
xsd (L"xsd", L"http://www.w3.org/2001/XMLSchema"),
xsi (L"xsi", L"http://www.w3.org/2001/XMLSchema-instance"),
p14 (L"p14", L"http://schemas.microsoft.com/office/powerpoint/2010/main")
{
}
@ -124,6 +126,7 @@ namespace PPTX
const Namespace xmlns;
const Namespace xsd;
const Namespace xsi;
const Namespace p14;
};
static Namespaces g_Namespaces;

View File

@ -37,19 +37,19 @@
#include "FileContainer.h"
#include "FileTypes.h"
#include "Limit/Conformance.h"
#include "Logic/TextListStyle.h"
#include "Logic/ClrMap.h"
#include "Theme/ClrScheme.h"
#include "Presentation/EmbeddedFont.h"
#include "Presentation/Kinsoku.h"
#include "Presentation/NotesSz.h"
#include "Presentation/PhotoAlbum.h"
#include "Logic/XmlId.h"
#include "Presentation/SldSz.h"
#include "CommentAuthors.h"
#include "Limit/Conformance.h"
#include "Logic/TextListStyle.h"
#include "Logic/ClrMap.h"
#include "Logic/ExtP.h"
#include "Theme/ClrScheme.h"
namespace PPTX
{
class Presentation : public WrapperFile, public PPTX::FileContainer
@ -87,7 +87,6 @@ namespace PPTX
oNode.ReadAttributeBase(L"showSpecialPlsOnTitleSld", attrShowSpecialPlsOnTitleSld);
oNode.ReadAttributeBase(L"strictFirstAndLastChars", attrStrictFirstAndLastChars);
//custDataLst (Customer Data List)
//custShowLst (List of Custom Shows)
defaultTextStyle = oNode.ReadNode(_T("p:defaultTextStyle"));
@ -100,8 +99,7 @@ namespace PPTX
{
oNodeEmbeddedFonts.LoadArray(_T("p:embeddedFont"), embeddedFontLst);
size_t count = embeddedFontLst.size();
for (size_t i = 0; i < count; ++i)
for (size_t i = 0; i < embeddedFontLst.size(); ++i)
embeddedFontLst[i].SetParentFilePointer(this);
}
@ -111,8 +109,7 @@ namespace PPTX
{
oNodeHMList.LoadArray(_T("p:handoutMasterId"), handoutMasterIdLst);
size_t count = handoutMasterIdLst.size();
for (size_t i = 0; i < count; ++i)
for (size_t i = 0; i < handoutMasterIdLst.size(); ++i)
handoutMasterIdLst[i].SetParentFilePointer(this);
}
@ -128,8 +125,7 @@ namespace PPTX
{
oNodeMIDList.LoadArray(_T("p:notesMasterId"), notesMasterIdLst);
size_t count = notesMasterIdLst.size();
for (size_t i = 0; i < count; ++i)
for (size_t i = 0; i < notesMasterIdLst.size(); ++i)
notesMasterIdLst[i].SetParentFilePointer(this);
}
@ -147,8 +143,7 @@ namespace PPTX
{
oNode_sldId.LoadArray(_T("p:sldId"), sldIdLst);
size_t count = sldIdLst.size();
for (size_t i = 0; i < count; ++i)
for (size_t i = 0; i < sldIdLst.size(); ++i)
sldIdLst[i].SetParentFilePointer(this);
}
@ -158,16 +153,36 @@ namespace PPTX
{
oNode_sldM_Id.LoadArray(_T("p:sldMasterId"), sldMasterIdLst);
size_t count = sldMasterIdLst.size();
for (size_t i = 0; i < count; ++i)
for (size_t i = 0; i < sldMasterIdLst.size(); ++i)
sldMasterIdLst[i].SetParentFilePointer(this);
}
sldSz = oNode.ReadNode(_T("p:sldSz"));
if (sldSz.is_init())
sldSz->SetParentFilePointer(this);
//smartTags (Smart Tags)
XmlUtils::CXmlNode list = oNode.ReadNodeNoNS(_T("extLst"));
if (list.IsValid())
{
XmlUtils::CXmlNodes oNodes;
if (list.GetNodes(_T("*"), oNodes))
{
int nCount = oNodes.GetCount();
for (int i = 0; i < nCount; ++i)
{
XmlUtils::CXmlNode oNode;
oNodes.GetAt(i, oNode);
PPTX::Logic::Ext ext;
ext.fromXML(oNode);
if (ext.sectionLst.IsInit())
{
sectionLst = ext.sectionLst;
}
}
}
}
//smartTags (Smart Tags)
Normalize();
}
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const
@ -205,6 +220,7 @@ namespace PPTX
pWriter->WriteRecord2(5, sldSz);
pWriter->WriteRecord2(6, commentAuthors);
pWriter->WriteRecord2(7, sectionLst);
pWriter->EndRecord();
}
@ -312,6 +328,12 @@ namespace PPTX
commentAuthors->fromPPTY(pReader);
break;
}
case 7:
{
sectionLst = new nsPresentation::SectionLst();
sectionLst->fromPPTY(pReader);
break;
}
default:
{
pReader->Seek(_end_pos);
@ -350,11 +372,11 @@ namespace PPTX
pWriter->EndAttributes();
pWriter->WriteArray(_T("p:sldMasterIdLst"), sldMasterIdLst);
pWriter->WriteArray(_T("p:notesMasterIdLst"), notesMasterIdLst);
pWriter->WriteArray(_T("p:handoutMasterIdLst"), handoutMasterIdLst);
pWriter->WriteArray(_T("p:embeddedFontLst"), embeddedFontLst);
pWriter->WriteArray(_T("p:sldIdLst"), sldIdLst);
pWriter->WriteArray(L"p:sldMasterIdLst", sldMasterIdLst);
pWriter->WriteArray(L"p:notesMasterIdLst", notesMasterIdLst);
pWriter->WriteArray(L"p:handoutMasterIdLst", handoutMasterIdLst);
pWriter->WriteArray(L"p:embeddedFontLst", embeddedFontLst);
pWriter->WriteArray(L"p:sldIdLst", sldIdLst);
pWriter->Write(sldSz);
pWriter->Write(notesSz);
@ -362,7 +384,17 @@ namespace PPTX
pWriter->Write(kinsoku);
pWriter->Write(defaultTextStyle);
pWriter->EndNode(_T("p:presentation"));
std::vector<Logic::Ext> extLst;
if (sectionLst.IsInit())
{
Logic::Ext exp;
exp.sectionLst = sectionLst;
extLst.push_back(exp);
}
pWriter->WriteArray(L"p:extLst", extLst);
pWriter->EndNode(L"p:presentation");
}
public:
@ -380,7 +412,7 @@ namespace PPTX
}
public:
//Childs
//Childs
//custDataLst (Customer Data List)
//property<std::list<Presentation::CustShow> > custShowLst (List of Custom Shows)
nullable<Logic::TextListStyle> defaultTextStyle;
@ -394,6 +426,7 @@ namespace PPTX
std::vector<Logic::XmlId> sldIdLst;
std::vector<Logic::XmlId> sldMasterIdLst;
nullable<nsPresentation::SldSz> sldSz;
nullable<nsPresentation::SectionLst> sectionLst;
//smartTags (Smart Tags)
// Attrs

View File

@ -0,0 +1,247 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include "../Logic/XmlId.h"
namespace PPTX
{
namespace Logic
{
class Section : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Section)
nullable_string id;
nullable_string name;
std::vector<Logic::XmlId> arSldIdLst;
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(L"id", id);
node.ReadAttributeBase(L"name", name);
XmlUtils::CXmlNode oNodeSldIdLst;
if (node.GetNode(L"p14:sldIdLst", oNodeSldIdLst))
{
oNodeSldIdLst.LoadArray(L"p14:sldId", arSldIdLst);
}
}
virtual std::wstring toXML() const
{
return L"";
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(L"p14:section");
pWriter->StartAttributes();
pWriter->WriteAttribute2(L"name", name);
pWriter->WriteAttribute(L"id", id);
pWriter->EndAttributes();
pWriter->StartNode(L"p14:sldIdLst");
pWriter->WriteArray2(arSldIdLst);
pWriter->EndNode(L"p14:sldIdLst");
pWriter->EndNode(L"p14:section");
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteString2(0, id);
pWriter->WriteString2(1, name);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
pWriter->WriteRecordArray(0, 0, arSldIdLst);
}
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
LONG _end_rec = pReader->GetPos() + pReader->GetLong() + 4;
pReader->Skip(1); // start attributes
while (true)
{
BYTE _at = pReader->GetUChar_TypeNode();
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
break;
switch (_at)
{
case 0:
id = pReader->GetString2();
break;
case 1:
name = pReader->GetString2();
break;
default:
break;
}
}
while (pReader->GetPos() < _end_rec)
{
BYTE _rec = pReader->GetUChar();
switch (_rec)
{
case 0:
{
pReader->Skip(4); // len
ULONG lCount = pReader->GetULong();
for (ULONG i = 0; i < lCount; ++i)
{
pReader->Skip(1);
Logic::XmlId sldId(L"p14:sldId");
arSldIdLst.push_back(sldId);
arSldIdLst.back().fromPPTY(pReader);
}
break;
}
default:
{
pReader->SkipRecord();
break;
}
}
}
pReader->Seek(_end_rec);
}
virtual void FillParentPointersForChilds()
{
}
};
}
namespace nsPresentation
{
class SectionLst : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(SectionLst)
virtual void fromXML(XmlUtils::CXmlNode& node)
{
XmlUtils::CXmlNodes oNodes;
if (node.GetNodes(_T("*"), oNodes))
{
int nCount = oNodes.GetCount();
for (int i = 0; i < nCount; ++i)
{
XmlUtils::CXmlNode oNode;
oNodes.GetAt(i, oNode);
Logic::Section sect;
arSectionLst.push_back(sect);
arSectionLst.back().fromXML(oNode);
}
}
}
virtual std::wstring toXML() const
{
return L"";
}
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
LONG end = pReader->GetPos() + pReader->GetLong() + 4;
while (pReader->GetPos() < end)
{
BYTE _rec = pReader->GetUChar();
switch (_rec)
{
case 0:
{
pReader->Skip(4); // len
ULONG lCount = pReader->GetULong();
for (ULONG i = 0; i < lCount; ++i)
{
pReader->Skip(1);
Logic::Section sect;
arSectionLst.push_back(sect);
arSectionLst.back().fromPPTY(pReader);
}
break;
}
default:
{
pReader->SkipRecord();
break;
}
}
}
pReader->Seek(end);
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->WriteRecordArray(0, 0, arSectionLst);
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(L"p14:sectionLst");
pWriter->StartAttributes();
pWriter->WriteAttribute(L"xmlns:p14", PPTX::g_Namespaces.p14.m_strLink);
pWriter->EndAttributes();
pWriter->WriteArray2(arSectionLst);
pWriter->EndNode(L"p14:sectionLst");
}
std::vector<Logic::Section> arSectionLst;
protected:
virtual void FillParentPointersForChilds(){};
};
}
} // namespace PPTX

View File

@ -2987,6 +2987,10 @@
RelativePath="..\.\PPTXFormat\Presentation.h"
>
</File>
<File
RelativePath="..\PPTXFormat\Presentation\SectionLst.h"
>
</File>
<File
RelativePath="..\.\PPTXFormat\Presentation\SldSz.h"
>

View File

@ -969,6 +969,8 @@ void OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput, PPTX::
PPTX::Theme *theme = oParam.oDocx->GetTheme();
if (!theme || fmt_index <0) return;
if (style_ref->Color.is<PPTX::Logic::SchemeClr>() == false) return;
PPTX::Logic::SchemeClr & schemeClr = style_ref->Color.as<PPTX::Logic::SchemeClr>();
std::wstring color = schemeClr.val.get();

View File

@ -47,24 +47,21 @@
int _tmain(int argc, _TCHAR* argv[])
{
if (argc < 3) return 0;
if (argc < 2) return 0;
std::wstring sXMLOptions = _T("<Options><TXTOptions><Encoding>1000</Encoding></TXTOptions></Options>");
std::wstring sXMLOptions = _T("<Options><TXTOptions><Encoding>50</Encoding></TXTOptions></Options>");
std::wstring srcFileName = argv[1];
std::wstring dstFileName = argv[2];
std::wstring outputDir = NSDirectory::GetFolderPath(dstFileName);
std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
int n1 = srcFileName.rfind(L".");
int n2 = dstFileName.rfind(L".");
std::wstring ext_1 = n1>=0 ? srcFileName.substr(n1+1, srcFileName.length() - n1): L""; //ext_1.MakeLower();
std::wstring ext_2 = n2>=0 ? dstFileName.substr(n2+1, dstFileName.length() - n2): L""; //ext_2.MakeLower();
int n1 = srcFileName.rfind(_T('.'));
std::wstring ext_1 = n1 >= 0 ? srcFileName.substr(n1+1, srcFileName.length() - n1) : _T("");
std::transform(ext_1.begin(), ext_1.end(), ext_1.begin(), ::tolower);
std::wstring dstFileName = argc > 2 ? argv[2] : srcFileName + L"_my." + (ext_1 == L"txt" ? L"docx" : L"txt");
std::wstring outputDir = NSDirectory::GetFolderPath(dstFileName);
std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
CTxtXmlFile txtFile;
COfficeUtils oCOfficeUtils(NULL);
@ -77,7 +74,7 @@ int _tmain(int argc, _TCHAR* argv[])
if (S_OK != oCOfficeUtils.CompressFileOrDirectory(dstTempPath.c_str(), dstFileName.c_str(), -1))
return S_FALSE;
}
if (ext_2 == L"txt")
else
{
// docx->txt
if (S_OK != oCOfficeUtils.ExtractToDirectory(srcFileName.c_str(), dstTempPath.c_str(), NULL, 0))

View File

@ -85,7 +85,7 @@ namespace Docx2Txt
OOX::CDocument *pDocument, OOX::CNumbering* pNumbering, OOX::CStyles *pStyles);
size_t NoteCount;
std::list<std::wstring> Notes;
std::map<std::wstring, std::list<std::wstring>> Notes;
static std::wstring IntToLowerLetter (int number);
static std::wstring IntToUpperLetter (int number);
@ -198,10 +198,20 @@ namespace Docx2Txt
if(NoteCount != 0)
{
m_outputFile.m_listContent.push_back(_T("---------------------------"));
for(std::list<std::wstring>::const_iterator iter = Notes.begin(); iter != Notes.end(); iter++)
m_outputFile.m_listContent.push_back(L"");
m_outputFile.m_listContent.push_back(L"---------------------------");
for(std::map<std::wstring, std::list<std::wstring>>::const_iterator iter_map = Notes.begin(); iter_map != Notes.end(); iter_map++)
{
m_outputFile.m_listContent.push_back(*iter);
bool bFirst = true;
for(std::list<std::wstring>::const_iterator iter = iter_map->second.begin(); iter != iter_map->second.end(); iter++)
{
if (bFirst) m_outputFile.m_listContent.push_back(iter_map->first + L" " + *iter);
else m_outputFile.m_listContent.push_back(*iter);
bFirst = false;
}
}
}
}
@ -491,31 +501,52 @@ namespace Docx2Txt
if (run->m_arrItems[j]->getType() == OOX::et_w_footnoteReference || run->m_arrItems[j]->getType() == OOX::et_w_endnoteReference)
{// todooo Ref ????
std::list<std::wstring> notes_content;
OOX::Logic::CFootnoteReference* footnote_ref = dynamic_cast<OOX::Logic::CFootnoteReference*>(run->m_arrItems[j]);
OOX::Logic::CEndnoteReference* endnote_ref = dynamic_cast<OOX::Logic::CEndnoteReference*>(run->m_arrItems[j]);
NoteCount++;
std::wstring s = _T("[") + ToWString(NoteCount) + _T("]");
Notes.push_back(s);
if(run->m_arrItems[j]->getType() == OOX::et_w_footnoteReference)
if (footnote_ref)
{
smart_ptr<OOX::File> pFile = pDocument->Find(OOX::FileTypes::FootNote);
if (pFile.IsInit())
{
OOX::CFootnotes *pFootnotes = (OOX::CFootnotes*)pFile.operator->();
for (long r =0 ;r < pFootnotes->m_arrFootnote.size(); r++)
convert(pFootnotes->m_arrFootnote[r]->m_arrItems, Notes, Event, false, pDocument, pNumbering, pStyles);
for (size_t r = 0; r < pFootnotes->m_arrFootnote.size(); r++)
{
OOX::CFtnEdn* note = dynamic_cast<OOX::CFtnEdn*>(pFootnotes->m_arrFootnote[r]);
if (note && note->m_oId == footnote_ref->m_oId)
{
convert(pFootnotes->m_arrFootnote[r]->m_arrItems, notes_content, Event, false, pDocument, pNumbering, pStyles);
}
}
}
Notes.insert(std::make_pair(ToWString(NoteCount), notes_content));
}
else if(run->m_arrItems[j]->getType() == OOX::et_w_endnoteReference)
if (endnote_ref)
{
smart_ptr<OOX::File> pFile = pDocument->Find(OOX::FileTypes::EndNote);
if (pFile.IsInit())
{
OOX::CEndnotes *pEndnotes = (OOX::CEndnotes*)pFile.operator->();
for (long r =0 ;r < pEndnotes->m_arrEndnote.size(); r++)
convert(pEndnotes->m_arrEndnote[r]->m_arrItems, Notes, Event, false, pDocument, pNumbering, pStyles);
for (size_t r =0; r < pEndnotes->m_arrEndnote.size(); r++)
{
OOX::CFtnEdn* note = dynamic_cast<OOX::CFtnEdn*>(pEndnotes->m_arrEndnote[r]);
if (note && note->m_oId == endnote_ref->m_oId)
{
convert(pEndnotes->m_arrEndnote[r]->m_arrItems, notes_content, Event, false, pDocument, pNumbering, pStyles);
}
}
}
Notes.insert(std::make_pair(ToWString(NoteCount), notes_content));
}
wstr.replace(wstr.find(_T("_")), 1 , ToWString(NoteCount));
wstr += L"[" + ToWString(NoteCount) + L"]"; ;
}
line += wstr;
}

View File

@ -104,13 +104,6 @@ static int ParseTxtOptions(const std::wstring & sXmlOptions)
HRESULT CTxtXmlFile::txt_LoadFromFile(const std::wstring & sSrcFileName, const std::wstring & sDstPath, const std::wstring & sXMLOptions)
{
//проверка на структуру xml - если что не так выкинет быстро
//HRESULT hr = xml_LoadFromFile(sSrcFileName, sDstPath, sXMLOptions);
//if(hr == S_OK)
// return S_OK;
//As Text
Writers::FileWriter *pDocxWriter = new Writers::FileWriter(sDstPath, L"", true, 1, false, NULL, L"");
if (pDocxWriter == NULL) return S_FALSE;

View File

@ -193,12 +193,15 @@ int PIVOTVIEW::serialize(std::wostream & strm)
core->m_PIVOTPI->serialize(CP_XML_STREAM());
}
}
CP_XML_NODE(L"dataFields")
if (core->m_arSXDI.empty() == false)
{
CP_XML_ATTR(L"count", view->cDimData);
for (size_t i = 0; i < core->m_arSXDI.size(); i++)
CP_XML_NODE(L"dataFields")
{
core->m_arSXDI[i]->serialize(CP_XML_STREAM());
CP_XML_ATTR(L"count", view->cDimData);
for (size_t i = 0; i < core->m_arSXDI.size(); i++)
{
core->m_arSXDI[i]->serialize(CP_XML_STREAM());
}
}
}
//CP_XML_NODE(L"pivotTableStyleInfo")

View File

@ -38,6 +38,8 @@
#include "../Biff_records/SXString.h"
#include "../Biff_records/SXDtr.h"
#include <boost/lexical_cast.hpp>
namespace XLS
{
@ -85,7 +87,7 @@ const bool SXOPER::loadContent(BinProcessor& proc)
if (bInteger)
value = std::to_wstring((int)num->num.data.value);
else
value = std::to_wstring(num->num.data.value);
value = boost::lexical_cast<std::wstring>(num->num.data.value);
}
else if(proc.optional<SxBool>())
{

View File

@ -44,9 +44,11 @@ namespace OOX
public:
RId() : m_id(0)
{
bNumber = false;
}
RId(const size_t id) : m_id(id)
{
bNumber = true;
}
RId(const std::wstring& rid)
{
@ -68,11 +70,13 @@ namespace OOX
{
std::wstring strParam = rid.substr(nFindStringLength);
m_id = XmlUtils::GetUInteger(strParam);
bNumber = true;
}
else
{
m_id = 0;
m_sId = rid;
bNumber = false;
}
return *this;
@ -80,8 +84,9 @@ namespace OOX
const RId& operator= (const RId& oSrc)
{
m_id = oSrc.m_id;
m_sId = oSrc.m_sId;
m_id = oSrc.m_id;
m_sId = oSrc.m_sId;
bNumber = oSrc.bNumber;
return *this;
}
@ -118,6 +123,7 @@ namespace OOX
const RId next() const
{
bNumber = true;
return RId(m_id + 1);
}
@ -125,8 +131,10 @@ namespace OOX
{
if(!m_sId.empty())
return m_sId;
else
else if (bNumber)
return _T("rId") + std::to_wstring((unsigned int)m_id);
else
return L"";
}
template<typename T>
void toPPTY(BYTE type, T pWriter) const
@ -137,6 +145,7 @@ namespace OOX
private:
size_t m_id;
std::wstring m_sId;
mutable bool bNumber;
};
} // namespace OOX