mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-11 02:16:02 +08:00
Compare commits
27 Commits
core-windo
...
core/devel
| Author | SHA1 | Date | |
|---|---|---|---|
| a17a04298a | |||
| f7ba686f0c | |||
| c41385e1ae | |||
| f582a9b690 | |||
| b36c2dbaf9 | |||
| 10b9e9e5e8 | |||
| 1beb5440f9 | |||
| 9a9ba4cc62 | |||
| 5b4c6363bb | |||
| 2026d064ef | |||
| 42257ca447 | |||
| 6f2fdcd971 | |||
| 9b4b7a26fd | |||
| 4d688b3922 | |||
| be8d427e26 | |||
| 7e0749ddda | |||
| 9f2324d208 | |||
| 6e258b85d7 | |||
| 24e55018a0 | |||
| 2352ae5d88 | |||
| 2cba43e6f3 | |||
| abcf8d0246 | |||
| c18b955467 | |||
| 7896b75001 | |||
| 7d188b2213 | |||
| 79ead484cc | |||
| be65f18a0e |
@ -35,11 +35,23 @@
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
struct _guides
|
||||
{
|
||||
unsigned char type;
|
||||
|
||||
unsigned char param_type1;
|
||||
unsigned char param_type2;
|
||||
unsigned char param_type3;
|
||||
|
||||
WORD param1;
|
||||
WORD param2;
|
||||
WORD param3;
|
||||
};
|
||||
class PathParser
|
||||
{
|
||||
public:
|
||||
|
||||
PathParser (const unsigned char* pSegmentInfo, unsigned int pSegmentInfoSize, const unsigned char* pVertices, unsigned int pVerticesSize)
|
||||
PathParser (const unsigned char* pSegmentInfo, unsigned int pSegmentInfoSize, const unsigned char* pVertices, unsigned int pVerticesSize, std::vector<_guides> & guides)
|
||||
{
|
||||
if ((pSegmentInfo != NULL) && (pSegmentInfoSize > 0))
|
||||
{
|
||||
@ -105,31 +117,40 @@ namespace DocFileFormat
|
||||
unsigned short nElemsAlloc = FormatUtils::BytesToUInt16(pVertices, 2, pVerticesSize);
|
||||
unsigned short cb = FormatUtils::BytesToUInt16(pVertices, 4, pVerticesSize);
|
||||
|
||||
if (0xfff0 == cb)
|
||||
{
|
||||
cb = 4;
|
||||
|
||||
for (unsigned short i = 0; i < nElems; ++i)
|
||||
for (unsigned short i = 0; i < nElems; ++i)
|
||||
{
|
||||
POINT point;
|
||||
if (0xfff0 == cb)
|
||||
{
|
||||
POINT point;
|
||||
|
||||
cb = 4;
|
||||
point.x = FormatUtils::BytesToInt16(pVertices + 6, (i * cb), pVerticesSize);
|
||||
point.y = FormatUtils::BytesToInt16(pVertices + 6, (i * cb) + (cb / 2), pVerticesSize);
|
||||
|
||||
m_arPoints.push_back(point);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (unsigned short i = 0; i < nElems; ++i)
|
||||
else
|
||||
{
|
||||
POINT point;
|
||||
|
||||
point.x = FormatUtils::BytesToInt32(pVertices + 6, (i * cb), pVerticesSize);
|
||||
point.y = FormatUtils::BytesToInt32(pVertices + 6, (i * cb) + (cb / 2), pVerticesSize);
|
||||
|
||||
m_arPoints.push_back(point);
|
||||
}
|
||||
|
||||
LONG lMinF = (LONG)0x80000000;
|
||||
if (lMinF <= point.x)
|
||||
{
|
||||
int index = (DWORD)point.x - 0x80000000;
|
||||
if (index >= 0 && index < guides.size())
|
||||
{
|
||||
point.x = guides[index].param3;
|
||||
}
|
||||
}
|
||||
if (lMinF <= point.y)
|
||||
{
|
||||
int index = (DWORD)point.y - 0x80000000;
|
||||
if (index >= 0 && index < guides.size())
|
||||
{
|
||||
point.y = guides[index].param3;
|
||||
}
|
||||
}
|
||||
|
||||
m_arPoints.push_back(point);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,21 +106,20 @@ namespace DocFileFormat
|
||||
return new ShapeContainer( _reader, bodySize, typeCode, version, instance );
|
||||
}
|
||||
|
||||
std::list<OptionEntry> ExtractOptions() const
|
||||
std::vector<OptionEntryPtr> ExtractOptions() const
|
||||
{
|
||||
std::list<OptionEntry> ret;
|
||||
std::vector<OptionEntryPtr> ret;
|
||||
|
||||
//build the list of all option entries of this shape
|
||||
for ( std::vector<Record*>::const_iterator iter = this->Children.begin(); iter != this->Children.end(); iter++ )
|
||||
{
|
||||
ShapeOptions* opt = dynamic_cast<ShapeOptions*>( *iter );
|
||||
|
||||
if ( opt != NULL )
|
||||
if ( opt == NULL ) continue;
|
||||
|
||||
for ( size_t i = 0; i < opt->Options.size(); i++)
|
||||
{
|
||||
for ( std::vector<OptionEntry>::iterator oeIter = opt->Options.begin(); oeIter != opt->Options.end(); oeIter++ )
|
||||
{
|
||||
ret.push_back( *oeIter );
|
||||
}
|
||||
ret.push_back( opt->Options[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -568,18 +568,19 @@ namespace DocFileFormat
|
||||
|
||||
struct OptionEntry
|
||||
{
|
||||
OptionEntry() : pid(PropertyId_left), fBid(false), fComplex(false), op(0), opComplex(NULL)
|
||||
OptionEntry() : pid(PropertyId_left), fBid(false), fComplex(false), op(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
PropertyId pid;
|
||||
bool fBid;
|
||||
bool fComplex;
|
||||
unsigned int op;
|
||||
unsigned char* opComplex;
|
||||
std::shared_ptr<unsigned char> opComplex;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<OptionEntry> OptionEntryPtr;
|
||||
|
||||
class ShapeOptions: public Record
|
||||
{
|
||||
public:
|
||||
@ -587,8 +588,8 @@ namespace DocFileFormat
|
||||
static const unsigned short TYPE_CODE_0xF121 = 0xF121;
|
||||
static const unsigned short TYPE_CODE_0xF122 = 0xF122;
|
||||
|
||||
std::vector<OptionEntry> Options;
|
||||
std::map<PropertyId, OptionEntry> OptionsByID;
|
||||
std::vector<OptionEntryPtr> Options;
|
||||
std::map<PropertyId, OptionEntryPtr> OptionsByID;
|
||||
|
||||
ShapeOptions() : Record()
|
||||
{
|
||||
@ -596,8 +597,8 @@ namespace DocFileFormat
|
||||
|
||||
virtual ~ShapeOptions()
|
||||
{
|
||||
for (std::vector<OptionEntry>::iterator iter = Options.begin(); iter != Options.end(); ++iter)
|
||||
RELEASEARRAYOBJECTS( iter->opComplex );
|
||||
//for (std::vector<OptionEntry>::iterator iter = Options.begin(); iter != Options.end(); ++iter)
|
||||
// RELEASEARRAYOBJECTS( iter->opComplex );
|
||||
}
|
||||
|
||||
ShapeOptions (IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance) : Record (_reader, size, typeCode, version, instance)
|
||||
@ -606,16 +607,16 @@ namespace DocFileFormat
|
||||
|
||||
//instance is the count of properties stored in this record
|
||||
|
||||
OptionEntry entry;
|
||||
//parse the flags and the simple values
|
||||
for (unsigned int i = 0; i < instance; ++i)
|
||||
{
|
||||
OptionEntryPtr entry = std::shared_ptr<OptionEntry>(new OptionEntry());
|
||||
unsigned short flag = Reader->ReadUInt16();
|
||||
|
||||
entry.pid = (PropertyId)FormatUtils::BitmaskToInt (flag, 0x3FFF);
|
||||
entry.fBid = FormatUtils::BitmaskToBool (flag, 0x4000);
|
||||
entry.fComplex = FormatUtils::BitmaskToBool (flag, 0x8000);
|
||||
entry.op = Reader->ReadUInt32();
|
||||
entry->pid = (PropertyId)FormatUtils::BitmaskToInt (flag, 0x3FFF);
|
||||
entry->fBid = FormatUtils::BitmaskToBool (flag, 0x4000);
|
||||
entry->fComplex = FormatUtils::BitmaskToBool (flag, 0x8000);
|
||||
entry->op = Reader->ReadUInt32();
|
||||
|
||||
Options.push_back( entry );
|
||||
}
|
||||
@ -625,21 +626,12 @@ namespace DocFileFormat
|
||||
//of the OptionEntry arry, sorted by pid
|
||||
for (unsigned int i = 0; i < instance; ++i)
|
||||
{
|
||||
if (Options[i].fComplex)
|
||||
{
|
||||
int read_size = (int)Options[i].op + 6 ; //????
|
||||
//todooo !!!! проверить все остальные !! тут размер в зависимости от типа Complex!!!
|
||||
switch(Options[i].pid)
|
||||
{
|
||||
case PropertyId::gtextUNICODE:
|
||||
case PropertyId::gtextFont:
|
||||
read_size = (int)Options[i].op;
|
||||
break;
|
||||
}
|
||||
Options[i].opComplex = Reader->ReadBytes( read_size, true );
|
||||
if (Options[i]->fComplex && Options[i]->op > 0)
|
||||
{
|
||||
Options[i]->opComplex = std::shared_ptr<unsigned char>(Reader->ReadBytes( Options[i]->op, true ));
|
||||
}
|
||||
|
||||
OptionsByID.insert(std::pair<PropertyId, OptionEntry>(Options[i].pid, Options[i]));
|
||||
OptionsByID.insert(std::make_pair(Options[i]->pid, Options[i]));
|
||||
}
|
||||
|
||||
Reader->Seek(( pos + size ), 0/*STREAM_SEEK_SET*/);
|
||||
|
||||
@ -241,7 +241,7 @@ namespace DocFileFormat
|
||||
std::wstring strHeight = FormatUtils::DoubleToWideString( height.ToPoints() );
|
||||
std::wstring strStyle;
|
||||
|
||||
std::list<OptionEntry> options;
|
||||
std::vector<OptionEntryPtr> options;
|
||||
|
||||
PictureFrameType type;
|
||||
if ((pict->shapeContainer || pict->blipStoreEntry) && pict->shapeContainer->Children.size() > 0)
|
||||
@ -282,9 +282,9 @@ namespace DocFileFormat
|
||||
}
|
||||
//todooo oбъединить с shape_mapping
|
||||
|
||||
std::list<OptionEntry>::iterator end = options.end();
|
||||
for (std::list<OptionEntry>::iterator iter = options.begin(); iter != end; ++iter)
|
||||
for (size_t i = 0; i < options.size(); i++)
|
||||
{
|
||||
OptionEntryPtr & iter = options[i];
|
||||
switch ( iter->pid )
|
||||
{
|
||||
case wzEquationXML:
|
||||
@ -292,7 +292,7 @@ namespace DocFileFormat
|
||||
m_isEquation = true;
|
||||
m_isEmbedded = true;
|
||||
|
||||
m_embeddedData = std::string((char*)iter->opComplex, iter->op);
|
||||
m_embeddedData = std::string((char*)iter->opComplex.get(), iter->op);
|
||||
|
||||
if (ParseEmbeddedEquation( m_embeddedData, m_equationXml))
|
||||
{
|
||||
@ -303,7 +303,7 @@ namespace DocFileFormat
|
||||
{
|
||||
//встроенная неведомая хуйня
|
||||
m_isEmbedded = true;
|
||||
m_embeddedData = std::string((char*)iter->opComplex, iter->op);
|
||||
m_embeddedData = std::string((char*)iter->opComplex.get(), iter->op);
|
||||
|
||||
//if (ParseEmbeddedBlob( m_embeddedData, m_blobXml)) // todoooo
|
||||
//{
|
||||
|
||||
@ -143,8 +143,9 @@ namespace DocFileFormat
|
||||
ShapeContainer* groupShape = static_cast<ShapeContainer*>(container->Children[0]);
|
||||
GroupShapeRecord* gsr = static_cast<GroupShapeRecord*>(groupShape->Children[0]);
|
||||
Shape* shape = static_cast<Shape*>(groupShape->Children[1]);
|
||||
std::list<OptionEntry> options = groupShape->ExtractOptions();
|
||||
ChildAnchor* anchor = groupShape->FirstChildWithType<ChildAnchor>();
|
||||
|
||||
ChildAnchor* anchor = groupShape->FirstChildWithType<ChildAnchor>();
|
||||
std::vector<OptionEntryPtr> options = groupShape->ExtractOptions();
|
||||
|
||||
m_shapeId = GetShapeID(shape);
|
||||
|
||||
@ -155,14 +156,13 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteAttribute( L"coordsize", ( FormatUtils::IntToWideString(gsr->rcgBounds.size.cx) + L"," + FormatUtils::IntToWideString(gsr->rcgBounds.size.cy)));
|
||||
|
||||
// Write wrap coords
|
||||
std::list<OptionEntry>::const_iterator end = options.end();
|
||||
for (std::list<OptionEntry>::const_iterator iter = options.begin(); iter != end; ++iter)
|
||||
for (size_t i = 0; i < options.size(); i++)
|
||||
{
|
||||
switch (iter->pid)
|
||||
switch (options[i]->pid)
|
||||
{
|
||||
case pWrapPolygonVertices:
|
||||
case pWrapPolygonVertices:
|
||||
{
|
||||
std::wstring wrapCoords = getWrapCoords(*iter);
|
||||
std::wstring wrapCoords = GetWrapCoords(options[i]);
|
||||
if (wrapCoords.length())
|
||||
m_pXmlWriter->WriteAttribute(L"wrapcoords", wrapCoords);
|
||||
}
|
||||
@ -226,9 +226,9 @@ namespace DocFileFormat
|
||||
bool freeform = true;
|
||||
std::wstring sShapeId;
|
||||
|
||||
std::list<OptionEntry> options = pContainer->ExtractOptions();
|
||||
ChildAnchor* pAnchor = pContainer->FirstChildWithType<ChildAnchor>();
|
||||
ClientAnchor* clientAnchor = pContainer->FirstChildWithType<ClientAnchor>();
|
||||
std::vector<OptionEntryPtr> options = pContainer->ExtractOptions();
|
||||
ChildAnchor* pAnchor = pContainer->FirstChildWithType<ChildAnchor>();
|
||||
ClientAnchor* clientAnchor = pContainer->FirstChildWithType<ClientAnchor>();
|
||||
|
||||
WriteBeginShapeNode (pShape);
|
||||
|
||||
@ -294,13 +294,17 @@ namespace DocFileFormat
|
||||
|
||||
std::wstring sTextboxStyle;
|
||||
|
||||
std::wstring adjValues[8];
|
||||
ShadowStyleBooleanProperties shadowBoolean(0);
|
||||
std::vector<std::wstring> arrInscribe;
|
||||
|
||||
OptionEntryPtr opSegmentInfo;
|
||||
OptionEntryPtr opVerticles;
|
||||
OptionEntryPtr opInscribe;
|
||||
OptionEntryPtr opConnectAngles;
|
||||
OptionEntryPtr opConnectLocs;
|
||||
|
||||
std::list<OptionEntry>::const_iterator end = options.end();
|
||||
for (std::list<OptionEntry>::const_iterator iter = options.begin(); iter != end; ++iter)
|
||||
for (size_t i = 0; i < options.size(); i++)
|
||||
{
|
||||
OptionEntryPtr & iter = options[i];
|
||||
switch (iter->pid)
|
||||
{
|
||||
//BOOLEANS
|
||||
@ -335,19 +339,16 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case protectionBooleans:
|
||||
{
|
||||
ProtectionBooleanProperties booleans(iter->op);
|
||||
}
|
||||
break;
|
||||
|
||||
case diagramBooleans:
|
||||
{
|
||||
DiagramBooleanProperties booleans(iter->op);
|
||||
}
|
||||
break;
|
||||
|
||||
case groupShapeBooleans:
|
||||
{
|
||||
GroupShapeBooleanProperties booleans(iter->op);
|
||||
@ -357,56 +358,80 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// GEOMETRY
|
||||
|
||||
// GEOMETRY
|
||||
case shapePath :
|
||||
{
|
||||
bHavePath = true;
|
||||
}break;
|
||||
case pVertices:
|
||||
{
|
||||
opVerticles = iter;
|
||||
}break;
|
||||
case pSegmentInfo:
|
||||
{
|
||||
opSegmentInfo = iter;
|
||||
}break;
|
||||
case pGuides:
|
||||
{
|
||||
GetGuides(iter);
|
||||
}break;
|
||||
case pConnectionSites:
|
||||
{
|
||||
opConnectLocs = iter;
|
||||
}break;
|
||||
case pConnectionSitesDir:
|
||||
{
|
||||
opConnectAngles = iter;
|
||||
}break;
|
||||
case pInscribe:
|
||||
{
|
||||
opInscribe = iter;
|
||||
}break;
|
||||
case adjustValue:
|
||||
{
|
||||
adjValues[0] = FormatUtils::IntToWideString( (int)iter->op );
|
||||
nAdjValues = (std::max)(nAdjValues,1);
|
||||
m_nAdjValues[0] = (int)iter->op;
|
||||
nAdjValues = (std::max)(nAdjValues,1);
|
||||
}
|
||||
break;
|
||||
|
||||
case adjust2Value:
|
||||
{
|
||||
adjValues[1] = FormatUtils::IntToWideString( (int)iter->op );
|
||||
nAdjValues = (std::max)(nAdjValues,2);
|
||||
m_nAdjValues[1] = (int)iter->op;
|
||||
nAdjValues = (std::max)(nAdjValues, 2);
|
||||
}
|
||||
break;
|
||||
|
||||
case adjust3Value:
|
||||
{
|
||||
adjValues[2] = FormatUtils::IntToWideString( (int)iter->op );
|
||||
nAdjValues = (std::max)(nAdjValues,3);
|
||||
m_nAdjValues[2] = (int)iter->op;
|
||||
nAdjValues =(std::max)(nAdjValues, 3);
|
||||
}break;
|
||||
case adjust4Value:
|
||||
{
|
||||
adjValues[3] = FormatUtils::IntToWideString( (int)iter->op );
|
||||
nAdjValues = (std::max)(nAdjValues,4);
|
||||
m_nAdjValues[3] = (int)iter->op;
|
||||
nAdjValues = (std::max)(nAdjValues, 4);
|
||||
}break;
|
||||
case adjust5Value:
|
||||
{
|
||||
adjValues[4] = FormatUtils::IntToWideString( (int)iter->op );
|
||||
nAdjValues = (std::max)(nAdjValues,5);
|
||||
m_nAdjValues[4] = (int)iter->op;
|
||||
nAdjValues = (std::max)(nAdjValues, 5);
|
||||
}break;
|
||||
case adjust6Value:
|
||||
{
|
||||
adjValues[5] = FormatUtils::IntToWideString( (int)iter->op );
|
||||
nAdjValues = (std::max)(nAdjValues,6);
|
||||
m_nAdjValues[5] = (int)iter->op;
|
||||
nAdjValues = (std::max)(nAdjValues, 6);
|
||||
}break;
|
||||
case adjust7Value:
|
||||
{
|
||||
adjValues[6] = FormatUtils::IntToWideString( (int)iter->op );
|
||||
nAdjValues = (std::max)(nAdjValues,7);
|
||||
m_nAdjValues[6] = (int)iter->op;
|
||||
nAdjValues = (std::max)(nAdjValues, 7);
|
||||
}break;
|
||||
case adjust8Value:
|
||||
{
|
||||
adjValues[7] = FormatUtils::IntToWideString( (int)iter->op );
|
||||
nAdjValues = (std::max)(nAdjValues,8);
|
||||
m_nAdjValues[7] = (int)iter->op;
|
||||
nAdjValues = (std::max)(nAdjValues, 8);
|
||||
}break;
|
||||
case pWrapPolygonVertices:
|
||||
{
|
||||
std::wstring wrapCoords = getWrapCoords(*iter);
|
||||
std::wstring wrapCoords = GetWrapCoords(iter);
|
||||
|
||||
if (!wrapCoords.empty())
|
||||
{
|
||||
@ -421,13 +446,6 @@ namespace DocFileFormat
|
||||
{
|
||||
yCoord = iter->op;
|
||||
}break;
|
||||
case pGuides:
|
||||
{
|
||||
}break;
|
||||
case pInscribe:
|
||||
{
|
||||
arrInscribe = GetTextRectangles(*iter);
|
||||
}break;
|
||||
// OUTLINE
|
||||
case lineColor:
|
||||
{
|
||||
@ -497,7 +515,7 @@ namespace DocFileFormat
|
||||
}break;
|
||||
case fillShadeColors:
|
||||
{
|
||||
appendValueAttribute(&m_fill, L"colors", getFillColorString( iter->opComplex, iter->op ));
|
||||
appendValueAttribute(&m_fill, L"colors", getFillColorString( iter->opComplex.get(), iter->op ));
|
||||
}break;
|
||||
case fillFocus:
|
||||
{
|
||||
@ -602,7 +620,7 @@ namespace DocFileFormat
|
||||
case pibName:
|
||||
{
|
||||
std::wstring name;
|
||||
FormatUtils::GetSTLCollectionFromBytes<std::wstring>(&name, iter->opComplex, iter->op, ENCODING_UTF16);
|
||||
FormatUtils::GetSTLCollectionFromBytes<std::wstring>(&name, iter->opComplex.get(), iter->op, ENCODING_UTF16);
|
||||
if (!name.empty())
|
||||
appendValueAttribute(&m_imagedata, L"o:title", FormatUtils::XmlEncode(name));
|
||||
}break;
|
||||
@ -676,10 +694,10 @@ namespace DocFileFormat
|
||||
hasTextbox = true;
|
||||
nLTxID = (((iter->op) >> 16) & 0xFFFF);
|
||||
}break;
|
||||
case dxTextLeft: {ndxTextLeft = (int)iter->op;break;}
|
||||
case dyTextTop: {ndyTextTop = (int)iter->op;break;}
|
||||
case dxTextRight: {ndxTextRight = (int)iter->op;break;}
|
||||
case dyTextBottom: {ndyTextBottom = (int)iter->op;break;}
|
||||
case dxTextLeft: {ndxTextLeft = (int)iter->op; break;}
|
||||
case dyTextTop: {ndyTextTop = (int)iter->op; break;}
|
||||
case dxTextRight: {ndxTextRight = (int)iter->op; break;}
|
||||
case dyTextBottom: {ndyTextBottom = (int)iter->op; break;}
|
||||
case txflTextFlow:
|
||||
{
|
||||
switch(iter->op)
|
||||
@ -700,7 +718,7 @@ namespace DocFileFormat
|
||||
// Word Art
|
||||
case gtextUNICODE:
|
||||
{
|
||||
std::wstring text = NSStringExt::CConverter::GetUnicodeFromUTF16((unsigned short*)iter->opComplex, (iter->op)/2);
|
||||
std::wstring text = NSStringExt::CConverter::GetUnicodeFromUTF16((unsigned short*)iter->opComplex.get(), (iter->op)/2);
|
||||
|
||||
text = FormatUtils::XmlEncode(text);
|
||||
|
||||
@ -713,7 +731,7 @@ namespace DocFileFormat
|
||||
}break;
|
||||
case gtextFont:
|
||||
{
|
||||
std::wstring font = NSStringExt::CConverter::GetUnicodeFromUTF16((unsigned short*)iter->opComplex, (iter->op)/2);
|
||||
std::wstring font = NSStringExt::CConverter::GetUnicodeFromUTF16((unsigned short*)iter->opComplex.get(), (iter->op)/2);
|
||||
int i = font.size();
|
||||
while (i > 0)
|
||||
{
|
||||
@ -764,31 +782,31 @@ namespace DocFileFormat
|
||||
appendStyleProperty(&m_textPathStyle, L"font-weight", L"bold");
|
||||
}
|
||||
}break;
|
||||
// PATH
|
||||
case shapePath :
|
||||
{
|
||||
bHavePath = true;
|
||||
|
||||
std::wstring path = ParsePath(options);
|
||||
|
||||
if (false == path.empty())
|
||||
m_pXmlWriter->WriteAttribute (L"path", path);
|
||||
}break;
|
||||
default:
|
||||
default:
|
||||
{
|
||||
int val = iter->op;
|
||||
}break;
|
||||
}
|
||||
}
|
||||
|
||||
if (false == bHavePath) // фигура может быть задана только наборами вершин и индексов
|
||||
if (opVerticles && opSegmentInfo)
|
||||
{
|
||||
std::wstring path = ParsePath(options);
|
||||
const unsigned char* pVP = opVerticles->opComplex.get();
|
||||
unsigned int nVP = opVerticles->op;
|
||||
const unsigned char* pSI = opSegmentInfo->opComplex.get();
|
||||
unsigned int nSI = opSegmentInfo->op;
|
||||
|
||||
PathParser oParser (pSI, nSI, pVP, nVP, m_arrGuides);
|
||||
std::wstring path = oParser.GetVmlPath();
|
||||
|
||||
if (false == path.empty())
|
||||
m_pXmlWriter->WriteAttribute (L"path", path);
|
||||
}
|
||||
|
||||
if (freeform && (xCoord == 0 || yCoord == 0 ))
|
||||
{
|
||||
xCoord = 21600;
|
||||
yCoord = 21600;
|
||||
}
|
||||
if ( !filled )
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"filled", L"f" );
|
||||
@ -804,10 +822,10 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteAttribute(L"o:allowincell", L"f");
|
||||
}
|
||||
|
||||
if ( ( xCoord > 0 ) && ( yCoord > 0 ) )
|
||||
if ( xCoord > 0 && yCoord > 0 )
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"coordsize", ( FormatUtils::IntToWideString( xCoord ) + L"," + FormatUtils::IntToWideString( yCoord ) ));
|
||||
}
|
||||
}
|
||||
|
||||
int nCode = 0;
|
||||
if (pShape->GetShapeType())
|
||||
@ -819,17 +837,17 @@ namespace DocFileFormat
|
||||
{
|
||||
if (nAdjValues)
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute(L"arcsize", adjValues[0]);
|
||||
m_pXmlWriter->WriteAttribute(L"arcsize", m_nAdjValues[0]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nAdjValues)
|
||||
if (nAdjValues > 0)
|
||||
{
|
||||
std::wstring adjTag = adjValues[0];
|
||||
std::wstring adjTag = std::to_wstring(m_nAdjValues[0]);
|
||||
|
||||
for (int i = 1; i < nAdjValues; ++i)
|
||||
adjTag += std::wstring(L",") + adjValues[i];
|
||||
adjTag += L"," + std::to_wstring(m_nAdjValues[i]);
|
||||
|
||||
m_pXmlWriter->WriteAttribute(L"adj", adjTag);
|
||||
}
|
||||
@ -982,10 +1000,24 @@ namespace DocFileFormat
|
||||
}
|
||||
if (freeform)
|
||||
{
|
||||
if (arrInscribe.size())
|
||||
if (opInscribe || opConnectAngles || opConnectLocs)
|
||||
{
|
||||
std::vector<std::wstring> arrInscribe = GetTextRectangles(opInscribe);
|
||||
std::wstring strConnectAngles = GetConnectAngles(opConnectAngles);
|
||||
std::wstring strConnectLocs = GetConnectLocs(opConnectLocs);
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin(L"v:path", true);
|
||||
m_pXmlWriter->WriteAttribute(L"textboxrect", arrInscribe[0]);
|
||||
if (!arrInscribe.empty())
|
||||
m_pXmlWriter->WriteAttribute(L"textboxrect", arrInscribe[0]);
|
||||
if (!strConnectAngles.empty() || !strConnectLocs.empty())
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute(L"o:connecttype", L"custom");
|
||||
if (!strConnectLocs.empty())
|
||||
m_pXmlWriter->WriteAttribute(L"o:connectlocs", strConnectLocs);
|
||||
if (!strConnectAngles.empty())
|
||||
m_pXmlWriter->WriteAttribute(L"o:connectangles", strConnectAngles);
|
||||
}
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd(L"", true);
|
||||
}
|
||||
}
|
||||
@ -1182,11 +1214,13 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
/// Build the VML wrapcoords string for a given pWrapPolygonVertices
|
||||
std::wstring VMLShapeMapping::getWrapCoords(const OptionEntry& pWrapPolygonVertices) const
|
||||
std::wstring VMLShapeMapping::GetWrapCoords(const OptionEntryPtr& pWrapPolygonVertices) const
|
||||
{
|
||||
if (!pWrapPolygonVertices) return L"";
|
||||
|
||||
std::wstring coords;
|
||||
|
||||
MemoryStream oStream(pWrapPolygonVertices.opComplex, pWrapPolygonVertices.op);
|
||||
MemoryStream oStream(pWrapPolygonVertices->opComplex.get(), pWrapPolygonVertices->op);
|
||||
std::list<int> arrVertices;
|
||||
|
||||
unsigned short nElems = oStream.ReadUInt16();
|
||||
@ -1498,7 +1532,7 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
void VMLShapeMapping::AppendOptionsToStyle (std::wstring* oStyle, const std::list<OptionEntry>& options, int zIndex) const
|
||||
void VMLShapeMapping::AppendOptionsToStyle (std::wstring* oStyle, const std::vector<OptionEntryPtr>& options, int zIndex) const
|
||||
{
|
||||
bool bRelH = false;
|
||||
bool bRelV = false;
|
||||
@ -1508,9 +1542,9 @@ namespace DocFileFormat
|
||||
|
||||
bool bZIndex = false;
|
||||
|
||||
std::list<OptionEntry>::const_iterator end = options.end();
|
||||
for (std::list<OptionEntry>::const_iterator iter = options.begin(); iter != end; ++iter)
|
||||
for (size_t i = 0; i < options.size(); i++)
|
||||
{
|
||||
const OptionEntryPtr & iter = options[i];
|
||||
switch (iter->pid)
|
||||
{
|
||||
// POSITIONING
|
||||
@ -1616,15 +1650,16 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
//
|
||||
std::wstring VMLShapeMapping::buildStyle (const Shape* shape, const ChildAnchor* anchor, const std::list<OptionEntry>& options, int zIndex) const
|
||||
std::wstring VMLShapeMapping::buildStyle (const Shape* shape, const ChildAnchor* anchor, const std::vector<OptionEntryPtr>& options, int zIndex) const
|
||||
{
|
||||
std::wstring style;
|
||||
|
||||
// Check if some properties are set that cause the dimensions to be twisted
|
||||
bool twistDimensions = false;
|
||||
std::list<OptionEntry>::const_iterator end = options.end();
|
||||
for (std::list<OptionEntry>::const_iterator iter = options.begin(); iter != end; ++iter)
|
||||
|
||||
for (size_t i = 0; i < options.size(); i++)
|
||||
{
|
||||
const OptionEntryPtr & iter = options[i];
|
||||
|
||||
if (geometryTextBooleanProperties == iter->pid)
|
||||
{
|
||||
GeometryTextBooleanProperties props(iter->op);
|
||||
@ -1860,61 +1895,210 @@ namespace DocFileFormat
|
||||
|
||||
return wrapType;
|
||||
}
|
||||
|
||||
std::wstring VMLShapeMapping::ParsePath (const std::list<OptionEntry>& options) const
|
||||
std::wstring VMLShapeMapping::GetConnectAngles(const OptionEntryPtr& opAngles) const
|
||||
{
|
||||
const unsigned char* pVP = NULL;
|
||||
unsigned int nVP = 0;
|
||||
const unsigned char* pSI = NULL;
|
||||
unsigned int nSI = 0;
|
||||
if (!opAngles) return L"";
|
||||
if (!opAngles->opComplex) return L"";
|
||||
|
||||
std::list<OptionEntry>::const_iterator end = options.end();
|
||||
for (std::list<OptionEntry>::const_iterator iter = options.begin(); iter != end; ++iter)
|
||||
MemoryStream reader(opAngles->opComplex.get(), opAngles->op);
|
||||
|
||||
unsigned short nElems = reader.ReadUInt16();
|
||||
unsigned short nElemsAlloc = reader.ReadUInt16();
|
||||
unsigned short nElemSize = reader.ReadUInt16();
|
||||
|
||||
bool bTruncated = false;
|
||||
|
||||
if (0xFFF0 == nElemSize)
|
||||
{
|
||||
nElemSize = 4;
|
||||
bTruncated = true;
|
||||
}
|
||||
|
||||
long dwSize = nElems * nElemSize;
|
||||
|
||||
if (opAngles->op - 6 != (dwSize))
|
||||
{
|
||||
bool b = false;
|
||||
}
|
||||
if (nElemSize < 1) return L"";
|
||||
|
||||
int count = dwSize / nElemSize;
|
||||
|
||||
std::wstring angles;
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
if (iter->pid == pVertices)
|
||||
{
|
||||
pVP = iter->opComplex;
|
||||
nVP = iter->op;
|
||||
}
|
||||
|
||||
if (iter->pid == pSegmentInfo)
|
||||
{
|
||||
pSI = iter->opComplex;
|
||||
nSI = iter->op;
|
||||
}
|
||||
DWORD v = reader.ReadUInt32();
|
||||
double val = (double)((WORD)(v >> 16) + ((WORD)(v) / 65536.0));
|
||||
angles += std::to_wstring((int)val) + (i < (count - 1) ? L"," : L"");
|
||||
}
|
||||
return angles;
|
||||
}
|
||||
int VMLShapeMapping::UpdateFromGuides(const int val) const
|
||||
{
|
||||
int new_val = val;
|
||||
LONG lMinF = (LONG)0x80000000;
|
||||
if (lMinF <= val)
|
||||
{
|
||||
int index = (DWORD)val - 0x80000000;
|
||||
|
||||
if (index >= 0 && index < m_arrGuides.size())
|
||||
{
|
||||
new_val = m_arrGuides[index].param3;
|
||||
}
|
||||
|
||||
PathParser oParser (pSI, nSI, pVP, nVP);
|
||||
return oParser.GetVmlPath();
|
||||
}
|
||||
return new_val;
|
||||
}
|
||||
void VMLShapeMapping::GetGuides( const OptionEntryPtr& opGuides )
|
||||
{
|
||||
if (!opGuides) return;
|
||||
if (!opGuides->opComplex) return;
|
||||
|
||||
MemoryStream reader(opGuides->opComplex.get(), opGuides->op);
|
||||
|
||||
unsigned short nElems = reader.ReadUInt16();
|
||||
unsigned short nElemsAlloc = reader.ReadUInt16();
|
||||
unsigned short nElemSize = reader.ReadUInt16();
|
||||
|
||||
bool bTruncated = false;
|
||||
|
||||
if (0xFFF0 == nElemSize)
|
||||
{
|
||||
nElemSize = 4;
|
||||
bTruncated = true;
|
||||
}
|
||||
long dwSize = nElems * nElemSize;
|
||||
|
||||
if (opGuides->op - 6 != (dwSize))
|
||||
{
|
||||
bool b = false;
|
||||
}
|
||||
int count = dwSize / nElemSize; //1x (int or short)
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
_guides g;
|
||||
WORD flags = reader.ReadUInt16();
|
||||
|
||||
g.type = flags & 0x1FFF;
|
||||
|
||||
g.param_type1 = (unsigned char)(flags & 0x04);
|
||||
g.param_type2 = (unsigned char)(flags & 0x02);
|
||||
g.param_type3 = (unsigned char)(flags & 0x01);
|
||||
|
||||
g.param1 = reader.ReadUInt16();
|
||||
g.param2 = reader.ReadUInt16();
|
||||
g.param3 = reader.ReadUInt16();
|
||||
|
||||
m_arrGuides.push_back(g);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
std::vector<std::wstring> VMLShapeMapping::GetTextRectangles(const OptionEntry& inscribe) const
|
||||
std::wstring VMLShapeMapping::GetConnectLocs( const OptionEntryPtr& opLocs ) const
|
||||
{
|
||||
MemoryStream reader(inscribe.opComplex, inscribe.op + 6);
|
||||
if (!opLocs) return L"";
|
||||
if (!opLocs->opComplex) return L"";
|
||||
|
||||
unsigned short elems = reader.ReadUInt16();
|
||||
unsigned short allocElems = reader.ReadUInt16();
|
||||
unsigned short cb = reader.ReadUInt16();
|
||||
|
||||
MemoryStream reader(opLocs->opComplex.get(), opLocs->op);
|
||||
|
||||
unsigned short nElems = reader.ReadUInt16();
|
||||
unsigned short nElemsAlloc = reader.ReadUInt16();
|
||||
unsigned short nElemSize = reader.ReadUInt16();
|
||||
|
||||
bool bTruncated = false;
|
||||
|
||||
if (0xFFF0 == nElemSize)
|
||||
{
|
||||
nElemSize = 4;
|
||||
bTruncated = true;
|
||||
}
|
||||
|
||||
long dwSize = nElems * nElemSize;
|
||||
|
||||
if (opLocs->op - 6 != (dwSize))
|
||||
{
|
||||
bool b = false;
|
||||
}
|
||||
int count = dwSize / nElemSize; //2x (int or short)
|
||||
|
||||
std::wstring locs;
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
POINT pt;
|
||||
|
||||
if (bTruncated)
|
||||
{
|
||||
pt.x = reader.ReadInt16();
|
||||
pt.y = reader.ReadInt16();
|
||||
}
|
||||
else
|
||||
{
|
||||
pt.x = reader.ReadInt32();
|
||||
pt.y = reader.ReadInt32();
|
||||
}
|
||||
|
||||
pt.x = UpdateFromGuides(pt.x);
|
||||
pt.y = UpdateFromGuides(pt.y);
|
||||
|
||||
locs += std::to_wstring(pt.x) + L"," + std::to_wstring(pt.y) + (i < (count - 1) ? L";" : L"");
|
||||
}
|
||||
|
||||
return locs;
|
||||
}
|
||||
|
||||
std::vector<std::wstring> VMLShapeMapping::GetTextRectangles( const OptionEntryPtr& opInscribe ) const
|
||||
{
|
||||
std::vector<std::wstring> rectangles;
|
||||
|
||||
if (!opInscribe) return rectangles;
|
||||
if (!opInscribe->opComplex) return rectangles;
|
||||
|
||||
if (16 != cb) return rectangles; // TODO: доделать
|
||||
MemoryStream reader(opInscribe->opComplex.get(), opInscribe->op);
|
||||
|
||||
int count = (inscribe.op) / 16;
|
||||
unsigned short nElems = reader.ReadUInt16();
|
||||
unsigned short nElemsAlloc = reader.ReadUInt16();
|
||||
unsigned short nElemSize = reader.ReadUInt16();
|
||||
|
||||
bool bTruncated = false;
|
||||
|
||||
if (0xFFF0 == nElemSize)
|
||||
{
|
||||
nElemSize = 4;
|
||||
bTruncated = true;
|
||||
}
|
||||
|
||||
long dwSize = nElems * nElemSize;
|
||||
|
||||
if (opInscribe->op - 6 != (dwSize))
|
||||
{
|
||||
bool b = false;
|
||||
}
|
||||
int count = dwSize / nElemSize; //4x (int or short)
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
RECT rc;
|
||||
|
||||
rc.top = reader.ReadInt32();
|
||||
rc.left = reader.ReadInt32();
|
||||
rc.right = reader.ReadInt32();
|
||||
rc.bottom = reader.ReadInt32();
|
||||
if (bTruncated)
|
||||
{
|
||||
rc.top = reader.ReadInt16();
|
||||
rc.left = reader.ReadInt16();
|
||||
rc.right = reader.ReadInt16();
|
||||
rc.bottom = reader.ReadInt16();
|
||||
}
|
||||
else
|
||||
{
|
||||
rc.top = reader.ReadInt32();
|
||||
rc.left = reader.ReadInt32();
|
||||
rc.right = reader.ReadInt32();
|
||||
rc.bottom = reader.ReadInt32();
|
||||
}
|
||||
rc.top = UpdateFromGuides(rc.top);
|
||||
rc.left = UpdateFromGuides(rc.left);
|
||||
rc.right = UpdateFromGuides(rc.right);
|
||||
rc.bottom = UpdateFromGuides(rc.bottom);
|
||||
|
||||
std::wstringstream sstream;
|
||||
sstream << boost::wformat(L"%d,%d,%d,%d") % rc.top % rc.left % rc.right % rc.bottom;
|
||||
rectangles.push_back(sstream.str());
|
||||
rectangles.push_back( std::to_wstring(rc.top) + L"," + std::to_wstring(rc.left) + L"," +
|
||||
std::to_wstring(rc.right) + L"," + std::to_wstring(rc.bottom));
|
||||
}
|
||||
|
||||
return rectangles;
|
||||
|
||||
@ -77,17 +77,10 @@ namespace DocFileFormat
|
||||
|
||||
void WritePrimitiveProps(DrawingPrimitive * primitive, bool root);
|
||||
|
||||
// Converts a group of shapes
|
||||
void WriteGroup(const GroupContainer* pContainer);
|
||||
// Converts a single shape
|
||||
void WriteShape (const ShapeContainer* pContainer);
|
||||
|
||||
/// Generates a string id for the given shape
|
||||
std::wstring GenShapeId(const Shape* pShape) const;
|
||||
/// Build the VML wrapcoords string for a given pWrapPolygonVertices
|
||||
std::wstring getWrapCoords( const OptionEntry& pWrapPolygonVertices ) const;
|
||||
/// Copies the picture from the binary stream to the zip archive
|
||||
/// and creates the relationships for the image.
|
||||
bool copyPicture( const BlipStoreEntry* bse );
|
||||
std::wstring GetTargetExt( Global::BlipType _type ) const;
|
||||
|
||||
@ -98,21 +91,22 @@ namespace DocFileFormat
|
||||
|
||||
std::wstring getTextboxAnchor( unsigned int anchor ) const;
|
||||
|
||||
void AppendOptionsToStyle( std::wstring* style, const std::list<OptionEntry>& options, int zIndex ) const;
|
||||
std::wstring buildStyle ( const Shape* shape, const ChildAnchor* anchor, const std::vector<OptionEntryPtr>& options, int zIndex ) const;
|
||||
void AppendOptionsToStyle ( std::wstring* style, const std::vector<OptionEntryPtr>& options, int zIndex ) const;
|
||||
|
||||
std::wstring buildStyle ( const Shape* shape, const ChildAnchor* anchor, const std::list<OptionEntry>& options, int zIndex ) const;
|
||||
int UpdateFromGuides(const int val) const;
|
||||
|
||||
std::wstring getLineStyle ( unsigned int p ) const;
|
||||
std::wstring getArrowStyle ( unsigned int op ) const;
|
||||
std::wstring getArrowLength ( unsigned int op ) const;
|
||||
std::wstring getArrowWidth ( unsigned int op ) const;
|
||||
std::wstring getFillMethod ( unsigned int p ) const;
|
||||
std::wstring getFillColorString( const unsigned char* p, unsigned int size ) const;
|
||||
/// Returns the OpenXML fill type of a fill effect
|
||||
|
||||
std::wstring getFillType ( unsigned int p ) const;
|
||||
std::wstring getShadowType ( unsigned int p ) const;
|
||||
/// Returns the OpenXML wrap type of the shape
|
||||
|
||||
std::wstring getWrapType (const Spa* pSpa) const;
|
||||
std::wstring ParsePath (const std::list<OptionEntry>& options) const;
|
||||
|
||||
void WriteBeginShapeNode (const Shape* pShape);
|
||||
void WriteEndShapeNode (const Shape* pShape);
|
||||
@ -121,9 +115,15 @@ namespace DocFileFormat
|
||||
std::wstring GetLineFrom (const ChildAnchor* pAnchor) const;
|
||||
std::wstring GetLineTo (const ChildAnchor* pAnchor) const;
|
||||
|
||||
std::vector<std::wstring> GetTextRectangles(const OptionEntry& inscribe) const;
|
||||
std::wstring GetWrapCoords ( const OptionEntryPtr& pOpt ) const;
|
||||
std::vector<std::wstring> GetTextRectangles ( const OptionEntryPtr& pOpt ) const;
|
||||
std::wstring GetConnectAngles ( const OptionEntryPtr& pOpt ) const;
|
||||
std::wstring GetConnectLocs ( const OptionEntryPtr& pOpt ) const;
|
||||
void GetGuides ( const OptionEntryPtr& pOpt );
|
||||
|
||||
private:
|
||||
int m_nAdjValues[8];
|
||||
std::vector<_guides> m_arrGuides;
|
||||
|
||||
bool m_isInlineShape;
|
||||
Spa* m_pSpa;
|
||||
IMapping* m_pCaller;
|
||||
|
||||
@ -3801,19 +3801,228 @@ public:
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
CFldSimple* pFldSimple = static_cast<CFldSimple*>(poResult);
|
||||
if ( c_oSer_HyperlinkType::Link == type )
|
||||
if ( c_oSer_FldSimpleType::Instr == type )
|
||||
pFldSimple->sInstr = m_oBufferedStream.GetString3(length);
|
||||
else if ( c_oSer_HyperlinkType::Content == type )
|
||||
else if ( c_oSer_FldSimpleType::Content == type )
|
||||
{
|
||||
XmlUtils::CStringWriter* pPrevWriter = m_pCurWriter;
|
||||
m_pCurWriter = &pFldSimple->writer;
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadParagraphContent, this, NULL);
|
||||
m_pCurWriter = pPrevWriter;
|
||||
}
|
||||
else if ( c_oSer_FldSimpleType::FFData == type )
|
||||
{
|
||||
OOX::Logic::CFFData oFFData;
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadFFData, this, &oFFData);
|
||||
pFldSimple->writer.WriteString(oFFData.toXML());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadFFData(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
OOX::Logic::CFFData* pFFData = static_cast<OOX::Logic::CFFData*>(poResult);
|
||||
if ( c_oSerFFData::CalcOnExit == type )
|
||||
{
|
||||
pFFData->m_oCalcOnExit.Init();
|
||||
pFFData->m_oCalcOnExit->m_oVal.FromBool(m_oBufferedStream.GetBool());
|
||||
}
|
||||
else if ( c_oSerFFData::CheckBox == type )
|
||||
{
|
||||
pFFData->m_oCheckBox.Init();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadFFCheckBox, this, pFFData->m_oCheckBox.GetPointer());
|
||||
}
|
||||
else if ( c_oSerFFData::DDList == type )
|
||||
{
|
||||
pFFData->m_oDDList.Init();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadDDList, this, pFFData->m_oDDList.GetPointer());
|
||||
}
|
||||
else if ( c_oSerFFData::Enabled == type )
|
||||
{
|
||||
pFFData->m_oEnabled.Init();
|
||||
pFFData->m_oEnabled->m_oVal.FromBool(m_oBufferedStream.GetBool());
|
||||
}
|
||||
else if ( c_oSerFFData::EntryMacro == type )
|
||||
{
|
||||
std::wstring sVal = m_oBufferedStream.GetString3(length);
|
||||
pFFData->m_oEntryMacro.Init();
|
||||
pFFData->m_oEntryMacro->m_oVal.Init();
|
||||
pFFData->m_oEntryMacro->m_oVal->SetValue(sVal);
|
||||
}
|
||||
else if ( c_oSerFFData::ExitMacro == type )
|
||||
{
|
||||
std::wstring sVal = m_oBufferedStream.GetString3(length);
|
||||
pFFData->m_oExitMacro.Init();
|
||||
pFFData->m_oExitMacro->m_oVal.Init();
|
||||
pFFData->m_oExitMacro->m_oVal->SetValue(sVal);
|
||||
}
|
||||
else if ( c_oSerFFData::HelpText == type )
|
||||
{
|
||||
pFFData->m_oHelpText.Init();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadFFHelpText, this, pFFData->m_oHelpText.GetPointer());
|
||||
}
|
||||
else if ( c_oSerFFData::Label == type )
|
||||
{
|
||||
pFFData->m_oLabel.Init();
|
||||
pFFData->m_oLabel->m_oVal.Init();
|
||||
pFFData->m_oLabel->m_oVal->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if ( c_oSerFFData::Name == type )
|
||||
{
|
||||
std::wstring sVal = m_oBufferedStream.GetString3(length);
|
||||
pFFData->m_oName.Init();
|
||||
pFFData->m_oName->m_oVal.Init();
|
||||
pFFData->m_oName->m_oVal->SetValue(sVal);
|
||||
}
|
||||
else if ( c_oSerFFData::StatusText == type )
|
||||
{
|
||||
pFFData->m_oStatusText.Init();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadFFStatusText, this, pFFData->m_oStatusText.GetPointer());
|
||||
}
|
||||
else if ( c_oSerFFData::TabIndex == type )
|
||||
{
|
||||
pFFData->m_oTabIndex.Init();
|
||||
pFFData->m_oTabIndex->m_oVal.Init();
|
||||
pFFData->m_oTabIndex->m_oVal->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if ( c_oSerFFData::TextInput == type )
|
||||
{
|
||||
pFFData->m_oTextInput.Init();
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadTextInput, this, pFFData->m_oTextInput.GetPointer());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadFFCheckBox(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
OOX::Logic::CFFCheckBox* pFFCheckBox = static_cast<OOX::Logic::CFFCheckBox*>(poResult);
|
||||
if ( c_oSerFFData::CBChecked == type )
|
||||
{
|
||||
pFFCheckBox->m_oChecked.Init();
|
||||
pFFCheckBox->m_oChecked->m_oVal.FromBool(m_oBufferedStream.GetBool());
|
||||
}
|
||||
else if ( c_oSerFFData::CBDefault == type )
|
||||
{
|
||||
pFFCheckBox->m_oDefault.Init();
|
||||
pFFCheckBox->m_oDefault->m_oVal.FromBool(m_oBufferedStream.GetBool());
|
||||
}
|
||||
else if ( c_oSerFFData::CBSize == type )
|
||||
{
|
||||
pFFCheckBox->m_oSize.Init();
|
||||
pFFCheckBox->m_oSize->m_oVal.Init();
|
||||
pFFCheckBox->m_oSize->m_oVal->FromHps(m_oBufferedStream.GetULong());
|
||||
}
|
||||
else if ( c_oSerFFData::CBSizeAuto == type )
|
||||
{
|
||||
pFFCheckBox->m_oSizeAuto.Init();
|
||||
pFFCheckBox->m_oSizeAuto->m_oVal.FromBool(m_oBufferedStream.GetBool());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadDDList(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
OOX::Logic::CFFDDList* pDDList = static_cast<OOX::Logic::CFFDDList*>(poResult);
|
||||
if ( c_oSerFFData::DLDefault == type )
|
||||
{
|
||||
pDDList->m_oDefault.Init();
|
||||
pDDList->m_oDefault->m_oVal.Init();
|
||||
pDDList->m_oDefault->m_oVal->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if ( c_oSerFFData::DLResult == type )
|
||||
{
|
||||
pDDList->m_oResult.Init();
|
||||
pDDList->m_oResult->m_oVal.Init();
|
||||
pDDList->m_oResult->m_oVal->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if ( c_oSerFFData::DLListEntry == type )
|
||||
{
|
||||
ComplexTypes::Word::String* pVal = new ComplexTypes::Word::String();
|
||||
pVal->m_sVal.Init();
|
||||
pVal->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
pDDList->m_arrListEntry.push_back(pVal);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadFFHelpText(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
ComplexTypes::Word::CFFHelpText* pHelpText = static_cast<ComplexTypes::Word::CFFHelpText*>(poResult);
|
||||
if ( c_oSerFFData::HTType == type )
|
||||
{
|
||||
pHelpText->m_oType.Init();
|
||||
pHelpText->m_oType->SetValue((SimpleTypes::EInfoTextType)m_oBufferedStream.GetUChar());
|
||||
}
|
||||
else if ( c_oSerFFData::HTVal == type )
|
||||
{
|
||||
std::wstring sVal = m_oBufferedStream.GetString3(length);
|
||||
pHelpText->m_oVal.Init();
|
||||
pHelpText->m_oVal->SetValue(sVal);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadFFStatusText(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
ComplexTypes::Word::CFFStatusText* pStatusText = static_cast<ComplexTypes::Word::CFFStatusText*>(poResult);
|
||||
if ( c_oSerFFData::HTType == type )
|
||||
{
|
||||
pStatusText->m_oType.Init();
|
||||
pStatusText->m_oType->SetValue((SimpleTypes::EInfoTextType)m_oBufferedStream.GetUChar());
|
||||
}
|
||||
else if ( c_oSerFFData::HTVal == type )
|
||||
{
|
||||
std::wstring sVal = m_oBufferedStream.GetString3(length);
|
||||
pStatusText->m_oVal.Init();
|
||||
pStatusText->m_oVal->SetValue(sVal);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadTextInput(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
OOX::Logic::CFFTextInput* pTextInput = static_cast<OOX::Logic::CFFTextInput*>(poResult);
|
||||
if ( c_oSerFFData::TIDefault == type )
|
||||
{
|
||||
pTextInput->m_oDefault.Init();
|
||||
pTextInput->m_oDefault->m_sVal.Init();
|
||||
pTextInput->m_oDefault->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if ( c_oSerFFData::TIFormat == type )
|
||||
{
|
||||
pTextInput->m_oFormat.Init();
|
||||
pTextInput->m_oFormat->m_sVal.Init();
|
||||
pTextInput->m_oFormat->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if ( c_oSerFFData::TIMaxLength == type )
|
||||
{
|
||||
pTextInput->m_oMaxLength.Init();
|
||||
pTextInput->m_oMaxLength->m_oVal.Init();
|
||||
pTextInput->m_oMaxLength->m_oVal->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if ( c_oSerFFData::TIType == type )
|
||||
{
|
||||
pTextInput->m_oType.Init();
|
||||
pTextInput->m_oType->m_oVal.Init();
|
||||
pTextInput->m_oType->m_oVal->SetValue((SimpleTypes::EFFTextType)m_oBufferedStream.GetUChar());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
|
||||
int ReadHyperlink(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
|
||||
@ -912,7 +912,8 @@ extern int g_nCurFormatVersion;
|
||||
namespace c_oSer_FldSimpleType{ enum c_oSer_FldSimpleType
|
||||
{
|
||||
Content = 0,
|
||||
Instr = 1
|
||||
Instr = 1,
|
||||
FFData = 2
|
||||
};}
|
||||
namespace c_oSer_ColorThemeType{ enum c_oSer_ColorThemeType
|
||||
{
|
||||
@ -1044,6 +1045,34 @@ extern int g_nCurFormatVersion;
|
||||
Temporary = 34,
|
||||
MultiLine = 35
|
||||
};}
|
||||
namespace c_oSerFFData{enum c_oSerFFData
|
||||
{
|
||||
CalcOnExit = 0,
|
||||
CheckBox = 1,
|
||||
DDList = 2,
|
||||
Enabled = 3,
|
||||
EntryMacro = 4,
|
||||
ExitMacro = 5,
|
||||
HelpText = 6,
|
||||
Label = 7,
|
||||
Name = 8,
|
||||
StatusText = 9,
|
||||
TabIndex = 10,
|
||||
TextInput = 11,
|
||||
CBChecked = 12,
|
||||
CBDefault = 13,
|
||||
CBSize = 14,
|
||||
CBSizeAuto = 15,
|
||||
DLDefault = 16,
|
||||
DLResult = 17,
|
||||
DLListEntry = 18,
|
||||
HTType = 19,
|
||||
HTVal = 20,
|
||||
TIDefault = 21,
|
||||
TIFormat = 22,
|
||||
TIMaxLength = 23,
|
||||
TIType = 24,
|
||||
};}
|
||||
}
|
||||
|
||||
#endif // #ifndef DOCX_BIN_READER_WRITER_DEFINES
|
||||
|
||||
@ -3321,11 +3321,208 @@ namespace BinDocxRW
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_FldSimpleType::Instr);
|
||||
m_oBcw.m_oStream.WriteStringW3(*pFldSimple->m_sInstr);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
//FFData
|
||||
if(pFldSimple->m_oFFData.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_FldSimpleType::FFData);
|
||||
WriteFFData(pFldSimple->m_oFFData.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
//Content
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_FldSimpleType::Content);
|
||||
WriteParagraphContent(pFldSimple->m_arrItems);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
void WriteFFData(const OOX::Logic::CFFData& oFFData)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oFFData.m_oCalcOnExit.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::CalcOnExit);
|
||||
m_oBcw.m_oStream.WriteBOOL(oFFData.m_oCalcOnExit->m_oVal.ToBool());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oCheckBox.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::CheckBox);
|
||||
WriteFFCheckBox(oFFData.m_oCheckBox.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oDDList.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::DDList);
|
||||
WriteDDList(oFFData.m_oDDList.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oEnabled.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::Enabled);
|
||||
m_oBcw.m_oStream.WriteBOOL(oFFData.m_oEnabled->m_oVal.ToBool());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oEntryMacro.IsInit() && oFFData.m_oEntryMacro->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::EntryMacro);
|
||||
m_oBcw.m_oStream.WriteStringW3(oFFData.m_oEntryMacro->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oExitMacro.IsInit() && oFFData.m_oExitMacro->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::ExitMacro);
|
||||
m_oBcw.m_oStream.WriteStringW3(oFFData.m_oExitMacro->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oHelpText.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::HelpText);
|
||||
WriteFFHelpText(oFFData.m_oHelpText.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oLabel.IsInit() && oFFData.m_oLabel->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::Label);
|
||||
m_oBcw.m_oStream.WriteLONG(oFFData.m_oLabel->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oName.IsInit() && oFFData.m_oName->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::Name);
|
||||
m_oBcw.m_oStream.WriteStringW3(oFFData.m_oName->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oStatusText.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::StatusText);
|
||||
WriteFFStatusText(oFFData.m_oStatusText.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oTabIndex.IsInit() && oFFData.m_oTabIndex->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::TabIndex);
|
||||
m_oBcw.m_oStream.WriteLONG(oFFData.m_oTabIndex->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oFFData.m_oTextInput.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::TextInput);
|
||||
WriteTextInput(oFFData.m_oTextInput.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteFFCheckBox(const OOX::Logic::CFFCheckBox& oCheckBox)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oCheckBox.m_oChecked.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::CBChecked);
|
||||
m_oBcw.m_oStream.WriteBOOL(oCheckBox.m_oChecked->m_oVal.ToBool());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oCheckBox.m_oDefault.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::CBDefault);
|
||||
m_oBcw.m_oStream.WriteBOOL(oCheckBox.m_oDefault->m_oVal.ToBool());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oCheckBox.m_oSize.IsInit() && oCheckBox.m_oSize->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::CBSize);
|
||||
m_oBcw.m_oStream.WriteULONG(oCheckBox.m_oSize->m_oVal->ToHps());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oCheckBox.m_oSizeAuto.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::CBSizeAuto);
|
||||
m_oBcw.m_oStream.WriteBOOL(oCheckBox.m_oSizeAuto->m_oVal.ToBool());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteDDList(const OOX::Logic::CFFDDList& oDDList)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oDDList.m_oDefault.IsInit() && oDDList.m_oDefault->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::DLDefault);
|
||||
m_oBcw.m_oStream.WriteLONG(oDDList.m_oDefault->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oDDList.m_oResult.IsInit() && oDDList.m_oResult->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::DLResult);
|
||||
m_oBcw.m_oStream.WriteLONG(oDDList.m_oResult->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
for(int i = 0 ; i < oDDList.m_arrListEntry.size(); ++i)
|
||||
{
|
||||
ComplexTypes::Word::String* pVal = oDDList.m_arrListEntry[i];
|
||||
if(pVal->m_sVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::DLListEntry);
|
||||
m_oBcw.m_oStream.WriteStringW3(pVal->m_sVal.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
void WriteFFHelpText(const ComplexTypes::Word::CFFHelpText& oHelpText)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oHelpText.m_oType.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::HTType);
|
||||
m_oBcw.m_oStream.WriteBYTE(oHelpText.m_oType->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oHelpText.m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::HTVal);
|
||||
m_oBcw.m_oStream.WriteStringW3(oHelpText.m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteFFStatusText(const ComplexTypes::Word::CFFStatusText& oStatusText)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oStatusText.m_oType.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::HTType);
|
||||
m_oBcw.m_oStream.WriteBYTE(oStatusText.m_oType->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oStatusText.m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::HTVal);
|
||||
m_oBcw.m_oStream.WriteStringW3(oStatusText.m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteTextInput(const OOX::Logic::CFFTextInput& oTextInput)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oTextInput.m_oDefault.IsInit() && oTextInput.m_oDefault->m_sVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::TIDefault);
|
||||
m_oBcw.m_oStream.WriteStringW3(oTextInput.m_oDefault->m_sVal.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oTextInput.m_oFormat.IsInit() && oTextInput.m_oFormat->m_sVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::TIFormat);
|
||||
m_oBcw.m_oStream.WriteStringW3(oTextInput.m_oFormat->m_sVal.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oTextInput.m_oMaxLength.IsInit() && oTextInput.m_oMaxLength->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::TIMaxLength);
|
||||
m_oBcw.m_oStream.WriteLONG(oTextInput.m_oMaxLength->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oTextInput.m_oType.IsInit() && oTextInput.m_oType->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::TIType);
|
||||
m_oBcw.m_oStream.WriteBYTE(oTextInput.m_oType->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
|
||||
void WriteHyperlink(OOX::Logic::CHyperlink* pHyperlink)
|
||||
{
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="windows-1251"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Version="8,00"
|
||||
Name="OdfFileReaderTest"
|
||||
ProjectGUID="{C2882DDD-07E6-4314-AD4B-48F43F38D722}"
|
||||
RootNamespace="ASCOfficeOdfFileTest"
|
||||
|
||||
@ -132,7 +132,7 @@ void pptx_conversion_context::process_layouts()
|
||||
type == odf_types::presentation_class::header ||
|
||||
type == odf_types::presentation_class::page_number)
|
||||
{
|
||||
if (frame->idx_in_owner <0)
|
||||
if (frame->idx_in_owner < 0)
|
||||
frame->idx_in_owner = last_idx_placeHolder++;
|
||||
|
||||
frame->pptx_convert_placeHolder(*this);
|
||||
@ -199,9 +199,9 @@ void pptx_conversion_context::process_theme(std::wstring name)
|
||||
}
|
||||
start_theme(name);
|
||||
//
|
||||
pptx_serialize_clrScheme(current_theme().clrSchemeData());
|
||||
pptx_serialize_fmtScheme(current_theme().fmtSchemeData());
|
||||
pptx_serialize_fontScheme(current_theme().fontSchemeData());
|
||||
pptx_serialize_clrScheme (current_theme().clrSchemeData());
|
||||
pptx_serialize_fmtScheme (current_theme().fmtSchemeData());
|
||||
pptx_serialize_fontScheme (current_theme().fontSchemeData());
|
||||
//
|
||||
end_theme();
|
||||
|
||||
@ -222,8 +222,6 @@ void pptx_conversion_context::start_document()
|
||||
|
||||
void pptx_conversion_context::end_document()
|
||||
{
|
||||
unsigned int count = 1;
|
||||
|
||||
for (size_t i = 0; i < slideMasters_.size(); i++)
|
||||
{
|
||||
pptx_xml_slideMaster_ptr& slideM = slideMasters_[i];
|
||||
@ -243,10 +241,11 @@ void pptx_conversion_context::end_document()
|
||||
CP_XML_ATTR(L"r:id", slideM->rId());
|
||||
}
|
||||
}
|
||||
count++;
|
||||
}
|
||||
if (!slideMasters_.empty())
|
||||
presentation_.slidesProperties() << slideMasters_[0]->Sizes().str();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
count=0;
|
||||
for (size_t i = 0; i < slides_.size(); i++)
|
||||
{
|
||||
pptx_xml_slide_ptr& slide = slides_[i];
|
||||
@ -262,11 +261,10 @@ void pptx_conversion_context::end_document()
|
||||
{
|
||||
CP_XML_NODE(L"p:sldId")
|
||||
{
|
||||
CP_XML_ATTR(L"id", 0x100 + count);
|
||||
CP_XML_ATTR(L"id", 0x100 + i);
|
||||
CP_XML_ATTR(L"r:id", slide->rId());
|
||||
}
|
||||
}
|
||||
count++;
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
for (size_t i = 0; i < slideLayouts_.size(); i++)
|
||||
@ -294,37 +292,28 @@ void pptx_conversion_context::end_document()
|
||||
}
|
||||
if (slideNotesMaster_)
|
||||
{
|
||||
package::slide_content_ptr content = package::slide_content::create();
|
||||
package::slide_content_ptr content = package::slide_content::create();
|
||||
|
||||
slideNotesMaster_->write_to(content->content());
|
||||
content->add_rels(slideNotesMaster_->Rels());//media & links rels
|
||||
|
||||
output_document_->get_ppt_files().add_notesMaster(content);
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
//размеры страниц в презентации
|
||||
odf_reader::odf_read_context & context = root()->odf_context();
|
||||
odf_reader::page_layout_container & pageLayouts = context.pageLayoutContainer();
|
||||
|
||||
if ((pageLayouts.master_pages().size() > 0) && (pageLayouts.master_pages()[0]->attlist_.style_name_))//default
|
||||
{
|
||||
const std::wstring masterStyleName = pageLayouts.master_pages()[0]->attlist_.style_name_.get();
|
||||
const std::wstring pageProperties = root()->odf_context().pageLayoutContainer().page_layout_name_by_style(masterStyleName);
|
||||
|
||||
odf_reader::page_layout_instance *pages_layouts = root()->odf_context().pageLayoutContainer().page_layout_by_name(pageProperties);
|
||||
|
||||
if (pages_layouts)pages_layouts->pptx_convert(*this);
|
||||
CP_XML_WRITER(presentation_.slideNotesMastersData())//presentation.xml
|
||||
{
|
||||
CP_XML_NODE(L"p:notesMasterId")
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", slideNotesMaster_->rId());
|
||||
}
|
||||
}
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
pptx_serialize_size(current_presentation().notesSlidesSize(),6858000,9144000,L"p:notesSz");
|
||||
//else
|
||||
pptx_serialize_size(current_presentation().slidesNotesProperties(), 6858000, 9144000, L"p:notesSz");
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//добавляем диаграммы
|
||||
|
||||
count = 0;
|
||||
for (size_t i = 0; i < charts_.size(); i++)
|
||||
{
|
||||
count++;
|
||||
package::chart_content_ptr content = package::chart_content::create();
|
||||
|
||||
charts_[i]->serialize(content->content());
|
||||
@ -334,7 +323,6 @@ void pptx_conversion_context::end_document()
|
||||
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//добавляем темы
|
||||
for (size_t i=0; i < themes_.size(); i++)
|
||||
{
|
||||
output_document_->get_ppt_files().add_theme(themes_[i]);
|
||||
@ -569,6 +557,14 @@ bool pptx_conversion_context::start_master(int master_index)
|
||||
current_master().add_layout(masters.content[master_index].layouts[i].Id, masters.content[master_index].layouts[i].rId, 0x80000000 + last_uniq_big_id++);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
//размеры страниц в презентации
|
||||
const std::wstring pageProperties = root()->odf_context().pageLayoutContainer().page_layout_name_by_style(masters.content[master_index].master_name);
|
||||
|
||||
odf_reader::page_layout_instance *pages_layouts = root()->odf_context().pageLayoutContainer().page_layout_by_name(pageProperties);
|
||||
|
||||
if (pages_layouts)
|
||||
pages_layouts->pptx_serialize(current_master().Sizes(), *this);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -597,10 +593,14 @@ bool pptx_conversion_context::start_page_notes()
|
||||
{
|
||||
create_new_slideNotes( );
|
||||
|
||||
current_slide().Rels().add(relationship(current_notes().rId(), L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide",
|
||||
std::wstring(L"../notesSlides/notesSlide") + std::to_wstring(notes_.size()) + L".xml"));
|
||||
current_slide().Rels().add(relationship(notes_.back()->rId(), L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide",
|
||||
L"../notesSlides/notesSlide" + std::to_wstring(notes_.size()) + L".xml"));
|
||||
|
||||
get_slide_context().start_slide();
|
||||
|
||||
current_notes().Rels().add(relationship(L"nId1", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide",
|
||||
L"../slides/slide" + std::to_wstring(slides_.size()) + L".xml"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -616,9 +616,11 @@ void pptx_conversion_context::end_page_notes()
|
||||
bool pptx_conversion_context::start_master_notes()
|
||||
{
|
||||
create_new_slideNotesMaster( );
|
||||
|
||||
get_slide_context().start_slide();
|
||||
|
||||
//current_slide().Rels().add(relationship(current_notes().rId(), L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide",
|
||||
// std::wstring(L"../notesSlides/notesSlide") + std::to_wstring(notes_.size()) + L".xml"));
|
||||
process_theme(L"");//add default theme - одинаковые но под разными именами
|
||||
current_notesMaster().add_theme(current_theme().id(), L"tId1");
|
||||
|
||||
get_slide_context().start_slide();
|
||||
return true;
|
||||
@ -632,6 +634,13 @@ void pptx_conversion_context::end_master_notes()
|
||||
get_slide_context().dump_rels(current_notesMaster().Rels());//hyperlinks, mediaitems, ...
|
||||
|
||||
get_slide_context().end_slide();
|
||||
|
||||
for (size_t i = 0; i < notes_.size(); i++)
|
||||
{
|
||||
notes_[i]->Rels().add(relationship(L"nmId1",
|
||||
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster",
|
||||
L"../notesMasters/notesMaster1.xml"));
|
||||
}
|
||||
}
|
||||
void pptx_conversion_context::end_layout()
|
||||
{
|
||||
|
||||
@ -155,8 +155,11 @@ void pptx_serialize_shape(std::wostream & strm, _pptx_drawing & val)
|
||||
odf_reader::GetProperty(val.additional,L"no_rect",bNoRect);
|
||||
|
||||
if (!bNoRect)
|
||||
{
|
||||
val.serialize_xfrm(CP_XML_STREAM(), L"a", true);
|
||||
{
|
||||
if (val.cx != 0 || val.cy != 0) //layout
|
||||
{
|
||||
val.serialize_xfrm(CP_XML_STREAM(), L"a", true);
|
||||
}
|
||||
val.serialize_shape(CP_XML_STREAM());
|
||||
|
||||
oox_serialize_ln(CP_XML_STREAM(), val.additional);
|
||||
|
||||
@ -68,15 +68,15 @@ pptx_xml_slide::~pptx_xml_slide()
|
||||
}
|
||||
std::wostream & pptx_xml_slide::Data()
|
||||
{
|
||||
return slideData_;
|
||||
return strmData_;
|
||||
}
|
||||
std::wostream & pptx_xml_slide::Background()
|
||||
{
|
||||
return slideBackground_;
|
||||
return strmBackground_;
|
||||
}
|
||||
std::wostream & pptx_xml_slide::Timing()
|
||||
{
|
||||
return slideTiming_;
|
||||
return strmTiming_;
|
||||
}
|
||||
rels & pptx_xml_slide::Rels()
|
||||
{
|
||||
@ -100,14 +100,14 @@ void pptx_xml_slide::write_to(std::wostream & strm)
|
||||
{
|
||||
CP_XML_ATTR(L"name", name());
|
||||
|
||||
CP_XML_STREAM() << slideBackground_.str();
|
||||
CP_XML_STREAM() << strmBackground_.str();
|
||||
|
||||
CP_XML_NODE(L"p:spTree")
|
||||
{
|
||||
CP_XML_STREAM() << slideData_.str();
|
||||
CP_XML_STREAM() << strmData_.str();
|
||||
}
|
||||
}
|
||||
CP_XML_STREAM() << slideTiming_.str();
|
||||
CP_XML_STREAM() << strmTiming_.str();
|
||||
CP_XML_NODE(L"p:clrMapOvr")
|
||||
{
|
||||
CP_XML_NODE(L"a:masterClrMapping");
|
||||
@ -137,7 +137,7 @@ pptx_xml_slideLayout::~pptx_xml_slideLayout()
|
||||
}
|
||||
std::wostream & pptx_xml_slideLayout::Data()
|
||||
{
|
||||
return slideLayoutData_;
|
||||
return strmData_;
|
||||
}
|
||||
rels & pptx_xml_slideLayout::Rels()
|
||||
{
|
||||
@ -166,7 +166,7 @@ void pptx_xml_slideLayout::write_to(std::wostream & strm)
|
||||
{
|
||||
CP_XML_NODE(L"p:spTree")
|
||||
{
|
||||
CP_XML_STREAM() << slideLayoutData_.str();
|
||||
CP_XML_STREAM() << strmData_.str();
|
||||
|
||||
//в slideLayoutData_
|
||||
//contentPart (Content Part) §19.3.1.14
|
||||
@ -212,15 +212,19 @@ pptx_xml_slideMaster::~pptx_xml_slideMaster()
|
||||
}
|
||||
std::wostream & pptx_xml_slideMaster::Data()
|
||||
{
|
||||
return slideMasterData_;
|
||||
return strmData_;
|
||||
}
|
||||
std::wostream & pptx_xml_slideMaster::DataExtra()
|
||||
{
|
||||
return slideMasterDataExtra_;
|
||||
return strmDataExtra_;
|
||||
}
|
||||
std::wostream & pptx_xml_slideMaster::Background()
|
||||
{
|
||||
return slideMasterBackground_;
|
||||
return strmBackground_;
|
||||
}
|
||||
std::wstringstream & pptx_xml_slideMaster::Sizes()
|
||||
{
|
||||
return strmSizes_;
|
||||
}
|
||||
rels & pptx_xml_slideMaster::Rels()
|
||||
{
|
||||
@ -255,11 +259,11 @@ void pptx_xml_slideMaster::write_to(std::wostream & strm)
|
||||
|
||||
CP_XML_NODE(L"p:cSld")
|
||||
{
|
||||
CP_XML_STREAM() << slideMasterBackground_.str();
|
||||
CP_XML_STREAM() << strmBackground_.str();
|
||||
|
||||
CP_XML_NODE(L"p:spTree")
|
||||
{
|
||||
CP_XML_STREAM() << slideMasterData_.str();
|
||||
CP_XML_STREAM() << strmData_.str();
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"p:clrMap")
|
||||
@ -288,7 +292,7 @@ void pptx_xml_slideMaster::write_to(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
CP_XML_STREAM() << slideMasterDataExtra_.str();
|
||||
CP_XML_STREAM() << strmDataExtra_.str();
|
||||
CP_XML_NODE(L"p:txStyles")
|
||||
{
|
||||
CP_XML_NODE(L"p:titleStyle");
|
||||
@ -415,14 +419,18 @@ void pptx_xml_presentation::write_to(std::wostream & strm)
|
||||
CP_XML_NODE(L"p:sldMasterIdLst")
|
||||
{
|
||||
CP_XML_STREAM() << slideMastersData_.str();
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"p:notesMasterIdLst")
|
||||
{
|
||||
CP_XML_STREAM() << slideNotesMastersData_.str();
|
||||
}
|
||||
CP_XML_NODE(L"p:sldIdLst")
|
||||
{
|
||||
CP_XML_STREAM() << slidesData_.str();
|
||||
}
|
||||
CP_XML_STREAM() << slidesProperties_.str();
|
||||
|
||||
CP_XML_STREAM() << notesSlidesSize_.str();
|
||||
CP_XML_STREAM() << slidesNotesProperties_.str();
|
||||
|
||||
CP_XML_NODE(L"p:defaultTextStyle")//??
|
||||
{
|
||||
@ -453,11 +461,11 @@ pptx_xml_slideNotes::~pptx_xml_slideNotes()
|
||||
}
|
||||
std::wostream & pptx_xml_slideNotes::Data()
|
||||
{
|
||||
return slideData_;
|
||||
return strmData_;
|
||||
}
|
||||
std::wostream & pptx_xml_slideNotes::Background()
|
||||
{
|
||||
return slideBackground_;
|
||||
return strmBackground_;
|
||||
}
|
||||
|
||||
rels & pptx_xml_slideNotes::Rels()
|
||||
@ -480,11 +488,11 @@ void pptx_xml_slideNotes::write_to(std::wostream & strm)
|
||||
|
||||
CP_XML_NODE(L"p:cSld")
|
||||
{
|
||||
CP_XML_STREAM() << slideBackground_.str();
|
||||
CP_XML_STREAM() << strmBackground_.str();
|
||||
|
||||
CP_XML_NODE(L"p:spTree")
|
||||
{
|
||||
CP_XML_STREAM() << slideData_.str();
|
||||
CP_XML_STREAM() << strmData_.str();
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"p:clrMapOvr")
|
||||
@ -517,12 +525,15 @@ pptx_xml_slideNotesMaster::~pptx_xml_slideNotesMaster()
|
||||
}
|
||||
std::wostream & pptx_xml_slideNotesMaster::Data()
|
||||
{
|
||||
return slideMasterData_;
|
||||
return strmData_;
|
||||
}
|
||||
|
||||
std::wostream & pptx_xml_slideNotesMaster::Background()
|
||||
{
|
||||
return slideMasterBackground_;
|
||||
return strmBackground_;
|
||||
}
|
||||
std::wostream & pptx_xml_slideNotesMaster::Sizes()
|
||||
{
|
||||
return strmSizes_;
|
||||
}
|
||||
rels & pptx_xml_slideNotesMaster::Rels()
|
||||
{
|
||||
@ -549,11 +560,11 @@ void pptx_xml_slideNotesMaster::write_to(std::wostream & strm)
|
||||
|
||||
CP_XML_NODE(L"p:cSld")
|
||||
{
|
||||
CP_XML_STREAM() << slideMasterBackground_.str();
|
||||
CP_XML_STREAM() << strmBackground_.str();
|
||||
|
||||
CP_XML_NODE(L"p:spTree")
|
||||
{
|
||||
CP_XML_STREAM() << slideMasterData_.str();
|
||||
CP_XML_STREAM() << strmData_.str();
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"p:clrMap")
|
||||
|
||||
@ -65,9 +65,9 @@ public:
|
||||
|
||||
private:
|
||||
std::wstring name_;
|
||||
std::wstringstream slideData_;
|
||||
std::wstringstream slideBackground_;
|
||||
std::wstringstream slideTiming_;
|
||||
std::wstringstream strmData_;
|
||||
std::wstringstream strmBackground_;
|
||||
std::wstringstream strmTiming_;
|
||||
std::wstring rId_;
|
||||
|
||||
rels rels_;
|
||||
@ -94,8 +94,8 @@ public:
|
||||
static pptx_xml_slideNotes_ptr create(int id);
|
||||
|
||||
private:
|
||||
std::wstringstream slideData_;
|
||||
std::wstringstream slideBackground_;
|
||||
std::wstringstream strmData_;
|
||||
std::wstringstream strmBackground_;
|
||||
std::wstring rId_;
|
||||
|
||||
rels rels_;
|
||||
@ -107,23 +107,23 @@ public:
|
||||
pptx_xml_presentation(){}
|
||||
~pptx_xml_presentation(){}
|
||||
|
||||
std::wstringstream & slidesData() {return slidesData_;}
|
||||
std::wstringstream & slideMastersData() {return slideMastersData_;}
|
||||
std::wstringstream & notesSlidesData() {return notesSlidesData_;}
|
||||
std::wstringstream & slidesData() {return slidesData_;}
|
||||
std::wstringstream & slideMastersData() {return slideMastersData_;}
|
||||
std::wstringstream & slideNotesMastersData() {return slideNotesMastersData_;}
|
||||
|
||||
std::wstringstream & slidesProperties() {return slidesProperties_;}
|
||||
std::wstringstream & notesSlidesSize() {return notesSlidesSize_;}
|
||||
std::wstringstream & slidesProperties() {return slidesProperties_;}
|
||||
std::wstringstream & slidesNotesProperties() {return slidesNotesProperties_;}
|
||||
|
||||
void write_to(std::wostream & strm);
|
||||
|
||||
private:
|
||||
std::wstringstream slidesProperties_;
|
||||
std::wstringstream notesSlidesSize_;
|
||||
std::wstringstream slidesNotesProperties_;
|
||||
|
||||
std::wstringstream slidesData_;
|
||||
std::wstringstream slideMastersData_;
|
||||
std::wstringstream notesSlidesData_;
|
||||
std::wstringstream handoutMasterData_;
|
||||
std::wstringstream slideNotesMastersData_;
|
||||
std::wstringstream slideHandoutMasterData_;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
@ -148,7 +148,7 @@ public:
|
||||
static pptx_xml_slideLayout_ptr create(int id);
|
||||
|
||||
private:
|
||||
std::wstringstream slideLayoutData_;
|
||||
std::wstringstream strmData_;
|
||||
std::wstring rId_;
|
||||
|
||||
rels rels_;
|
||||
@ -165,9 +165,10 @@ public:
|
||||
|
||||
std::wstring rId() const;
|
||||
|
||||
std::wostream & Data();
|
||||
std::wostream & DataExtra();
|
||||
std::wostream & Background();
|
||||
std::wostream & Data();
|
||||
std::wostream & DataExtra();
|
||||
std::wostream & Background();
|
||||
std::wstringstream & Sizes();
|
||||
rels & Rels();
|
||||
|
||||
void add_layout(int id, const std::wstring & rId, const unsigned int & uniqId);
|
||||
@ -178,9 +179,10 @@ public:
|
||||
static pptx_xml_slideMaster_ptr create(int id);
|
||||
|
||||
private:
|
||||
std::wstringstream slideMasterData_;
|
||||
std::wstringstream slideMasterDataExtra_;
|
||||
std::wstringstream slideMasterBackground_;
|
||||
std::wstringstream strmData_;
|
||||
std::wstringstream strmDataExtra_;
|
||||
std::wstringstream strmBackground_;
|
||||
std::wstringstream strmSizes_;
|
||||
|
||||
std::vector<std::pair<std::wstring, unsigned int>> layoutsId_;
|
||||
std::wstring rId_;
|
||||
@ -204,6 +206,7 @@ public:
|
||||
|
||||
std::wostream & Data();
|
||||
std::wostream & Background();
|
||||
std::wostream & Sizes();
|
||||
rels & Rels();
|
||||
|
||||
void add_theme(int id, const std::wstring & tId);
|
||||
@ -213,8 +216,9 @@ public:
|
||||
static pptx_xml_slideNotesMaster_ptr create();
|
||||
|
||||
private:
|
||||
std::wstringstream slideMasterData_;
|
||||
std::wstringstream slideMasterBackground_;
|
||||
std::wstringstream strmData_;
|
||||
std::wstringstream strmBackground_;
|
||||
std::wstringstream strmSizes_;
|
||||
|
||||
std::wstring rId_;
|
||||
int id_;
|
||||
|
||||
@ -58,6 +58,7 @@ const wchar_t * anim_par::name = L"par";
|
||||
|
||||
void anim_par::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void anim_par::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
@ -98,6 +99,7 @@ const wchar_t * anim_seq::name = L"seq";
|
||||
|
||||
void anim_seq::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void anim_seq::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
@ -129,8 +131,7 @@ const wchar_t * anim_transitionFilter::name = L"transitionFilter";
|
||||
|
||||
void anim_transitionFilter::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
common_anim_smil_attlist_.add_attributes(Attributes);
|
||||
anim_transition_filter_attlist_.add_attributes(Attributes);
|
||||
attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
@ -142,20 +143,20 @@ void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
|
||||
_CP_OPT(std::wstring) param;
|
||||
|
||||
if (anim_transition_filter_attlist_.smil_dur_)
|
||||
if (attlist_.smil_dur_)
|
||||
{
|
||||
time = anim_transition_filter_attlist_.smil_dur_->get_value();
|
||||
time = attlist_.smil_dur_->get_value();
|
||||
}
|
||||
if (anim_transition_filter_attlist_.smil_fadeColor_)
|
||||
if (attlist_.smil_fadeColor_)
|
||||
{
|
||||
color =anim_transition_filter_attlist_.smil_fadeColor_->get_hex_value();
|
||||
color =attlist_.smil_fadeColor_->get_hex_value();
|
||||
}
|
||||
|
||||
smil_transition_type::type transition_type;
|
||||
|
||||
if (anim_transition_filter_attlist_.smil_type_)
|
||||
if (attlist_.smil_type_)
|
||||
{
|
||||
transition_type = anim_transition_filter_attlist_.smil_type_->get_type();
|
||||
transition_type = attlist_.smil_type_->get_type();
|
||||
}
|
||||
|
||||
switch(transition_type)
|
||||
@ -164,13 +165,13 @@ void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
type = L"split";
|
||||
break;
|
||||
case smil_transition_type::irisWipe:
|
||||
if ((anim_transition_filter_attlist_.smil_subtype_) && (anim_transition_filter_attlist_.smil_subtype_.get()==L"diamond"))
|
||||
if ((attlist_.smil_subtype_) && (attlist_.smil_subtype_.get()==L"diamond"))
|
||||
type = L"diamond";
|
||||
else
|
||||
type = L"zoom";
|
||||
break;
|
||||
case smil_transition_type::miscDiagonalWipe:
|
||||
if ((anim_transition_filter_attlist_.smil_subtype_) && (anim_transition_filter_attlist_.smil_subtype_.get()==L"doubleDiamond"))
|
||||
if ((attlist_.smil_subtype_) && (attlist_.smil_subtype_.get()==L"doubleDiamond"))
|
||||
type = L"diamond";
|
||||
else
|
||||
type = L"zoom";
|
||||
@ -197,10 +198,10 @@ void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
case smil_transition_type::singleSweepWipe: //
|
||||
case smil_transition_type::doubleFanWipe: //
|
||||
type = L"wheel";
|
||||
if ((anim_transition_filter_attlist_.smil_subtype_) && (anim_transition_filter_attlist_.smil_subtype_.get()==L"oneBlade")) param = L"1";
|
||||
if ((anim_transition_filter_attlist_.smil_subtype_) && (anim_transition_filter_attlist_.smil_subtype_.get()==L"threeBlade"))param = L"3";
|
||||
if ((anim_transition_filter_attlist_.smil_subtype_) && (anim_transition_filter_attlist_.smil_subtype_.get()==L"fourBlade")) param = L"4";
|
||||
if ((anim_transition_filter_attlist_.smil_subtype_) && (anim_transition_filter_attlist_.smil_subtype_.get()==L"eightBlade"))param = L"8";
|
||||
if ((attlist_.smil_subtype_) && (attlist_.smil_subtype_.get()==L"oneBlade")) param = L"1";
|
||||
if ((attlist_.smil_subtype_) && (attlist_.smil_subtype_.get()==L"threeBlade")) param = L"3";
|
||||
if ((attlist_.smil_subtype_) && (attlist_.smil_subtype_.get()==L"fourBlade")) param = L"4";
|
||||
if ((attlist_.smil_subtype_) && (attlist_.smil_subtype_.get()==L"eightBlade")) param = L"8";
|
||||
break;
|
||||
case smil_transition_type::fanWipe:
|
||||
type = L"wedge";
|
||||
@ -211,22 +212,22 @@ void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
break;
|
||||
case smil_transition_type::checkerBoardWipe:
|
||||
type = L"checker";
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"across") dir = L"horz";
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"down") dir = L"vert";
|
||||
if (attlist_.smil_subtype_.get()==L"across") dir = L"horz";
|
||||
if (attlist_.smil_subtype_.get()==L"down") dir = L"vert";
|
||||
break;
|
||||
case smil_transition_type::blindsWipe:
|
||||
type = L"blinds";
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"vertical") dir = L"vert";
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"horizontal") dir = L"horz";
|
||||
if (attlist_.smil_subtype_.get()==L"vertical") dir = L"vert";
|
||||
if (attlist_.smil_subtype_.get()==L"horizontal") dir = L"horz";
|
||||
break;
|
||||
case smil_transition_type::diagonalWipe:
|
||||
case smil_transition_type::waterfallWipe:
|
||||
type = L"strips";
|
||||
if (anim_transition_filter_attlist_.smil_subtype_)
|
||||
if (attlist_.smil_subtype_)
|
||||
{
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"horizontalLeft") dir = L"rd";
|
||||
else if(anim_transition_filter_attlist_.smil_subtype_.get()==L"horizontalRight")dir = L"lu";
|
||||
else if(anim_transition_filter_attlist_.smil_subtype_.get()==L"verticalRight") dir = L"ld";
|
||||
if (attlist_.smil_subtype_.get() == L"horizontalLeft") dir = L"rd";
|
||||
else if (attlist_.smil_subtype_.get() == L"horizontalRight") dir = L"lu";
|
||||
else if (attlist_.smil_subtype_.get() == L"verticalRight") dir = L"ld";
|
||||
else dir = L"ru";
|
||||
}
|
||||
break;
|
||||
@ -235,13 +236,13 @@ void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
break;
|
||||
case smil_transition_type::randomBarWipe:
|
||||
type = L"randomBar";
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"vertical") dir = L"vert";
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"horizontal") dir = L"horz";
|
||||
if (attlist_.smil_subtype_.get() == L"vertical") dir = L"vert";
|
||||
if (attlist_.smil_subtype_.get() == L"horizontal") dir = L"horz";
|
||||
break;
|
||||
case smil_transition_type::pushWipe:
|
||||
type = L"push";
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"combVertical") {type = L"comb"; dir = L"vert";};
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"combHorizontal") {type = L"comb"; dir = L"horz";};
|
||||
if (attlist_.smil_subtype_.get()==L"combVertical") {type = L"comb"; dir = L"vert";};
|
||||
if (attlist_.smil_subtype_.get()==L"combHorizontal") {type = L"comb"; dir = L"horz";};
|
||||
break;
|
||||
case smil_transition_type::slideWipe:
|
||||
type = L"pull";
|
||||
@ -251,19 +252,19 @@ void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
break;
|
||||
case smil_transition_type::barnDoorWipe:
|
||||
type = L"split";
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"vertical") param = L"vert";
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"horizontal") param = L"horz";
|
||||
if (attlist_.smil_subtype_.get()==L"vertical") param = L"vert";
|
||||
if (attlist_.smil_subtype_.get()==L"horizontal") param = L"horz";
|
||||
break;
|
||||
case smil_transition_type::barWipe:
|
||||
type = L"wipe";
|
||||
if (anim_transition_filter_attlist_.smil_subtype_)
|
||||
if (attlist_.smil_subtype_)
|
||||
{
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromTopLeft") {type = L"strips"; dir = L"rd";}
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromBottomLeft") {type = L"strips"; dir = L"ru";}
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromTopRight") {type = L"strips"; dir = L"ld";}
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromBottomRight"){type = L"strips"; dir = L"lu";}
|
||||
if (attlist_.smil_subtype_.get()==L"fromTopLeft") {type = L"strips"; dir = L"rd";}
|
||||
if (attlist_.smil_subtype_.get()==L"fromBottomLeft"){type = L"strips"; dir = L"ru";}
|
||||
if (attlist_.smil_subtype_.get()==L"fromTopRight") {type = L"strips"; dir = L"ld";}
|
||||
if (attlist_.smil_subtype_.get()==L"fromBottomRight"){type = L"strips"; dir = L"lu";}
|
||||
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fadeOverColor") {type = L"fade"; param = L"0";}
|
||||
if (attlist_.smil_subtype_.get()==L"fadeOverColor") {type = L"fade"; param = L"0";}
|
||||
}
|
||||
break;
|
||||
///////////////////////////////////////////////////////
|
||||
@ -281,39 +282,39 @@ void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
break;
|
||||
//////////////////////////////////////////////////////
|
||||
}
|
||||
if (anim_transition_filter_attlist_.smil_subtype_)
|
||||
if (attlist_.smil_subtype_)
|
||||
{
|
||||
if (!dir)
|
||||
{
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"leftToRight")
|
||||
if (attlist_.smil_subtype_.get()==L"leftToRight")
|
||||
{
|
||||
if ((anim_transition_filter_attlist_.smil_direction_) && (anim_transition_filter_attlist_.smil_direction_.get()==L"reverse"))dir = L"l";
|
||||
if ((attlist_.smil_direction_) && (attlist_.smil_direction_.get()==L"reverse"))dir = L"l";
|
||||
else dir = L"r";
|
||||
}
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"topToBottom")
|
||||
if (attlist_.smil_subtype_.get()==L"topToBottom")
|
||||
{
|
||||
if ((anim_transition_filter_attlist_.smil_direction_) && (anim_transition_filter_attlist_.smil_direction_.get()==L"reverse"))dir = L"u";
|
||||
if ((attlist_.smil_direction_) && (attlist_.smil_direction_.get()==L"reverse"))dir = L"u";
|
||||
else dir = L"d";
|
||||
}
|
||||
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromTop") dir = L"d";
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromLeft") dir = L"r";
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromRight") dir = L"l";
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromBottom") dir = L"u";
|
||||
if (attlist_.smil_subtype_.get()==L"fromTop") dir = L"d";
|
||||
if (attlist_.smil_subtype_.get()==L"fromLeft") dir = L"r";
|
||||
if (attlist_.smil_subtype_.get()==L"fromRight") dir = L"l";
|
||||
if (attlist_.smil_subtype_.get()==L"fromBottom") dir = L"u";
|
||||
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"topRight") dir = L"ld";
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"bottomLeft") dir = L"lu";
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"bottomRight") dir = L"ru";
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"topLeft") dir = L"rd";
|
||||
if (attlist_.smil_subtype_.get()==L"topRight") dir = L"ld";
|
||||
if (attlist_.smil_subtype_.get()==L"bottomLeft") dir = L"lu";
|
||||
if (attlist_.smil_subtype_.get()==L"bottomRight") dir = L"ru";
|
||||
if (attlist_.smil_subtype_.get()==L"topLeft") dir = L"rd";
|
||||
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromTopLeft") dir = L"rd";
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromBottomLeft") dir = L"ru";
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromTopRight") dir = L"ld";
|
||||
if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromBottomRight")dir = L"lu";
|
||||
if (attlist_.smil_subtype_.get()==L"fromTopLeft") dir = L"rd";
|
||||
if (attlist_.smil_subtype_.get()==L"fromBottomLeft")dir = L"ru";
|
||||
if (attlist_.smil_subtype_.get()==L"fromTopRight") dir = L"ld";
|
||||
if (attlist_.smil_subtype_.get()==L"fromBottomRight")dir = L"lu";
|
||||
|
||||
}
|
||||
|
||||
if (!dir && (anim_transition_filter_attlist_.smil_direction_) && (anim_transition_filter_attlist_.smil_direction_.get()==L"reverse"))
|
||||
if (!dir && (attlist_.smil_direction_) && (attlist_.smil_direction_.get()==L"reverse"))
|
||||
dir = L"in";
|
||||
}
|
||||
|
||||
|
||||
@ -56,9 +56,11 @@ public:
|
||||
static const ElementType type = typeAnimPar;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
office_element_ptr anim_par_;
|
||||
office_element_ptr_array anim_seq_array_;
|
||||
office_element_ptr_array content_;
|
||||
odf_types::common_anim_smil_attlist attlist_;
|
||||
|
||||
office_element_ptr anim_par_;
|
||||
office_element_ptr_array anim_seq_array_;
|
||||
office_element_ptr_array content_;
|
||||
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context);
|
||||
|
||||
@ -79,7 +81,8 @@ public:
|
||||
static const ElementType type = typeAnimSeq;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
office_element_ptr_array anim_par_array_;
|
||||
odf_types::common_anim_smil_attlist attlist_;
|
||||
office_element_ptr_array anim_par_array_;
|
||||
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context);
|
||||
|
||||
@ -103,12 +106,12 @@ class anim_transition_filter_attlist
|
||||
public:
|
||||
void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
_CP_OPT(std::wstring) smil_direction_;
|
||||
_CP_OPT(std::wstring) smil_subtype_;
|
||||
_CP_OPT(std::wstring) smil_direction_;
|
||||
_CP_OPT(std::wstring) smil_subtype_;
|
||||
_CP_OPT(odf_types::smil_transition_type) smil_type_;
|
||||
_CP_OPT(std::wstring) smil_mode_;
|
||||
_CP_OPT(odf_types::color) smil_fadeColor_;
|
||||
_CP_OPT(odf_types::clockvalue) smil_dur_;
|
||||
_CP_OPT(std::wstring) smil_mode_;
|
||||
_CP_OPT(odf_types::color) smil_fadeColor_;
|
||||
_CP_OPT(odf_types::clockvalue) smil_dur_;
|
||||
};
|
||||
|
||||
//anim:transitionFilter
|
||||
@ -122,11 +125,8 @@ public:
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context);
|
||||
///////////////////////////////////////////////////////////
|
||||
odf_types::common_anim_smil_attlist common_anim_smil_attlist_;
|
||||
anim_transition_filter_attlist anim_transition_filter_attlist_;
|
||||
|
||||
|
||||
anim_transition_filter_attlist attlist_;
|
||||
private:
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
@ -804,18 +804,28 @@ void common_presentation_attlist::serialize(CP_ATTR_NODE)
|
||||
|
||||
void common_anim_smil_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
//CP_APPLY_ATTR(L"smil:direction", smil_direction_);
|
||||
// CP_APPLY_ATTR(L"smil:subtype", smil_subtype_);
|
||||
// CP_APPLY_ATTR(L"smil:type", smil_type_);
|
||||
//CP_APPLY_ATTR(L"smil:dur", smil_dur_);
|
||||
CP_APPLY_ATTR(L"smil:direction", smil_direction_);
|
||||
CP_APPLY_ATTR(L"smil:subtype", smil_subtype_);
|
||||
CP_APPLY_ATTR(L"smil:type", smil_type_);
|
||||
CP_APPLY_ATTR(L"smil:dur", smil_dur_);
|
||||
|
||||
}
|
||||
void common_anim_smil_attlist::apply_from(const common_anim_smil_attlist & Other)
|
||||
{
|
||||
//_CP_APPLY_PROP(smil_direction_, Other.smil_direction_);
|
||||
//_CP_APPLY_PROP(smil_subtype_, Other.smil_subtype_);
|
||||
//_CP_APPLY_PROP(smil_type_, Other.smil_type_);
|
||||
// _CP_APPLY_PROP(smil_dur_, Other.smil_dur_);
|
||||
_CP_APPLY_PROP(smil_direction_, Other.smil_direction_);
|
||||
_CP_APPLY_PROP(smil_subtype_, Other.smil_subtype_);
|
||||
_CP_APPLY_PROP(smil_type_, Other.smil_type_);
|
||||
_CP_APPLY_PROP(smil_dur_, Other.smil_dur_);
|
||||
}
|
||||
void common_anim_smil_attlist::serialize(CP_ATTR_NODE)
|
||||
{
|
||||
CP_XML_ATTR_OPT(L"smil:direction", smil_direction_);
|
||||
CP_XML_ATTR_OPT(L"smil:subtype", smil_subtype_);
|
||||
CP_XML_ATTR_OPT(L"smil:type", smil_type_);
|
||||
CP_XML_ATTR_OPT(L"smil:restart", smil_restart_);
|
||||
CP_XML_ATTR_OPT(L"smil:dur", smil_dur_);
|
||||
CP_XML_ATTR_OPT(L"presentation:node-type", presentation_node_type_);
|
||||
CP_XML_ATTR_OPT(L"smil:begin", smil_begin_);
|
||||
}
|
||||
void union_common_draw_attlists::serialize(CP_ATTR_NODE)
|
||||
{
|
||||
|
||||
@ -575,14 +575,18 @@ class common_anim_smil_attlist
|
||||
public:
|
||||
void add_attributes ( const xml::attributes_wc_ptr & Attributes );
|
||||
void apply_from (const common_anim_smil_attlist & Other);
|
||||
void serialize (CP_ATTR_NODE){}
|
||||
void serialize (CP_ATTR_NODE);
|
||||
|
||||
//_CP_OPT(std::wstring) smil_direction_;
|
||||
//_CP_OPT(std::wstring) smil_subtype_;
|
||||
//_CP_OPT(std::wstring) smil_type_;
|
||||
//_CP_OPT(std::wstring) smil_dur_;
|
||||
_CP_OPT(std::wstring) presentation_node_type_;
|
||||
_CP_OPT(std::wstring) smil_direction_;
|
||||
_CP_OPT(std::wstring) smil_restart_;
|
||||
_CP_OPT(std::wstring) smil_subtype_;
|
||||
_CP_OPT(std::wstring) smil_type_;
|
||||
_CP_OPT(std::wstring) smil_dur_;
|
||||
|
||||
//_CP_OPT(color) smil_fadeColor;
|
||||
_CP_OPT(std::wstring) smil_begin_;
|
||||
|
||||
_CP_OPT(color) smil_fadeColor;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -41,47 +41,47 @@ std::wostream & operator << (std::wostream & _Wostream, const smil_transition_ty
|
||||
{
|
||||
switch(_Val.get_type())
|
||||
{
|
||||
case smil_transition_type::barWipe : _Wostream << L"barwipe" ; break;
|
||||
case smil_transition_type::boxWipe : _Wostream << L"boxwipe" ; break;
|
||||
case smil_transition_type::fourBoxWipe : _Wostream << L"fourboxwipe" ; break;
|
||||
case smil_transition_type::barnDoorWipe : _Wostream << L"barndoorwipe" ; break;
|
||||
case smil_transition_type::diagonalWipe : _Wostream << L"diagonalwipe" ; break;
|
||||
case smil_transition_type::bowTieWipe : _Wostream << L"bowtiewipe" ; break;
|
||||
case smil_transition_type::miscDiagonalWipe : _Wostream << L"miscdiagonalwipe"; break;
|
||||
case smil_transition_type::veeWipe : _Wostream << L"veewipe" ; break;
|
||||
case smil_transition_type::barnVeeWipe : _Wostream << L"barnveewipe" ; break;
|
||||
case smil_transition_type::zigZagWipe : _Wostream << L"zigzagwipe" ; break;
|
||||
case smil_transition_type::barnZigZagWipe : _Wostream << L"barnzigzagwipe" ; break;
|
||||
case smil_transition_type::irisWipe : _Wostream << L"iriswipe" ; break;
|
||||
case smil_transition_type::triangleWipe : _Wostream << L"trianglewipe" ; break;
|
||||
case smil_transition_type::arrowHeadWipe : _Wostream << L"arrowheadwipe" ; break;
|
||||
case smil_transition_type::pentagonWipe : _Wostream << L"pentagonwipe" ; break;
|
||||
case smil_transition_type::hexagonWipe : _Wostream << L"hexagonwipe" ; break;
|
||||
case smil_transition_type::ellipseWipe : _Wostream << L"ellipsewipe" ; break;
|
||||
case smil_transition_type::eyeWipe : _Wostream << L"eyewipe" ; break;
|
||||
case smil_transition_type::roundRectWipe : _Wostream << L"roundrectwipe" ; break;
|
||||
case smil_transition_type::starWipe : _Wostream << L"starwipe" ; break;
|
||||
case smil_transition_type::miscShapeWipe : _Wostream << L"miscshapewipe" ; break;
|
||||
case smil_transition_type::clockWipe : _Wostream << L"clockwipe" ; break;
|
||||
case smil_transition_type::pinWheelWipe : _Wostream << L"pinwheelwipe" ; break;
|
||||
case smil_transition_type::singleSweepWipe : _Wostream << L"singlesweepwipe" ; break;
|
||||
case smil_transition_type::fanWipe : _Wostream << L"fanwipe" ; break;
|
||||
case smil_transition_type::doubleFanWipe : _Wostream << L"doublefanwipe" ; break;
|
||||
case smil_transition_type::doubleSweepWipe : _Wostream << L"doublesweepwipe" ; break;
|
||||
case smil_transition_type::saloonDoorWipe : _Wostream << L"saloondoorwipe" ; break;
|
||||
case smil_transition_type::windshieldWipe : _Wostream << L"windshieldwipe" ; break;
|
||||
case smil_transition_type::snakeWipe : _Wostream << L"snakewipe" ; break;
|
||||
case smil_transition_type::spiralWipe : _Wostream << L"spiralwipe" ; break;
|
||||
case smil_transition_type::parallelSnakesWipe: _Wostream << L"parallelsnakeswipe"; break;
|
||||
case smil_transition_type::boxSnakesWipe : _Wostream << L"boxsnakeswipe" ; break;
|
||||
case smil_transition_type::waterfallWipe : _Wostream << L"waterfallwipe" ; break;
|
||||
case smil_transition_type::pushWipe : _Wostream << L"pushwipe" ; break;
|
||||
case smil_transition_type::slideWipe : _Wostream << L"slidewipe" ; break;
|
||||
case smil_transition_type::barWipe : _Wostream << L"barWipe" ; break;
|
||||
case smil_transition_type::boxWipe : _Wostream << L"boxWipe" ; break;
|
||||
case smil_transition_type::fourBoxWipe : _Wostream << L"fourBoxWipe" ; break;
|
||||
case smil_transition_type::barnDoorWipe : _Wostream << L"barnDoorWipe" ; break;
|
||||
case smil_transition_type::diagonalWipe : _Wostream << L"diagonalWipe" ; break;
|
||||
case smil_transition_type::bowTieWipe : _Wostream << L"bowTieWipe" ; break;
|
||||
case smil_transition_type::miscDiagonalWipe : _Wostream << L"miscDiagonalWipe"; break;
|
||||
case smil_transition_type::veeWipe : _Wostream << L"veeWipe" ; break;
|
||||
case smil_transition_type::barnVeeWipe : _Wostream << L"barnVeeWipe" ; break;
|
||||
case smil_transition_type::zigZagWipe : _Wostream << L"zigZagWipe" ; break;
|
||||
case smil_transition_type::barnZigZagWipe : _Wostream << L"barnZigZagWipe" ; break;
|
||||
case smil_transition_type::irisWipe : _Wostream << L"irisWipe" ; break;
|
||||
case smil_transition_type::triangleWipe : _Wostream << L"triangleWipe" ; break;
|
||||
case smil_transition_type::arrowHeadWipe : _Wostream << L"arrowHeadWipe" ; break;
|
||||
case smil_transition_type::pentagonWipe : _Wostream << L"pentagonWipe" ; break;
|
||||
case smil_transition_type::hexagonWipe : _Wostream << L"hexagonWipe" ; break;
|
||||
case smil_transition_type::ellipseWipe : _Wostream << L"ellipseWipe" ; break;
|
||||
case smil_transition_type::eyeWipe : _Wostream << L"eyeWipe" ; break;
|
||||
case smil_transition_type::roundRectWipe : _Wostream << L"roundRectWipe" ; break;
|
||||
case smil_transition_type::starWipe : _Wostream << L"starWipe" ; break;
|
||||
case smil_transition_type::miscShapeWipe : _Wostream << L"miscShapeWipe" ; break;
|
||||
case smil_transition_type::clockWipe : _Wostream << L"clockWipe" ; break;
|
||||
case smil_transition_type::pinWheelWipe : _Wostream << L"pinWheelWipe" ; break;
|
||||
case smil_transition_type::singleSweepWipe : _Wostream << L"singleSweepWipe" ; break;
|
||||
case smil_transition_type::fanWipe : _Wostream << L"fanWipe" ; break;
|
||||
case smil_transition_type::doubleFanWipe : _Wostream << L"doubleFanWipe" ; break;
|
||||
case smil_transition_type::doubleSweepWipe : _Wostream << L"doubleSweepWipe" ; break;
|
||||
case smil_transition_type::saloonDoorWipe : _Wostream << L"saloonDoorWipe" ; break;
|
||||
case smil_transition_type::windshieldWipe : _Wostream << L"windshieldWipe" ; break;
|
||||
case smil_transition_type::snakeWipe : _Wostream << L"snakeWipe" ; break;
|
||||
case smil_transition_type::spiralWipe : _Wostream << L"spiralWipe" ; break;
|
||||
case smil_transition_type::parallelSnakesWipe: _Wostream << L"parallelSnakesWipe"; break;
|
||||
case smil_transition_type::boxSnakesWipe : _Wostream << L"boxSnakesWipe" ; break;
|
||||
case smil_transition_type::waterfallWipe : _Wostream << L"waterfallWipe" ; break;
|
||||
case smil_transition_type::pushWipe : _Wostream << L"pushWipe" ; break;
|
||||
case smil_transition_type::slideWipe : _Wostream << L"slideWipe" ; break;
|
||||
case smil_transition_type::fade : _Wostream << L"fade" ; break;
|
||||
case smil_transition_type::checkerBoardWipe : _Wostream << L"checkerboardwipe"; break;
|
||||
case smil_transition_type::blindsWipe : _Wostream << L"blindswipe" ; break;
|
||||
case smil_transition_type::checkerBoardWipe : _Wostream << L"checkerboardWipe"; break;
|
||||
case smil_transition_type::blindsWipe : _Wostream << L"blindsWipe" ; break;
|
||||
case smil_transition_type::dissolve : _Wostream << L"dissolve" ; break;
|
||||
case smil_transition_type::randomBarWipe : _Wostream << L"randombarwipe" ; break;
|
||||
case smil_transition_type::randomBarWipe : _Wostream << L"randomBarWipe" ; break;
|
||||
}
|
||||
return _Wostream;
|
||||
}
|
||||
@ -91,47 +91,47 @@ smil_transition_type smil_transition_type::parse(const std::wstring & Str)
|
||||
std::wstring tmp = Str;
|
||||
boost::algorithm::to_lower(tmp);
|
||||
|
||||
if(tmp == L"barwipe") return smil_transition_type( barWipe );
|
||||
else if(tmp == L"boxwipe") return smil_transition_type( boxWipe );
|
||||
else if(tmp == L"fourboxwipe") return smil_transition_type( fourBoxWipe );
|
||||
else if(tmp == L"barndoorwipe") return smil_transition_type( barnDoorWipe );
|
||||
else if(tmp == L"diagonalwipe") return smil_transition_type( diagonalWipe );
|
||||
else if(tmp == L"bowtiewipe") return smil_transition_type( bowTieWipe );
|
||||
else if(tmp == L"miscdiagonalwipe") return smil_transition_type( miscDiagonalWipe );
|
||||
else if(tmp == L"veewipe") return smil_transition_type( veeWipe );
|
||||
else if(tmp == L"barnveewipe") return smil_transition_type( barnVeeWipe );
|
||||
else if(tmp == L"zigzagwipe") return smil_transition_type( zigZagWipe );
|
||||
else if(tmp == L"barnzigzagwipe") return smil_transition_type( barnZigZagWipe );
|
||||
else if(tmp == L"iriswipe") return smil_transition_type( irisWipe);
|
||||
else if(tmp == L"trianglewipe") return smil_transition_type( triangleWipe);
|
||||
else if(tmp == L"arrowheadwipe") return smil_transition_type( arrowHeadWipe );
|
||||
else if(tmp == L"pentagonwipe") return smil_transition_type( pentagonWipe );
|
||||
else if(tmp == L"hexagonwipe") return smil_transition_type( hexagonWipe );
|
||||
else if(tmp == L"ellipsewipe") return smil_transition_type( ellipseWipe );
|
||||
else if(tmp == L"eyewipe") return smil_transition_type( eyeWipe );
|
||||
else if(tmp == L"roundrectwipe") return smil_transition_type( roundRectWipe );
|
||||
else if(tmp == L"starwipe") return smil_transition_type( starWipe );
|
||||
else if(tmp == L"miscshapewipe") return smil_transition_type( miscShapeWipe );
|
||||
else if(tmp == L"clockwipe") return smil_transition_type( clockWipe );
|
||||
else if(tmp == L"pinwheelwipe") return smil_transition_type( pinWheelWipe );
|
||||
else if(tmp == L"singlesweepwipe") return smil_transition_type( singleSweepWipe);
|
||||
else if(tmp == L"fanwipe") return smil_transition_type( fanWipe );
|
||||
else if(tmp == L"doublefanwipe") return smil_transition_type( doubleFanWipe );
|
||||
else if(tmp == L"doublesweepwipe") return smil_transition_type( doubleSweepWipe );
|
||||
else if(tmp == L"saloondoorwipe") return smil_transition_type( saloonDoorWipe );
|
||||
else if(tmp == L"windshieldwipe") return smil_transition_type( windshieldWipe );
|
||||
else if(tmp == L"snakewipe") return smil_transition_type( snakeWipe );
|
||||
else if(tmp == L"spiralwipe") return smil_transition_type( spiralWipe );
|
||||
else if(tmp == L"parallelsnakeswipe")return smil_transition_type( parallelSnakesWipe );
|
||||
else if(tmp == L"boxsnakeswipe") return smil_transition_type( boxSnakesWipe );
|
||||
else if(tmp == L"waterfallwipe") return smil_transition_type( waterfallWipe );
|
||||
else if(tmp == L"pushwipe") return smil_transition_type( pushWipe );
|
||||
else if(tmp == L"slidewipe") return smil_transition_type( slideWipe );
|
||||
if(tmp == L"barWipe") return smil_transition_type( barWipe );
|
||||
else if(tmp == L"boxWipe") return smil_transition_type( boxWipe );
|
||||
else if(tmp == L"fourboxWipe") return smil_transition_type( fourBoxWipe );
|
||||
else if(tmp == L"barndoorWipe") return smil_transition_type( barnDoorWipe );
|
||||
else if(tmp == L"diagonalWipe") return smil_transition_type( diagonalWipe );
|
||||
else if(tmp == L"bowtieWipe") return smil_transition_type( bowTieWipe );
|
||||
else if(tmp == L"miscdiagonalWipe") return smil_transition_type( miscDiagonalWipe );
|
||||
else if(tmp == L"veeWipe") return smil_transition_type( veeWipe );
|
||||
else if(tmp == L"barnveeWipe") return smil_transition_type( barnVeeWipe );
|
||||
else if(tmp == L"zigzagWipe") return smil_transition_type( zigZagWipe );
|
||||
else if(tmp == L"barnzigzagWipe") return smil_transition_type( barnZigZagWipe );
|
||||
else if(tmp == L"irisWipe") return smil_transition_type( irisWipe);
|
||||
else if(tmp == L"triangleWipe") return smil_transition_type( triangleWipe);
|
||||
else if(tmp == L"arrowheadWipe") return smil_transition_type( arrowHeadWipe );
|
||||
else if(tmp == L"pentagonWipe") return smil_transition_type( pentagonWipe );
|
||||
else if(tmp == L"hexagonWipe") return smil_transition_type( hexagonWipe );
|
||||
else if(tmp == L"ellipseWipe") return smil_transition_type( ellipseWipe );
|
||||
else if(tmp == L"eyeWipe") return smil_transition_type( eyeWipe );
|
||||
else if(tmp == L"roundrectWipe") return smil_transition_type( roundRectWipe );
|
||||
else if(tmp == L"starWipe") return smil_transition_type( starWipe );
|
||||
else if(tmp == L"miscshapeWipe") return smil_transition_type( miscShapeWipe );
|
||||
else if(tmp == L"clockWipe") return smil_transition_type( clockWipe );
|
||||
else if(tmp == L"pinwheelWipe") return smil_transition_type( pinWheelWipe );
|
||||
else if(tmp == L"singlesweepWipe") return smil_transition_type( singleSweepWipe);
|
||||
else if(tmp == L"fanWipe") return smil_transition_type( fanWipe );
|
||||
else if(tmp == L"doublefanWipe") return smil_transition_type( doubleFanWipe );
|
||||
else if(tmp == L"doublesweepWipe") return smil_transition_type( doubleSweepWipe );
|
||||
else if(tmp == L"saloondoorWipe") return smil_transition_type( saloonDoorWipe );
|
||||
else if(tmp == L"windshieldWipe") return smil_transition_type( windshieldWipe );
|
||||
else if(tmp == L"snakeWipe") return smil_transition_type( snakeWipe );
|
||||
else if(tmp == L"spiralWipe") return smil_transition_type( spiralWipe );
|
||||
else if(tmp == L"parallelsnakesWipe")return smil_transition_type( parallelSnakesWipe );
|
||||
else if(tmp == L"boxsnakesWipe") return smil_transition_type( boxSnakesWipe );
|
||||
else if(tmp == L"waterfallWipe") return smil_transition_type( waterfallWipe );
|
||||
else if(tmp == L"pushWipe") return smil_transition_type( pushWipe );
|
||||
else if(tmp == L"slideWipe") return smil_transition_type( slideWipe );
|
||||
else if(tmp == L"fade") return smil_transition_type( fade );
|
||||
else if(tmp == L"checkerboardwipe") return smil_transition_type( checkerBoardWipe);
|
||||
else if(tmp == L"blindswipe") return smil_transition_type( blindsWipe);
|
||||
else if(tmp == L"checkerboardWipe") return smil_transition_type( checkerBoardWipe);
|
||||
else if(tmp == L"blindsWipe") return smil_transition_type( blindsWipe);
|
||||
else if(tmp == L"dissolve") return smil_transition_type( dissolve);
|
||||
else if(tmp == L"randombarwipe") return smil_transition_type( randomBarWipe);
|
||||
else if(tmp == L"randombarWipe") return smil_transition_type( randomBarWipe);
|
||||
else
|
||||
{
|
||||
return smil_transition_type( barWipe );
|
||||
|
||||
@ -262,46 +262,46 @@ void presentation_notes::add_attributes( const xml::attributes_wc_ptr & Attribut
|
||||
attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
//void presentation_notes::pptx_convert_placeHolder(oox::pptx_conversion_context & Context, std::wstring styleName, presentation_class::type PresentationClass)
|
||||
//{
|
||||
// office_element_ptr elm = Context.root()->odf_context().drawStyles().find_by_style_name(styleName);
|
||||
// //todooo если это элемент datatime -нужно вытащить формат поля
|
||||
//
|
||||
// if (!elm)return;
|
||||
//
|
||||
// int index=-1;
|
||||
//
|
||||
// const std::wstring masterName = attlist_.master_page_name_.get_value_or(L"");
|
||||
// style_master_page * master = Context.root()->odf_context().pageLayoutContainer().master_page_by_name(masterName);
|
||||
//
|
||||
// //if (master)
|
||||
// // index = master->find_placeHolderIndex(PresentationClass, Context.last_idx_placeHolder);
|
||||
//
|
||||
//
|
||||
// Context.get_slide_context().start_shape(1);
|
||||
// Context.get_slide_context().set_placeHolder_type(presentation_class(PresentationClass).get_type_ms());
|
||||
// Context.get_slide_context().set_placeHolder_idx(index);
|
||||
//
|
||||
// Context.get_text_context().start_object();
|
||||
//
|
||||
// if (PresentationClass == presentation_class::date_time)
|
||||
// {
|
||||
// Context.get_text_context().start_field(oox::datetime, L"");
|
||||
// }
|
||||
//
|
||||
// elm->pptx_convert(Context);
|
||||
//
|
||||
// std::wstring text_content_ = Context.get_text_context().end_object();
|
||||
//
|
||||
// if (text_content_.length()>0)
|
||||
// {
|
||||
// Context.get_slide_context().set_property(_property(L"text-content",text_content_));
|
||||
// }
|
||||
// Context.get_slide_context().set_property(_property(L"no_rect",true));
|
||||
// Context.get_slide_context().end_shape();
|
||||
//
|
||||
//}
|
||||
//
|
||||
void presentation_notes::pptx_convert_placeHolder(oox::pptx_conversion_context & Context, std::wstring styleName, presentation_class::type PresentationClass)
|
||||
{
|
||||
office_element_ptr elm = Context.root()->odf_context().drawStyles().find_by_style_name(styleName);
|
||||
//todooo если это элемент datatime -нужно вытащить формат поля
|
||||
|
||||
if (!elm)return;
|
||||
|
||||
int index=-1;
|
||||
|
||||
const std::wstring masterName = attlist_.master_page_name_.get_value_or(L"");
|
||||
style_master_page * master = Context.root()->odf_context().pageLayoutContainer().master_page_by_name(masterName);
|
||||
|
||||
//if (master)
|
||||
// index = master->find_placeHolderIndex(PresentationClass, Context.last_idx_placeHolder);
|
||||
|
||||
|
||||
Context.get_slide_context().start_shape(1);
|
||||
Context.get_slide_context().set_placeHolder_type(presentation_class(PresentationClass).get_type_ms());
|
||||
Context.get_slide_context().set_placeHolder_idx(index);
|
||||
|
||||
Context.get_text_context().start_object();
|
||||
|
||||
if (PresentationClass == presentation_class::date_time)
|
||||
{
|
||||
Context.get_text_context().start_field(oox::datetime, L"");
|
||||
}
|
||||
|
||||
elm->pptx_convert(Context);
|
||||
|
||||
std::wstring text_content_ = Context.get_text_context().end_object();
|
||||
|
||||
if (text_content_.length()>0)
|
||||
{
|
||||
Context.get_slide_context().set_property(_property(L"text-content",text_content_));
|
||||
}
|
||||
Context.get_slide_context().set_property(_property(L"no_rect",true));
|
||||
Context.get_slide_context().end_shape();
|
||||
|
||||
}
|
||||
|
||||
void presentation_notes::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
const std::wstring pageStyleName = attlist_.draw_style_name_.get_value_or(L"");
|
||||
@ -312,7 +312,7 @@ void presentation_notes::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
|
||||
if (attlist_.draw_style_name_)
|
||||
{
|
||||
style_instance * style_inst = Context.root()->odf_context().styleContainer().style_by_name(pageStyleName,style_family::DrawingPage, false);
|
||||
style_instance * style_inst = Context.root()->odf_context().styleContainer().style_by_name(pageStyleName, style_family::DrawingPage, Context.process_masters_);
|
||||
|
||||
if ((style_inst) && (style_inst->content()))
|
||||
{
|
||||
@ -347,16 +347,16 @@ void presentation_notes::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
content_[i]->pptx_convert(Context);
|
||||
}
|
||||
|
||||
//if (attlist_.use_footer_name_)//from master_page
|
||||
//{
|
||||
// std::wstring name = L"footer:" + *attlist_.use_footer_name_;
|
||||
// pptx_convert_placeHolder(Context, name, presentation_class::footer);
|
||||
//}
|
||||
//if (attlist_.use_date_time_name_)//from master_page
|
||||
//{
|
||||
// std::wstring name = L"datetime:" + *attlist_.use_date_time_name_;
|
||||
// pptx_convert_placeHolder(Context, name, presentation_class::date_time);
|
||||
//}
|
||||
if (attlist_.use_footer_name_)//from master_page_notes
|
||||
{
|
||||
std::wstring name = L"footer:" + *attlist_.use_footer_name_;
|
||||
pptx_convert_placeHolder(Context, name, presentation_class::footer);
|
||||
}
|
||||
if (attlist_.use_date_time_name_)//from master_page_notes
|
||||
{
|
||||
std::wstring name = L"datetime:" + *attlist_.use_date_time_name_;
|
||||
pptx_convert_placeHolder(Context, name, presentation_class::date_time);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -150,14 +150,14 @@ public:
|
||||
static const ElementType type = typePresentationNotes;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context);
|
||||
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
void pptx_convert_placeHolder(oox::pptx_conversion_context & Context, std::wstring styleName, odf_types::presentation_class::type PresentationClass);
|
||||
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
|
||||
office_element_ptr_array content_;
|
||||
draw_page_attr attlist_;
|
||||
};
|
||||
|
||||
@ -360,11 +360,11 @@ void page_layout_instance::docx_convert_serialize(std::wostream & strm, oox::doc
|
||||
if (props)
|
||||
props->docx_convert_serialize(strm, Context);
|
||||
}
|
||||
void page_layout_instance::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
void page_layout_instance::pptx_serialize(std::wostream & strm, oox::pptx_conversion_context & Context)
|
||||
{
|
||||
style_page_layout_properties * props = properties();
|
||||
if (props)
|
||||
props->pptx_convert(Context);
|
||||
props->pptx_serialize(strm, Context);
|
||||
}
|
||||
|
||||
void page_layout_container::add_page_layout(const style_page_layout * StylePageLayout)
|
||||
|
||||
@ -195,7 +195,7 @@ public:
|
||||
|
||||
void docx_convert_serialize (std::wostream & strm, oox::docx_conversion_context & Context);
|
||||
void xlsx_serialize (std::wostream & strm, oox::xlsx_conversion_context & Context);
|
||||
void pptx_convert (oox::pptx_conversion_context & Context);
|
||||
void pptx_serialize (std::wostream & strm, oox::pptx_conversion_context & Context);
|
||||
|
||||
const style_page_layout * style_page_layout_;
|
||||
|
||||
|
||||
@ -1378,6 +1378,50 @@ void style_page_layout_properties::pptx_convert(oox::pptx_conversion_context & C
|
||||
attlist_.pptx_convert(Context);
|
||||
}
|
||||
|
||||
void style_page_layout_properties::pptx_serialize(std::wostream & strm, oox::pptx_conversion_context & Context)
|
||||
{
|
||||
if (attlist_.fo_page_width_ || attlist_.fo_page_height_ || attlist_.style_print_orientation_)
|
||||
{
|
||||
std::wstring w_w, w_h;
|
||||
|
||||
_INT64 h = 0, w = 0;
|
||||
|
||||
if (attlist_.fo_page_width_)
|
||||
{
|
||||
w = attlist_.fo_page_width_->get_value_unit(length::emu);
|
||||
if (w < 914400) w = 914400;
|
||||
|
||||
w_w = boost::lexical_cast<std::wstring>(w);
|
||||
}
|
||||
if (attlist_.fo_page_height_)
|
||||
{
|
||||
h = attlist_.fo_page_height_->get_value_unit(length::emu);
|
||||
if (h < 914400) h = 914400;
|
||||
|
||||
w_h = std::to_wstring(h);
|
||||
}
|
||||
|
||||
std::wstring w_orient = L"custom";
|
||||
|
||||
//if (w && h)
|
||||
//{
|
||||
// double ratio = (double)w/(double)h;
|
||||
// if (abs(ratio - 16./9.)<0.01) w_orient = L"screen16x9";
|
||||
// if (abs(ratio - 4./3.)<0.01) w_orient = L"screen4x3";
|
||||
//}
|
||||
|
||||
strm << L"<p:sldSz ";
|
||||
if (!w_h.empty())
|
||||
strm << L"cy=\"" << w_h << L"\" ";
|
||||
|
||||
if (!w_w.empty())
|
||||
strm << L"cx=\"" << w_w << L"\" ";
|
||||
|
||||
strm << L"type=\"" << w_orient << L"\" ";
|
||||
|
||||
strm << L"/>";
|
||||
}
|
||||
}
|
||||
|
||||
// style-page-layout-properties-elements
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -980,6 +980,7 @@ public:
|
||||
|
||||
bool docx_background_serialize(std::wostream & strm, oox::docx_conversion_context & Context, oox::_oox_fill & fill, int id);
|
||||
void xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context);
|
||||
void pptx_serialize(std::wostream & strm, oox::pptx_conversion_context & Context);
|
||||
|
||||
style_page_layout_properties() { }
|
||||
|
||||
|
||||
@ -1,10 +1,19 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFormatWriterLib", "..\source\win32\OdfFormat.vcproj", "{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{C739151F-5384-41DF-A1A6-F089E2C1AD56} = {C739151F-5384-41DF-A1A6-F089E2C1AD56}
|
||||
{609ED938-3CA8-4BED-B363-25096D4C4812} = {609ED938-3CA8-4BED-B363-25096D4C4812}
|
||||
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} = {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}
|
||||
{94954A67-A853-43B1-A727-6EF2774C5A6A} = {94954A67-A853-43B1-A727-6EF2774C5A6A}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Oox2OdfConverter", "..\source\win32\Oox2OdfConverter.vcproj", "{BEE01B53-244A-44E6-8947-ED9342D9247E}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{21663823-DE45-479B-91D0-B4FEF4916EF0} = {21663823-DE45-479B-91D0-B4FEF4916EF0}
|
||||
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
|
||||
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD} = {E5A67556-44DA-4481-8F87-0A3AEDBD20DD}
|
||||
{94954A67-A853-43B1-A727-6EF2774C5A6A} = {94954A67-A853-43B1-A727-6EF2774C5A6A}
|
||||
{36636678-AE25-4BE6-9A34-2561D1BCF302} = {36636678-AE25-4BE6-9A34-2561D1BCF302}
|
||||
EndProjectSection
|
||||
@ -89,6 +98,14 @@ Global
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.Debug|x64.Build.0 = Debug|x64
|
||||
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.Release|Win32.Build.0 = Release|Win32
|
||||
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.Release|x64.ActiveCfg = Release|x64
|
||||
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.Release|x64.Build.0 = Release|x64
|
||||
{BEE01B53-244A-44E6-8947-ED9342D9247E}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{BEE01B53-244A-44E6-8947-ED9342D9247E}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{BEE01B53-244A-44E6-8947-ED9342D9247E}.Debug|x64.ActiveCfg = Debug|x64
|
||||
|
||||
@ -74,6 +74,8 @@ void anim_par::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
attlist_.serialize(CP_GET_XML_NODE());
|
||||
|
||||
if (anim_par_)
|
||||
anim_par_->serialize(CP_XML_STREAM());
|
||||
|
||||
@ -98,6 +100,8 @@ void anim_seq::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
attlist_.serialize(CP_GET_XML_NODE());
|
||||
|
||||
for (size_t i = 0; i < anim_par_array_.size(); i++)
|
||||
{
|
||||
anim_par_array_[i]->serialize(CP_XML_STREAM());
|
||||
@ -136,8 +140,7 @@ void anim_transitionFilter::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
common_anim_smil_attlist_.serialize(CP_GET_XML_NODE());
|
||||
anim_transition_filter_attlist_.serialize(CP_GET_XML_NODE());
|
||||
attlist_.serialize(CP_GET_XML_NODE());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,9 +53,10 @@ public:
|
||||
static const ElementType type = typeAnimPar;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
office_element_ptr anim_par_;
|
||||
office_element_ptr_array anim_seq_array_;
|
||||
office_element_ptr_array content_;
|
||||
odf_types::common_anim_smil_attlist attlist_;
|
||||
office_element_ptr anim_par_;
|
||||
office_element_ptr_array anim_seq_array_;
|
||||
office_element_ptr_array content_;
|
||||
|
||||
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_child_element( const office_element_ptr & child);
|
||||
@ -73,7 +74,8 @@ public:
|
||||
static const ElementType type = typeAnimSeq;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
office_element_ptr_array anim_par_array_;
|
||||
odf_types::common_anim_smil_attlist attlist_;
|
||||
office_element_ptr_array anim_par_array_;
|
||||
|
||||
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_child_element( const office_element_ptr & child);
|
||||
@ -81,14 +83,11 @@ public:
|
||||
virtual void serialize(std::wostream & strm);
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(anim_seq);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//anim:iterate
|
||||
//class anim_iterate : public office_element_impl<anim_iterate>//Итеративные анимации
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//----------------------------------------------------------------------------------------------------------------/
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class anim_transition_filter_attlist
|
||||
{
|
||||
public:
|
||||
@ -117,8 +116,7 @@ public:
|
||||
|
||||
virtual void serialize(std::wostream & strm);
|
||||
///////////////////////////////////////////////////////////
|
||||
odf_types::common_anim_smil_attlist common_anim_smil_attlist_;
|
||||
anim_transition_filter_attlist anim_transition_filter_attlist_;
|
||||
anim_transition_filter_attlist attlist_;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(anim_transitionFilter);
|
||||
|
||||
|
||||
@ -342,11 +342,14 @@ namespace odf_writer
|
||||
CP_XML_ATTR(L"xmlns:tableooo", L"http://openoffice.org/2009/table" );
|
||||
CP_XML_ATTR(L"xmlns:drawooo", L"http://openoffice.org/2010/draw" );
|
||||
CP_XML_ATTR(L"xmlns:chartooo", L"http://openoffice.org/2010/chart" );
|
||||
CP_XML_ATTR(L"xmlns:smil", L"urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0");
|
||||
CP_XML_ATTR(L"xmlns:anim", L"urn:oasis:names:tc:opendocument:xmlns:animation:1.0" );
|
||||
CP_XML_ATTR(L"xmlns:calcext", L"urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" );
|
||||
CP_XML_ATTR(L"xmlns:field", L"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" );
|
||||
CP_XML_ATTR(L"xmlns:formx", L"urn:openoffice:names:experimental:ooxml-odf_writer-interop:xmlns:form:1.0" );
|
||||
CP_XML_ATTR(L"xmlns:loext", L"urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" );
|
||||
CP_XML_ATTR(L"xmlns:css3t", L"http://www.w3.org/TR/css3-text/" );
|
||||
|
||||
CP_XML_ATTR(L"office:version", L"1.2");
|
||||
|
||||
//CP_XML_NODE(L"office:scripts");
|
||||
@ -402,6 +405,8 @@ namespace odf_writer
|
||||
CP_XML_ATTR(L"xmlns:of", L"urn:oasis:names:tc:opendocument:xmlns:of:1.2" );
|
||||
CP_XML_ATTR(L"xmlns:xhtml", L"http://www.w3.org/1999/xhtml" );
|
||||
CP_XML_ATTR(L"xmlns:grddl", L"http://www.w3.org/2003/g/data-view#" );
|
||||
CP_XML_ATTR(L"xmlns:smil", L"urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0");
|
||||
CP_XML_ATTR(L"xmlns:anim", L"urn:oasis:names:tc:opendocument:xmlns:animation:1.0" );
|
||||
CP_XML_ATTR(L"xmlns:officeooo", L"http://openoffice.org/2009/office" );
|
||||
CP_XML_ATTR(L"xmlns:textooo", L"http://openoffice.org/2013/office" );
|
||||
CP_XML_ATTR(L"xmlns:tableooo", L"http://openoffice.org/2009/table" );
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
|
||||
#include "odp_conversion_context.h"
|
||||
#include "office_presentation.h"
|
||||
|
||||
#include "draw_page.h"
|
||||
|
||||
#include "styles.h"
|
||||
@ -213,6 +214,17 @@ void odp_conversion_context::end_note()
|
||||
current_slide().drawing_context()->end_element();
|
||||
current_slide().drawing_context()->end_drawing();
|
||||
}
|
||||
void odp_conversion_context::start_timing()
|
||||
{
|
||||
anim_state anim;
|
||||
anim.elm = current_slide().page_elm_;
|
||||
current_slide().anim_levels.push_back(anim);
|
||||
}
|
||||
void odp_conversion_context::end_timing()
|
||||
{
|
||||
current_slide().anim_levels.pop_back();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,6 +80,9 @@ public:
|
||||
void start_note(bool bMaster = false);
|
||||
void end_note();
|
||||
|
||||
void start_timing();
|
||||
void end_timing();
|
||||
|
||||
private:
|
||||
odp_slide_context slide_context_;
|
||||
|
||||
|
||||
@ -40,6 +40,7 @@
|
||||
#include "odp_conversion_context.h"
|
||||
|
||||
#include "draw_page.h"
|
||||
#include "anim_elements.h"
|
||||
#include "office_annotation.h"
|
||||
#include "styles.h"
|
||||
|
||||
@ -63,12 +64,15 @@ odp_page_state::odp_page_state(odf_conversion_context * Context, office_element_
|
||||
page_elm_ = elm;
|
||||
|
||||
}
|
||||
|
||||
void odp_page_state::set_page_id(int id)
|
||||
{
|
||||
page_id_ = id;
|
||||
}
|
||||
void odp_page_state::set_page_name(std::wstring name)
|
||||
{
|
||||
if (name.empty()) return;
|
||||
|
||||
office_page_name_ = name;
|
||||
page_name_ = name;
|
||||
|
||||
draw_page* page = dynamic_cast<draw_page*>(page_elm_.get());
|
||||
if (page)
|
||||
@ -129,6 +133,129 @@ void odp_page_state::add_child_element( const office_element_ptr & child_element
|
||||
{
|
||||
page_elm_->add_child_element(child_element);
|
||||
}
|
||||
void odp_page_state::set_anim_id (int val)
|
||||
{
|
||||
if (anim_levels.empty()) return;
|
||||
if (!anim_levels.back().attlist)return;
|
||||
|
||||
anim_levels.back().id = val;
|
||||
|
||||
//anim_levels.back().attlist->smil_begin_ = L"id" + std::to_wstring(val) + L".begin";
|
||||
}
|
||||
void odp_page_state::set_anim_type(std::wstring val)
|
||||
{
|
||||
if (anim_levels.empty()) return;
|
||||
if (!anim_levels.back().attlist)return;
|
||||
|
||||
if (val == L"tmRoot")
|
||||
{
|
||||
anim_levels.back().attlist->presentation_node_type_ = L"timing-root";
|
||||
if (page_transaction)
|
||||
{
|
||||
std::wstring slide_id = L"slide_id" + std::to_wstring(page_id_);
|
||||
|
||||
draw_page* page = dynamic_cast<draw_page*>(page_elm_.get());
|
||||
if (page)
|
||||
{
|
||||
page->attlist_.draw_id_ = slide_id;
|
||||
|
||||
start_timing_par();
|
||||
anim_levels.back().attlist->smil_begin_ = slide_id + L".begin";
|
||||
anim_levels.back().elm->add_child_element( page_transaction );
|
||||
end_timing_par();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void odp_page_state::set_anim_duration(std::wstring val)
|
||||
{
|
||||
if (anim_levels.empty()) return;
|
||||
if (!anim_levels.back().attlist)return;
|
||||
|
||||
//if (val == L"indefinite")
|
||||
anim_levels.back().attlist->smil_dur_ = val;
|
||||
|
||||
}
|
||||
void odp_page_state::set_anim_restart(std::wstring val)
|
||||
{
|
||||
if (anim_levels.empty()) return;
|
||||
if (!anim_levels.back().attlist)return;
|
||||
|
||||
anim_levels.back().attlist->smil_restart_ = val;
|
||||
}
|
||||
void odp_page_state::start_transition()
|
||||
{
|
||||
create_element(L"anim", L"transitionFilter", page_transaction, context_);
|
||||
}
|
||||
void odp_page_state::set_transition_type(int val)
|
||||
{
|
||||
anim_transitionFilter *trans = dynamic_cast<anim_transitionFilter*>(page_transaction.get());
|
||||
if (trans)
|
||||
trans->attlist_.smil_type_ = odf_types::smil_transition_type((odf_types::smil_transition_type::type)val);
|
||||
}
|
||||
void odp_page_state::set_transition_subtype(std::wstring val)
|
||||
{
|
||||
anim_transitionFilter *trans = dynamic_cast<anim_transitionFilter*>(page_transaction.get());
|
||||
if (trans)
|
||||
trans->attlist_.smil_subtype_ = val;
|
||||
}
|
||||
void odp_page_state::set_transition_speed(int val)
|
||||
{
|
||||
anim_transitionFilter *trans = dynamic_cast<anim_transitionFilter*>(page_transaction.get());
|
||||
if (trans)
|
||||
{
|
||||
if (val == 0) trans->attlist_.smil_dur_ = odf_types::clockvalue(3000);
|
||||
if (val == 1) trans->attlist_.smil_dur_ = odf_types::clockvalue(4000);
|
||||
if (val == 2) trans->attlist_.smil_dur_ = odf_types::clockvalue(5000);
|
||||
}
|
||||
}
|
||||
void odp_page_state::set_transition_duration(int val)
|
||||
{
|
||||
anim_transitionFilter *trans = dynamic_cast<anim_transitionFilter*>(page_transaction.get());
|
||||
if (trans)
|
||||
trans->attlist_.smil_dur_ = odf_types::clockvalue(val * 1000);
|
||||
}
|
||||
void odp_page_state::start_timing_seq()
|
||||
{
|
||||
if (anim_levels.empty()) return;
|
||||
|
||||
anim_state anim;
|
||||
create_element(L"anim", L"seq", anim.elm, context_);
|
||||
if (!anim.elm) return;
|
||||
|
||||
anim_seq *seq = dynamic_cast<anim_seq*>(anim.elm.get());
|
||||
if (seq) anim.attlist = &seq->attlist_;
|
||||
|
||||
anim_levels.back().empty = false;
|
||||
anim_levels.back().elm->add_child_element(anim.elm);
|
||||
|
||||
anim_levels.push_back(anim);
|
||||
}
|
||||
void odp_page_state::end_timing_seq()
|
||||
{
|
||||
anim_levels.pop_back();
|
||||
|
||||
}
|
||||
void odp_page_state::start_timing_par()
|
||||
{
|
||||
if (anim_levels.empty()) return;
|
||||
|
||||
anim_state anim;
|
||||
create_element(L"anim", L"par", anim.elm, context_);
|
||||
if (!anim.elm) return;
|
||||
|
||||
anim_par *par = dynamic_cast<anim_par*>(anim.elm.get());
|
||||
if (par) anim.attlist = &par->attlist_;
|
||||
|
||||
anim_levels.back().empty = false;
|
||||
anim_levels.back().elm->add_child_element(anim.elm);
|
||||
|
||||
anim_levels.push_back(anim);
|
||||
}
|
||||
void odp_page_state::end_timing_par()
|
||||
{
|
||||
anim_levels.pop_back();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,13 +60,15 @@ class odf_text_context;
|
||||
class style;
|
||||
|
||||
|
||||
struct odp_element_state
|
||||
struct anim_state
|
||||
{
|
||||
office_element_ptr elm;
|
||||
anim_state() : empty(true), attlist(NULL), id(-1) {}
|
||||
|
||||
short repeated;
|
||||
std::wstring style_name;
|
||||
office_element_ptr style_elm;
|
||||
int id;
|
||||
office_element_ptr elm;
|
||||
odf_types::common_anim_smil_attlist* attlist;
|
||||
|
||||
bool empty;
|
||||
};
|
||||
|
||||
|
||||
@ -74,8 +76,9 @@ class odp_page_state
|
||||
{
|
||||
public:
|
||||
odp_page_state(odf_conversion_context * Context, office_element_ptr & elm);
|
||||
void set_page_name(std::wstring name);
|
||||
void set_page_style(office_element_ptr & _style);
|
||||
void set_page_name (std::wstring name);
|
||||
void set_page_id (int id);
|
||||
void set_page_style (office_element_ptr & _style);
|
||||
|
||||
void set_master_page(std::wstring name);
|
||||
void set_layout_page(std::wstring name);
|
||||
@ -86,9 +89,31 @@ public:
|
||||
odf_drawing_context * drawing_context(){return &drawing_context_;}
|
||||
odf_comment_context * comment_context(){return &comment_context_;}
|
||||
|
||||
std::wstring office_page_name_;
|
||||
office_element_ptr page_elm_;
|
||||
office_element_ptr page_style_elm_;
|
||||
std::wstring page_name_;
|
||||
int page_id_;
|
||||
office_element_ptr page_elm_;
|
||||
office_element_ptr page_style_elm_;
|
||||
|
||||
std::vector<anim_state> anim_levels;
|
||||
office_element_ptr page_transaction;
|
||||
|
||||
void set_anim_id (int val);
|
||||
void set_anim_type (std::wstring val);
|
||||
void set_anim_duration (std::wstring val);
|
||||
void set_anim_restart (std::wstring val);
|
||||
|
||||
void start_timing_par();
|
||||
void end_timing_par();
|
||||
|
||||
void start_timing_seq();
|
||||
void end_timing_seq();
|
||||
|
||||
void start_transition();
|
||||
void set_transition_type (int val);
|
||||
void set_transition_subtype (std::wstring val);
|
||||
void set_transition_speed (int val);
|
||||
void set_transition_duration(int val);
|
||||
void end_transition(){}
|
||||
private:
|
||||
|
||||
odf_conversion_context * context_;
|
||||
|
||||
@ -73,6 +73,7 @@ void odp_slide_context::start_page(office_element_ptr & elm)
|
||||
office_element_ptr & style = styles_context_->add_or_find(style_name_new, style_family::DrawingPage, true);
|
||||
style->create_child_element(L"style", L"drawing-page-properties");
|
||||
|
||||
state().set_page_id(count_slides_);
|
||||
state().set_page_style(style);
|
||||
state().drawing_context()->set_styles_context(styles_context_);
|
||||
}
|
||||
|
||||
@ -253,116 +253,88 @@ void DocxConverter::convert(OOX::WritingElement *oox_unknown)
|
||||
{
|
||||
case OOX::et_w_ptab:
|
||||
{
|
||||
OOX::Logic::CPTab* pT= dynamic_cast<OOX::Logic::CPTab*>(oox_unknown);
|
||||
convert(pT);
|
||||
convert(dynamic_cast<OOX::Logic::CPTab*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_sdt:
|
||||
{
|
||||
OOX::Logic::CSdt* pP= dynamic_cast<OOX::Logic::CSdt*>(oox_unknown);
|
||||
convert(pP);
|
||||
convert(dynamic_cast<OOX::Logic::CSdt*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_fldSimple:
|
||||
{
|
||||
OOX::Logic::CFldSimple* pFldS= dynamic_cast<OOX::Logic::CFldSimple*>(oox_unknown);
|
||||
convert(pFldS);
|
||||
convert(dynamic_cast<OOX::Logic::CFldSimple*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_r:
|
||||
{
|
||||
OOX::Logic::CRun* pRun= dynamic_cast<OOX::Logic::CRun*>(oox_unknown);
|
||||
convert(pRun);
|
||||
convert(dynamic_cast<OOX::Logic::CRun*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_p:
|
||||
{
|
||||
OOX::Logic::CParagraph* pP= dynamic_cast<OOX::Logic::CParagraph*>(oox_unknown);
|
||||
convert(pP);
|
||||
convert(dynamic_cast<OOX::Logic::CParagraph*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_ins:
|
||||
{
|
||||
OOX::Logic::CIns* pIns= dynamic_cast<OOX::Logic::CIns*>(oox_unknown);
|
||||
convert(pIns);
|
||||
convert(dynamic_cast<OOX::Logic::CIns*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_del:
|
||||
{
|
||||
OOX::Logic::CDel* pDel= dynamic_cast<OOX::Logic::CDel*>(oox_unknown);
|
||||
convert(pDel);
|
||||
convert(dynamic_cast<OOX::Logic::CDel*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_smartTag:
|
||||
{
|
||||
OOX::Logic::CSmartTag* pTag= dynamic_cast<OOX::Logic::CSmartTag*>(oox_unknown);
|
||||
convert(pTag);
|
||||
convert(dynamic_cast<OOX::Logic::CSmartTag*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_pPr:
|
||||
{
|
||||
OOX::Logic::CParagraphProperty* pPProp= dynamic_cast<OOX::Logic::CParagraphProperty*>(oox_unknown);
|
||||
convert(pPProp);
|
||||
convert(dynamic_cast<OOX::Logic::CParagraphProperty*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_hyperlink:
|
||||
{
|
||||
OOX::Logic::CHyperlink* pH= dynamic_cast<OOX::Logic::CHyperlink*>(oox_unknown);
|
||||
convert(pH);
|
||||
convert(dynamic_cast<OOX::Logic::CHyperlink*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_rPr:
|
||||
{
|
||||
OOX::Logic::CRunProperty* pRProp= dynamic_cast<OOX::Logic::CRunProperty*>(oox_unknown);
|
||||
convert(pRProp);
|
||||
convert(dynamic_cast<OOX::Logic::CRunProperty*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_mc_alternateContent:
|
||||
{
|
||||
OOX::Logic::CAlternateContent* pAltCont= dynamic_cast<OOX::Logic::CAlternateContent*>(oox_unknown);
|
||||
convert(pAltCont);
|
||||
convert(dynamic_cast<OOX::Logic::CAlternateContent*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_drawing:
|
||||
{
|
||||
OOX::Logic::CDrawing* pDrawing= dynamic_cast<OOX::Logic::CDrawing*>(oox_unknown);
|
||||
convert(pDrawing);
|
||||
convert(dynamic_cast<OOX::Logic::CDrawing*>(oox_unknown));
|
||||
}break;
|
||||
//case OOX::et_c_chart:
|
||||
//{
|
||||
// PPTX::Logic::ChartRec* pChart = dynamic_cast<PPTX::Logic::ChartRec*>(oox_unknown);
|
||||
// convert(pChart);
|
||||
//}break;
|
||||
//case OOX::et_w_Shape:
|
||||
//{
|
||||
// OOX::Logic::CShape* pShape = dynamic_cast<OOX::Logic::CShape*>(oox_unknown);
|
||||
// convert(pShape);
|
||||
//}break;
|
||||
case OOX::et_w_pict:
|
||||
{
|
||||
OOX::Logic::CPicture* pPic = dynamic_cast<OOX::Logic::CPicture*>(oox_unknown);
|
||||
convert(pPic);
|
||||
convert(dynamic_cast<OOX::Logic::CPicture*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_object:
|
||||
{
|
||||
OOX::Logic::CObject* pObj = dynamic_cast<OOX::Logic::CObject*>(oox_unknown);
|
||||
convert(pObj);
|
||||
convert(dynamic_cast<OOX::Logic::CObject*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_pic_pic:
|
||||
case OOX::et_pic:
|
||||
case OOX::et_p_pic:
|
||||
{
|
||||
PPTX::Logic::Pic* pPic = dynamic_cast<PPTX::Logic::Pic*>(oox_unknown);
|
||||
convert(pPic);
|
||||
convert(dynamic_cast<PPTX::Logic::Pic*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_GroupShape:
|
||||
case OOX::et_p_ShapeTree:
|
||||
{
|
||||
PPTX::Logic::SpTree* pGroupShape= dynamic_cast<PPTX::Logic::SpTree*>(oox_unknown);
|
||||
convert(pGroupShape);
|
||||
convert(dynamic_cast<PPTX::Logic::SpTree*>(oox_unknown));
|
||||
}break;
|
||||
|
||||
case OOX::et_w_commentRangeEnd:
|
||||
{
|
||||
OOX::Logic::CCommentRangeEnd* pCommEnd = dynamic_cast<OOX::Logic::CCommentRangeEnd*>(oox_unknown);
|
||||
convert(pCommEnd);
|
||||
convert(dynamic_cast<OOX::Logic::CCommentRangeEnd*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_commentRangeStart:
|
||||
{
|
||||
OOX::Logic::CCommentRangeStart* pCommStart = dynamic_cast<OOX::Logic::CCommentRangeStart*>(oox_unknown);
|
||||
convert(pCommStart);
|
||||
convert(dynamic_cast<OOX::Logic::CCommentRangeStart*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_commentReference:
|
||||
{
|
||||
convert(dynamic_cast<OOX::Logic::CCommentReference*>(oox_unknown)); //если нет Start - означает начало с предыдущего Run
|
||||
convert(dynamic_cast<OOX::Logic::CCommentReference*>(oox_unknown));
|
||||
//если нет Start - означает начало с предыдущего Run
|
||||
}break;
|
||||
case OOX::et_w_footnoteReference:
|
||||
{
|
||||
@ -386,13 +358,11 @@ void DocxConverter::convert(OOX::WritingElement *oox_unknown)
|
||||
}break;
|
||||
case OOX::et_w_tr:
|
||||
{
|
||||
OOX::Logic::CTr* pRow= dynamic_cast<OOX::Logic::CTr*>(oox_unknown);
|
||||
convert(pRow);
|
||||
convert(dynamic_cast<OOX::Logic::CTr*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_tc:
|
||||
{
|
||||
OOX::Logic::CTc* pCell= dynamic_cast<OOX::Logic::CTc*>(oox_unknown);
|
||||
convert(pCell);
|
||||
convert(dynamic_cast<OOX::Logic::CTc*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_w_bookmarkStart:
|
||||
{
|
||||
|
||||
@ -38,6 +38,19 @@
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/NotesMaster.h"
|
||||
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Table/Table.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Par.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Seq.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/CTn.h"
|
||||
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/EmptyTransition.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/OrientationTransition.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/EightDirectionTransition.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/OptionalBlackTransition.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/SideDirectionTransition.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/CornerDirectionTransition.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/WheelTransition.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/SplitTransition.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/ZoomTransition.h"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
@ -352,7 +365,7 @@ void PptxConverter::convert_slides()
|
||||
current_slide = slide->Master.operator->();
|
||||
|
||||
if (bShowLayoutMasterSp && bShowMasterSp)
|
||||
convert_slide(&slide->Master->cSld, current_txStyles, false, true);
|
||||
convert_slide(&slide->Master->cSld, current_txStyles, false, true, 2);
|
||||
else
|
||||
convert(slide->Master->cSld.bg.GetPointer());
|
||||
|
||||
@ -360,7 +373,13 @@ void PptxConverter::convert_slides()
|
||||
current_clrMap = slide->Layout->clrMapOvr->overrideClrMapping.GetPointer();
|
||||
current_slide = slide->Layout.operator->();
|
||||
|
||||
convert_slide(&slide->Layout->cSld, current_txStyles, true, bShowLayoutMasterSp);
|
||||
convert_slide(&slide->Layout->cSld, current_txStyles, true, bShowLayoutMasterSp, 3);
|
||||
|
||||
if (slide->Layout->transition.IsInit()) convert (slide->Layout->transition.GetPointer());
|
||||
else convert (slide->Master->transition.GetPointer());
|
||||
|
||||
if (slide->Layout->timing.IsInit()) convert (slide->Layout->timing.GetPointer());
|
||||
else convert (slide->Master->timing.GetPointer());
|
||||
|
||||
if (!presentation->notesMasterIdLst.empty())
|
||||
{
|
||||
@ -368,7 +387,6 @@ void PptxConverter::convert_slides()
|
||||
smart_ptr<PPTX::NotesMaster> notes_master = ((*presentation)[rId]).smart_dynamic_cast<PPTX::NotesMaster>();
|
||||
convert(notes_master.operator->());
|
||||
}
|
||||
//add note master
|
||||
odp_context->end_master_slide();
|
||||
|
||||
m_mapMasters.insert(std::make_pair(master_name, master_style_name));
|
||||
@ -407,11 +425,12 @@ void PptxConverter::convert_slides()
|
||||
odp_context->current_slide().set_master_page (master_style_name);
|
||||
odp_context->current_slide().set_layout_page (layout_style_name);
|
||||
|
||||
convert_slide (slide->cSld.GetPointer(), current_txStyles, true, bShowMasterSp);
|
||||
convert_slide (slide->cSld.GetPointer(), current_txStyles, true, bShowMasterSp, 1);
|
||||
convert (slide->comments.operator->());
|
||||
convert (slide->Note.operator->());
|
||||
|
||||
convert (slide->timing.GetPointer(), slide->transition.GetPointer());
|
||||
convert (slide->transition.GetPointer());
|
||||
convert (slide->timing.GetPointer());
|
||||
|
||||
|
||||
odp_context->end_slide();
|
||||
@ -439,7 +458,7 @@ void PptxConverter::convert(PPTX::NotesMaster *oox_notes)
|
||||
|
||||
odf_context()->page_layout_context()->set_page_size(width, height);
|
||||
}
|
||||
convert_slide(&oox_notes->cSld, NULL, true, true);
|
||||
convert_slide(&oox_notes->cSld, NULL, true, true, 2);
|
||||
|
||||
odp_context->end_note();
|
||||
|
||||
@ -472,7 +491,7 @@ void PptxConverter::convert(PPTX::NotesSlide *oox_notes)
|
||||
if (oox_notes->clrMapOvr.IsInit() && oox_notes->clrMapOvr->overrideClrMapping.IsInit())
|
||||
current_clrMap = oox_notes->clrMapOvr->overrideClrMapping.GetPointer();
|
||||
|
||||
convert_slide(&oox_notes->cSld, NULL, true, true);
|
||||
convert_slide(&oox_notes->cSld, NULL, true, true, 1);
|
||||
|
||||
odp_context->end_note();
|
||||
|
||||
@ -486,6 +505,24 @@ void PptxConverter::convert(OOX::WritingElement *oox_unknown)
|
||||
|
||||
switch(oox_unknown->getType())
|
||||
{
|
||||
case OOX::et_p_EmptyTransition:
|
||||
convert(dynamic_cast<PPTX::Logic::EmptyTransition*>(oox_unknown)); break;
|
||||
case OOX::et_p_OrientationTransition:
|
||||
convert(dynamic_cast<PPTX::Logic::OrientationTransition*>(oox_unknown)); break;
|
||||
case OOX::et_p_EightDirectionTransition:
|
||||
convert(dynamic_cast<PPTX::Logic::EightDirectionTransition*>(oox_unknown)); break;
|
||||
case OOX::et_p_OptionalBlackTransition:
|
||||
convert(dynamic_cast<PPTX::Logic::OptionalBlackTransition*>(oox_unknown)); break;
|
||||
case OOX::et_p_CornerDirectionTransition:
|
||||
convert(dynamic_cast<PPTX::Logic::CornerDirectionTransition*>(oox_unknown)); break;
|
||||
case OOX::et_p_SideDirectionTransition:
|
||||
convert(dynamic_cast<PPTX::Logic::SideDirectionTransition*>(oox_unknown)); break;
|
||||
case OOX::et_p_WheelTransition:
|
||||
convert(dynamic_cast<PPTX::Logic::WheelTransition*>(oox_unknown)); break;
|
||||
case OOX::et_p_SplitTransition:
|
||||
convert(dynamic_cast<PPTX::Logic::SplitTransition*>(oox_unknown)); break;
|
||||
case OOX::et_p_ZoomTransition:
|
||||
convert(dynamic_cast<PPTX::Logic::ZoomTransition*>(oox_unknown)); break;
|
||||
default:
|
||||
{
|
||||
OoxConverter::convert(oox_unknown);
|
||||
@ -527,15 +564,229 @@ void PptxConverter::convert(PPTX::Comments *oox_comments)
|
||||
odp_context->end_comment();
|
||||
}
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::Timing *oox_timing, PPTX::Logic::Transition *oox_transition)
|
||||
void PptxConverter::convert( PPTX::Logic::Transition *oox_transition )
|
||||
{
|
||||
if (!oox_transition) return;
|
||||
if (oox_transition->base.is_init() == false) return;
|
||||
|
||||
odp_context->current_slide().start_transition();
|
||||
if (oox_transition->spd.is_init())
|
||||
odp_context->current_slide().set_transition_speed(oox_transition->spd->GetBYTECode());
|
||||
if (oox_transition->dur.is_init())
|
||||
odp_context->current_slide().set_transition_duration(*oox_transition->dur);
|
||||
|
||||
convert(oox_transition->base.base.operator->());
|
||||
|
||||
//if (oox_transition->sndAc.is_init() && oox_transition->sndAc->stSnd.is_init())
|
||||
//{
|
||||
// std::wstring sID = oox_transition->sndAc->stSnd->embed->get();
|
||||
// pathAudio = find_link_by_id(sID, 1);
|
||||
//
|
||||
// std::wstring odf_ref = odf_context()->add_media(pathAudio);
|
||||
|
||||
// odp_context->current_slide().set_transition_sound(odf_ref, oox_transition->sndAc->stSnd->loop.get_value_or(false));
|
||||
//}
|
||||
|
||||
odp_context->current_slide().end_transition();
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::Timing *oox_timing)
|
||||
{
|
||||
if (!oox_timing) return;
|
||||
if (!oox_timing->tnLst.IsInit()) return;
|
||||
|
||||
odp_context->start_timing();
|
||||
for (size_t i = 0; i < oox_timing->tnLst->list.size(); i++)
|
||||
{
|
||||
//oox_timing->tnLst[0]
|
||||
if (oox_timing->tnLst->list[i].is_init() == false) continue;
|
||||
|
||||
convert(&oox_timing->tnLst->list[i]);
|
||||
}
|
||||
odp_context->end_timing();
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::TimeNodeBase *oox_time_base)
|
||||
{
|
||||
if (!oox_time_base) return;
|
||||
|
||||
if (oox_time_base->is<PPTX::Logic::Par>()) //Parallel Time
|
||||
{
|
||||
PPTX::Logic::Par & par = oox_time_base->as<PPTX::Logic::Par>();
|
||||
|
||||
odp_context->current_slide().start_timing_par();
|
||||
convert(&par.cTn);
|
||||
odp_context->current_slide().end_timing_par();
|
||||
}
|
||||
else if (oox_time_base->is<PPTX::Logic::Seq>()) //Sequence Time
|
||||
{
|
||||
PPTX::Logic::Seq & seq = oox_time_base->as<PPTX::Logic::Seq>();
|
||||
odp_context->current_slide().start_timing_seq();
|
||||
convert(&seq.cTn);
|
||||
odp_context->current_slide().end_timing_seq();
|
||||
}
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::EmptyTransition *oox_transition)
|
||||
{
|
||||
if (!oox_transition) return;
|
||||
|
||||
if (oox_transition->name == L"random")
|
||||
odp_context->current_slide().set_transition_type(40);
|
||||
if (oox_transition->name == L"circle")
|
||||
odp_context->current_slide().set_transition_type(16);
|
||||
if (oox_transition->name == L"dissolve")
|
||||
odp_context->current_slide().set_transition_type(39);
|
||||
if (oox_transition->name == L"diamond")
|
||||
{
|
||||
odp_context->current_slide().set_transition_type(11);
|
||||
odp_context->current_slide().set_transition_subtype(L"diamond");
|
||||
}
|
||||
if (oox_transition->name == L"newsflash")
|
||||
odp_context->current_slide().set_transition_type(5);
|
||||
if (oox_transition->name == L"plus")
|
||||
odp_context->current_slide().set_transition_type(2);//??
|
||||
if (oox_transition->name == L"wedge")
|
||||
odp_context->current_slide().set_transition_type(24);
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::OrientationTransition *oox_transition)
|
||||
{
|
||||
if (!oox_transition) return;
|
||||
|
||||
if (oox_transition->name == L"blinds")
|
||||
odp_context->current_slide().set_transition_type(38);
|
||||
if (oox_transition->name == L"checker")
|
||||
odp_context->current_slide().set_transition_type(37);
|
||||
if (oox_transition->name == L"comb")
|
||||
{
|
||||
odp_context->current_slide().set_transition_type(34);
|
||||
|
||||
if (oox_transition->dir.IsInit())
|
||||
{
|
||||
if (oox_transition->dir->get() == L"horz")
|
||||
odp_context->current_slide().set_transition_subtype(L"combHorizontal");
|
||||
if (oox_transition->dir->get() == L"vert")
|
||||
odp_context->current_slide().set_transition_subtype(L"combVertical");
|
||||
}
|
||||
}
|
||||
if (oox_transition->name == L"randomBar")
|
||||
odp_context->current_slide().set_transition_type(40);
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::EightDirectionTransition *oox_transition)
|
||||
{
|
||||
if (!oox_transition) return;
|
||||
|
||||
if (oox_transition->name == L"cover")
|
||||
odp_context->current_slide().set_transition_type(1);
|
||||
if (oox_transition->name == L"pull")
|
||||
odp_context->current_slide().set_transition_type(35);
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::OptionalBlackTransition *oox_transition)
|
||||
{
|
||||
if (!oox_transition) return;
|
||||
|
||||
if (oox_transition->name == L"cut")
|
||||
odp_context->current_slide().set_transition_type(36);
|
||||
if (oox_transition->name == L"fade")
|
||||
odp_context->current_slide().set_transition_type(36);
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::SideDirectionTransition *oox_transition)
|
||||
{
|
||||
if (!oox_transition) return;
|
||||
|
||||
std::wstring dir;
|
||||
if (oox_transition->dir.IsInit()) dir = oox_transition->dir->get();
|
||||
|
||||
if (oox_transition->name == L"push")
|
||||
{
|
||||
odp_context->current_slide().set_transition_type(34);
|
||||
if (dir == L"d") odp_context->current_slide().set_transition_subtype(L"fromTop");
|
||||
if (dir == L"l") odp_context->current_slide().set_transition_subtype(L"fromRight");
|
||||
if (dir == L"r") odp_context->current_slide().set_transition_subtype(L"fromLeft");
|
||||
if (dir == L"u") odp_context->current_slide().set_transition_subtype(L"fromBottom");
|
||||
}
|
||||
if (oox_transition->name == L"wipe")
|
||||
odp_context->current_slide().set_transition_type(0);
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::CornerDirectionTransition *oox_transition)
|
||||
{
|
||||
if (!oox_transition) return;
|
||||
//name == strips
|
||||
odp_context->current_slide().set_transition_type(4);
|
||||
|
||||
if (oox_transition->dir.IsInit())
|
||||
{
|
||||
if (oox_transition->dir->get() == L"rd") odp_context->current_slide().set_transition_subtype(L"horizontalLeft");
|
||||
if (oox_transition->dir->get() == L"lu") odp_context->current_slide().set_transition_subtype(L"horizontalRight");
|
||||
if (oox_transition->dir->get() == L"ld") odp_context->current_slide().set_transition_subtype(L"verticalRight");
|
||||
}
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::WheelTransition *oox_transition)
|
||||
{
|
||||
if (!oox_transition) return;
|
||||
//name == wheel
|
||||
odp_context->current_slide().set_transition_type(21);
|
||||
|
||||
switch (oox_transition->spokes.get_value_or(0))
|
||||
{
|
||||
case 1: odp_context->current_slide().set_transition_subtype(L"oneBlade"); break;
|
||||
case 3: odp_context->current_slide().set_transition_subtype(L"threeBlade"); break;
|
||||
case 4: odp_context->current_slide().set_transition_subtype(L"fourBlade"); break;
|
||||
case 8: odp_context->current_slide().set_transition_subtype(L"eightBlade"); break;
|
||||
}
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::SplitTransition *oox_transition)
|
||||
{
|
||||
if (!oox_transition) return;
|
||||
//name == split
|
||||
odp_context->current_slide().set_transition_type(8);
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::ZoomTransition *oox_transition)
|
||||
{
|
||||
if (!oox_transition) return;
|
||||
//name == zoom
|
||||
odp_context->current_slide().set_transition_type(11);
|
||||
}
|
||||
|
||||
void PptxConverter::convert(PPTX::Logic::CTn *oox_time_common)
|
||||
{
|
||||
if (!oox_time_common) return;
|
||||
|
||||
if (oox_time_common->id.IsInit())
|
||||
{
|
||||
odp_context->current_slide().set_anim_id(*oox_time_common->id);
|
||||
}
|
||||
if (oox_time_common->nodeType.IsInit())
|
||||
{
|
||||
odp_context->current_slide().set_anim_type(oox_time_common->nodeType->get());
|
||||
}
|
||||
if (oox_time_common->dur.IsInit())
|
||||
{
|
||||
odp_context->current_slide().set_anim_duration(*oox_time_common->dur);
|
||||
}
|
||||
if (oox_time_common->restart.IsInit())
|
||||
{
|
||||
odp_context->current_slide().set_anim_restart(oox_time_common->restart->get());
|
||||
}
|
||||
|
||||
//nullable<CondLst> stCondLst;
|
||||
//nullable<CondLst> endCondLst;
|
||||
//nullable<Cond> endSync;
|
||||
//nullable<Iterate> iterate;
|
||||
if (oox_time_common->childTnLst.IsInit())
|
||||
{
|
||||
for (size_t i = 0; i < oox_time_common->childTnLst->list.size(); i++)
|
||||
{
|
||||
if (oox_time_common->childTnLst->list[i].is_init() == false) continue;
|
||||
|
||||
convert(&oox_time_common->childTnLst->list[i]);
|
||||
}
|
||||
}
|
||||
//if (oox_time_common->subTnLst.IsInit())
|
||||
//{
|
||||
// for (size_t i = 0; i < oox_time_common->subTnLst->list.size(); i++)
|
||||
// {
|
||||
// if (oox_time_common->subTnLst->list[i].is_init() == false) continue;
|
||||
|
||||
// convert(&oox_time_common->subTnLst->list[i]);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::TableProperties *oox_table_pr)
|
||||
{
|
||||
@ -1021,7 +1272,7 @@ void PptxConverter::convert(PPTX::Logic::Bg *oox_background)
|
||||
odp_context->end_drawings();
|
||||
}
|
||||
|
||||
void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp)
|
||||
void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp, int type)
|
||||
{
|
||||
if (oox_slide == NULL) return;
|
||||
|
||||
@ -1051,6 +1302,9 @@ void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxS
|
||||
{
|
||||
int ph_type = pShape->nvSpPr.nvPr.ph->type->GetBYTECode();
|
||||
|
||||
if (type == 3 && (ph_type == 5 || ph_type == 6 || ph_type == 7 || ph_type == 12))
|
||||
continue;
|
||||
|
||||
odf_context()->drawing_context()->set_placeholder_type(ph_type);
|
||||
}
|
||||
else
|
||||
|
||||
@ -67,6 +67,17 @@ namespace PPTX
|
||||
class TableCellProperties;
|
||||
class TcBdr;
|
||||
class TxStyles;
|
||||
class TimeNodeBase;
|
||||
class CTn;
|
||||
class EmptyTransition;
|
||||
class OrientationTransition;
|
||||
class EightDirectionTransition;
|
||||
class OptionalBlackTransition;
|
||||
class CornerDirectionTransition;
|
||||
class SideDirectionTransition;
|
||||
class WheelTransition;
|
||||
class SplitTransition;
|
||||
class ZoomTransition;
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,14 +119,17 @@ namespace Oox2Odf
|
||||
|
||||
void convert(OOX::WritingElement *oox_unknown);
|
||||
|
||||
void convert_slide (PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp);
|
||||
void convert_slide (PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp, int type);
|
||||
void convert_layout (PPTX::Logic::CSld *oox_slide);
|
||||
void convert (PPTX::Comments *oox_comments);
|
||||
void convert (PPTX::NotesSlide *oox_notes);
|
||||
void convert (PPTX::NotesMaster *oox_notes);
|
||||
|
||||
void convert(PPTX::Logic::Bg *oox_background);
|
||||
void convert(PPTX::Logic::Timing *oox_timing, PPTX::Logic::Transition *oox_transition);
|
||||
void convert(PPTX::Logic::Timing *oox_timing);
|
||||
void convert(PPTX::Logic::Transition *oox_transition);
|
||||
void convert(PPTX::Logic::TimeNodeBase *oox_base_time);
|
||||
void convert(PPTX::Logic::CTn *oox_common_time);
|
||||
|
||||
void convert(PPTX::Logic::Table *oox_table);
|
||||
void convert(PPTX::Logic::TableRow *oox_table_row);
|
||||
@ -130,6 +144,16 @@ namespace Oox2Odf
|
||||
|
||||
void convert(PPTX::Logic::Ln *oox_ln_border, std::wstring & odf_border);
|
||||
private:
|
||||
void convert(PPTX::Logic::EmptyTransition *oox_transition);
|
||||
void convert(PPTX::Logic::OrientationTransition *oox_transition);
|
||||
void convert(PPTX::Logic::EightDirectionTransition *oox_transition);
|
||||
void convert(PPTX::Logic::OptionalBlackTransition *oox_transition);
|
||||
void convert(PPTX::Logic::CornerDirectionTransition *oox_transition);
|
||||
void convert(PPTX::Logic::SideDirectionTransition *oox_transition);
|
||||
void convert(PPTX::Logic::WheelTransition *oox_transition);
|
||||
void convert(PPTX::Logic::SplitTransition *oox_transition);
|
||||
void convert(PPTX::Logic::ZoomTransition *oox_transition);
|
||||
|
||||
PPTX::Folder *pptx_document;
|
||||
PPTX::Presentation *presentation;
|
||||
cpdoccore::odf_writer::package::odf_document *output_document;
|
||||
|
||||
@ -208,40 +208,48 @@ void NSPresentationEditor::CPPTXWriter::WriteContentTypes()
|
||||
<Override PartName=\"/docProps/core.xml\" ContentType=\"application/vnd.openxmlformats-package.core-properties+xml\" />\
|
||||
<Override PartName=\"/docProps/app.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.extended-properties+xml\" />");
|
||||
|
||||
int nThemes = (int)m_pDocument->m_arThemes.size();
|
||||
int nIndexLayout = 0;
|
||||
for (int nT = 0; nT < nThemes; ++nT)
|
||||
int nIndexLayout = 1, nIndexTheme = 1;
|
||||
|
||||
for (size_t nT = 0; nT < m_pDocument->m_arThemes.size(); nT++, nIndexTheme++)
|
||||
{
|
||||
strContentTypes += L"<Override PartName=\"/ppt/theme/theme" + std::to_wstring(nT + 1) +
|
||||
L".xml\" ContentType=\"application/vnd.openxmlformats-officedocument.theme+xml\" />\
|
||||
<Override PartName=\"/ppt/slideMasters/slideMaster" + std::to_wstring(nT + 1) +
|
||||
strContentTypes += L"<Override PartName=\"/ppt/theme/theme" + std::to_wstring(nIndexTheme) + \
|
||||
L".xml\" ContentType=\"application/vnd.openxmlformats-officedocument.theme+xml\" />";
|
||||
|
||||
strContentTypes += L"<Override PartName=\"/ppt/slideMasters/slideMaster" + std::to_wstring(nIndexTheme) + \
|
||||
L".xml\" ContentType=\"application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml\"/>";
|
||||
|
||||
|
||||
int nCountL = (int)m_pDocument->m_arThemes[nT].m_arLayouts.size();
|
||||
for (int nL = 0; nL < nCountL; ++nL, ++nIndexLayout)
|
||||
for (size_t nL = 0; nL < m_pDocument->m_arThemes[nT].m_arLayouts.size(); nL++, nIndexLayout++)
|
||||
{
|
||||
strContentTypes += L"<Override PartName=\"/ppt/slideLayouts/slideLayout" + std::to_wstring(nIndexLayout + 1) +
|
||||
strContentTypes += L"<Override PartName=\"/ppt/slideLayouts/slideLayout" + std::to_wstring(nIndexLayout) +
|
||||
L".xml\" ContentType=\"application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml\"/>";
|
||||
}
|
||||
}
|
||||
std::wstring strNotesTheme = L"<Override PartName=\"/ppt/theme/theme" + std::to_wstring(nThemes + 1) + L".xml\" \
|
||||
ContentType=\"application/vnd.openxmlformats-officedocument.theme+xml\"/>";
|
||||
|
||||
if (m_pDocument->m_pNotesMaster)
|
||||
{
|
||||
strContentTypes += L"<Override PartName=\"/ppt/theme/theme" + std::to_wstring(nIndexTheme++) + L".xml\" \
|
||||
ContentType=\"application/vnd.openxmlformats-officedocument.theme+xml\"/>";
|
||||
strContentTypes += L"<Override PartName=\"/ppt/notesMasters/notesMaster1.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml\"/>";
|
||||
}
|
||||
if (m_pDocument->m_pHandoutMaster)
|
||||
{
|
||||
strContentTypes += L"<Override PartName=\"/ppt/theme/theme" + std::to_wstring(nIndexTheme++) + L".xml\" \
|
||||
ContentType=\"application/vnd.openxmlformats-officedocument.theme+xml\"/>";
|
||||
strContentTypes += L"<Override PartName=\"/ppt/handoutMasters/handoutMaster1.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.presentationml.handoutMaster+xml\"/>";
|
||||
}
|
||||
|
||||
strContentTypes += strNotesTheme;
|
||||
strContentTypes += _T("<Override PartName=\"/ppt/notesMasters/notesMaster1.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml\"/>");
|
||||
|
||||
int nCountS = (int)m_pDocument->m_arSlides.size();
|
||||
for (int nS = 0; nS < nCountS; ++nS)
|
||||
for (size_t nS = 0; nS < m_pDocument->m_arSlides.size(); ++nS)
|
||||
{
|
||||
strContentTypes += L"<Override PartName=\"/ppt/slides/slide" + std::to_wstring( nS + 1)
|
||||
+ L".xml\" ContentType=\"application/vnd.openxmlformats-officedocument.presentationml.slide+xml\"/>";
|
||||
}
|
||||
|
||||
for (size_t nS = 0; nS < m_pDocument->m_arNotes.size(); ++nS)
|
||||
{
|
||||
strContentTypes += L"<Override PartName=\"/ppt/notesSlides/notesSlide" + std::to_wstring( nS + 1)
|
||||
+ L".xml\" ContentType=\"application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml\"/>";
|
||||
}
|
||||
|
||||
strContentTypes += _T("</Types>");
|
||||
|
||||
CFile oFile;
|
||||
@ -264,9 +272,9 @@ void NSPresentationEditor::CPPTXWriter::WriteApp(CFile& oFile)
|
||||
oFile.WriteStringUTF8(str1);
|
||||
|
||||
oFile.WriteStringUTF8(L"<Slides>" + std::to_wstring(m_pDocument->m_arSlides.size()) + L"</Slides>");
|
||||
oFile.WriteStringUTF8(L"<Notes>" + std::to_wstring(m_pDocument->m_arNotes.size()) + L"</Notes>");
|
||||
|
||||
oFile.WriteStringUTF8(L"<Notes>0</Notes>\
|
||||
<HiddenSlides>0</HiddenSlides>\
|
||||
oFile.WriteStringUTF8(L"<HiddenSlides>0</HiddenSlides>\
|
||||
<MMClips>2</MMClips>\
|
||||
<ScaleCrop>false</ScaleCrop>\
|
||||
<HeadingPairs>\
|
||||
@ -301,7 +309,7 @@ void NSPresentationEditor::CPPTXWriter::WriteApp(CFile& oFile)
|
||||
<LinksUpToDate>false</LinksUpToDate>\
|
||||
<SharedDoc>false</SharedDoc>\
|
||||
<HyperlinksChanged>false</HyperlinksChanged>\
|
||||
<AppVersion>1.0000</AppVersion>\
|
||||
<AppVersion>4.4000</AppVersion>\
|
||||
</Properties>");
|
||||
|
||||
strMemory += str5;
|
||||
@ -344,12 +352,14 @@ void NSPresentationEditor::CPPTXWriter::WritePresInfo()
|
||||
// presentation.xml + _rels/presentation.xml.rels
|
||||
std::wstring strPresRels;
|
||||
|
||||
std::wstring strPresMasters = _T("");
|
||||
std::wstring strPresSlides = _T("");
|
||||
std::wstring strPresMasters;
|
||||
std::wstring strPresSlides;
|
||||
std::wstring strNotesIDs;
|
||||
std::wstring strHandoutIDs;
|
||||
|
||||
size_t nCountLayouts = 0;
|
||||
size_t nCountThemes = m_pDocument->m_arThemes.size();
|
||||
for (size_t nIndexTheme = 0; nIndexTheme < nCountThemes; ++nIndexTheme)
|
||||
|
||||
for (size_t nIndexTheme = 0; nIndexTheme < m_pDocument->m_arThemes.size(); ++nIndexTheme)
|
||||
{
|
||||
strPresRels += L"<Relationship Id=\"rId" + std::to_wstring(2 * nIndexTheme + 1) +
|
||||
L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster\" Target=\"slideMasters/slideMaster" +
|
||||
@ -365,9 +375,21 @@ void NSPresentationEditor::CPPTXWriter::WritePresInfo()
|
||||
nCountLayouts += 1;
|
||||
}
|
||||
|
||||
int nCurrentRels = (int)(2 * nCountThemes + 1);
|
||||
size_t nCountSlides = m_pDocument->m_arSlides.size();
|
||||
for (size_t nIndexSlide = 0; nIndexSlide < nCountSlides; ++nIndexSlide, ++nCurrentRels)
|
||||
int nCurrentRels = (int)(2 * m_pDocument->m_arThemes.size() + 1);
|
||||
|
||||
if (m_pDocument->m_pNotesMaster)
|
||||
{
|
||||
strNotesIDs = L"<p:notesMasterIdLst><p:notesMasterId r:id=\"rId" + std::to_wstring(nCurrentRels) + L"\"/></p:notesMasterIdLst>";
|
||||
strPresRels += L"<Relationship Id=\"rId" + std::to_wstring(nCurrentRels) + L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster\" Target=\"notesMasters/notesMaster1.xml\"/>";
|
||||
++nCurrentRels;
|
||||
}
|
||||
if (m_pDocument->m_pHandoutMaster)
|
||||
{
|
||||
strHandoutIDs = L"<p:handoutMasterIdLst><p:handoutMasterId r:id=\"rId" + std::to_wstring(nCurrentRels) + L"\"/></p:handoutMasterIdLst>";
|
||||
strPresRels += L"<Relationship Id=\"rId" + std::to_wstring(nCurrentRels) + L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/handoutMaster\" Target=\"handoutMasters/handoutMaster1.xml\"/>";
|
||||
++nCurrentRels;
|
||||
}
|
||||
for (size_t nIndexSlide = 0; nIndexSlide < m_pDocument->m_arSlides.size(); ++nIndexSlide, ++nCurrentRels)
|
||||
{
|
||||
strPresRels += L"<Relationship Id=\"rId" + std::to_wstring(nCurrentRels) +
|
||||
L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide\" Target=\"slides/slide" +
|
||||
@ -376,17 +398,12 @@ void NSPresentationEditor::CPPTXWriter::WritePresInfo()
|
||||
strPresSlides += L"<p:sldId id=\"" + std::to_wstring(256 + nIndexSlide) + L"\" r:id=\"rId" + std::to_wstring(nCurrentRels) + L"\"/>";
|
||||
}
|
||||
|
||||
std::wstring strNotesIDs = L"<p:notesMasterIdLst><p:notesMasterId r:id=\"rId" + std::to_wstring(nCurrentRels) + L"\"/></p:notesMasterIdLst>";
|
||||
strPresRels += L"<Relationship Id=\"rId" + std::to_wstring(nCurrentRels++) + L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/presProps\" Target=\"presProps.xml\"/>";
|
||||
strPresRels += L"<Relationship Id=\"rId" + std::to_wstring(nCurrentRels++) + L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableStyles\" Target=\"tableStyles.xml\"/>";
|
||||
strPresRels += L"<Relationship Id=\"rId" + std::to_wstring(nCurrentRels++) + L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/viewProps\" Target=\"viewProps.xml\"/>";
|
||||
|
||||
std::wstring strRels0 = L"<Relationship Id=\"rId" + std::to_wstring(nCurrentRels) + L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster\" Target=\"notesMasters/notesMaster1.xml\"/>";
|
||||
|
||||
++nCurrentRels;
|
||||
|
||||
std::wstring strRels1 = L"<Relationship Id=\"rId" + std::to_wstring(nCurrentRels++) + L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/presProps\" Target=\"presProps.xml\"/>";
|
||||
std::wstring strRels2 = L"<Relationship Id=\"rId" + std::to_wstring(nCurrentRels++) + L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableStyles\" Target=\"tableStyles.xml\"/>";
|
||||
std::wstring strRels3 = L"<Relationship Id=\"rId" + std::to_wstring(nCurrentRels++) + L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/viewProps\" Target=\"viewProps.xml\"/>";
|
||||
|
||||
strPresRels = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?><Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">") + strPresRels + strRels0 + strRels1 + strRels2 + strRels3 + _T("</Relationships>");
|
||||
strPresRels = L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?><Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">"
|
||||
+ strPresRels + L"</Relationships>";
|
||||
|
||||
std::wstring strPptRels = m_strTempDirectory + FILE_SEPARATOR_STR + _T("ppt") + FILE_SEPARATOR_STR + _T("_rels");
|
||||
|
||||
@ -401,7 +418,8 @@ void NSPresentationEditor::CPPTXWriter::WritePresInfo()
|
||||
L"\" cy=\"" + std::to_wstring(m_pDocument->m_oInfo.m_lUnitsHor) + L"\"/>";
|
||||
|
||||
std::wstring strDefaultTextStyle = _T("<p:defaultTextStyle>");
|
||||
if (m_pDocument->m_arThemes.size() > 0)
|
||||
|
||||
if (m_pDocument->m_arThemes.size() > 0)
|
||||
{
|
||||
strDefaultTextStyle += CStylesWriter::ConvertStyles(m_pDocument->m_arThemes[0].m_pStyles[0], m_pDocument->m_oInfo, 9);
|
||||
}
|
||||
@ -416,6 +434,7 @@ void NSPresentationEditor::CPPTXWriter::WritePresInfo()
|
||||
strPres += _T(">");
|
||||
strPres += _T("<p:sldMasterIdLst>") + strPresMasters + _T("</p:sldMasterIdLst>");
|
||||
strPres += strNotesIDs ;
|
||||
strPres += strHandoutIDs ;
|
||||
strPres +=_T("<p:sldIdLst>") + strPresSlides + _T("</p:sldIdLst>");
|
||||
strPres += strSizePres;
|
||||
strPres += strDefaultTextStyle;
|
||||
@ -437,79 +456,73 @@ void NSPresentationEditor::CPPTXWriter::WriteAll()
|
||||
NSDirectory::CreateDirectory(strPptDirectory + _T("slideLayouts"));
|
||||
NSDirectory::CreateDirectory(strPptDirectory + _T("slideLayouts") + FILE_SEPARATOR_STR + _T("_rels"));
|
||||
NSDirectory::CreateDirectory(strPptDirectory + _T("slides"));
|
||||
NSDirectory::CreateDirectory(strPptDirectory + _T("slides") + FILE_SEPARATOR_STR + _T("_rels"));
|
||||
NSDirectory::CreateDirectory(strPptDirectory + _T("notesMasters"));
|
||||
NSDirectory::CreateDirectory(strPptDirectory + _T("notesMasters") + FILE_SEPARATOR_STR + _T("_rels"));
|
||||
NSDirectory::CreateDirectory(strPptDirectory + _T("notesSlides"));
|
||||
NSDirectory::CreateDirectory(strPptDirectory + _T("notesSlides") + FILE_SEPARATOR_STR + _T("_rels"));
|
||||
|
||||
std::wstring strNotesTheme = L"theme" + std::to_wstring((int)m_pDocument->m_arThemes.size() + 1) + L".xml";
|
||||
strNotesTheme = strPptDirectory + _T("theme") + FILE_SEPARATOR_STR + strNotesTheme;
|
||||
|
||||
Writers::DefaultNotesThemeWriter writerNotesTheme;
|
||||
writerNotesTheme.Write( strNotesTheme);
|
||||
|
||||
std::wstring strNotesMaster = strPptDirectory + _T("notesMasters") + FILE_SEPARATOR_STR + _T("notesMaster1.xml");
|
||||
Writers::DefaultNotesMasterWriter writerNotesMaster;
|
||||
writerNotesMaster.Write(strNotesMaster);
|
||||
|
||||
std::wstring strNotesMasterRels = strPptDirectory + _T("notesMasters") + FILE_SEPARATOR_STR +_T("_rels");
|
||||
NSDirectory::CreateDirectory(strNotesMasterRels);
|
||||
|
||||
std::wstring strThemeNotesNum = std::to_wstring((int)m_pDocument->m_arThemes.size() + 1);
|
||||
|
||||
std::wstring strVal = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\
|
||||
<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">\
|
||||
<Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme\" Target=\"../theme/theme") + strThemeNotesNum + _T(".xml\"/></Relationships>");
|
||||
|
||||
std::wstring strNotesMasterRelsFile = strNotesMasterRels+ FILE_SEPARATOR_STR + _T("notesMaster1.xml.rels");
|
||||
CFile oFileRels;
|
||||
oFileRels.CreateFile(strNotesMasterRelsFile);
|
||||
oFileRels.WriteStringUTF8(strVal);
|
||||
oFileRels.CloseFile();
|
||||
// -----------------------------------------------------
|
||||
|
||||
NSDirectory::CreateDirectory(strPptDirectory + _T("slides") + FILE_SEPARATOR_STR + _T("_rels"));
|
||||
|
||||
if (m_pDocument->m_pHandoutMaster)
|
||||
{
|
||||
NSDirectory::CreateDirectory(strPptDirectory + _T("handoutMasters"));
|
||||
NSDirectory::CreateDirectory(strPptDirectory + _T("handoutMasters") + FILE_SEPARATOR_STR + _T("_rels"));
|
||||
}
|
||||
if (m_pDocument->m_pNotesMaster)
|
||||
{
|
||||
NSDirectory::CreateDirectory(strPptDirectory + _T("notesMasters"));
|
||||
NSDirectory::CreateDirectory(strPptDirectory + _T("notesMasters") + FILE_SEPARATOR_STR + _T("_rels"));
|
||||
}
|
||||
if (!m_pDocument->m_arNotes.empty())
|
||||
{
|
||||
NSDirectory::CreateDirectory(strPptDirectory + _T("notesSlides"));
|
||||
NSDirectory::CreateDirectory(strPptDirectory + _T("notesSlides") + FILE_SEPARATOR_STR + _T("_rels"));
|
||||
}
|
||||
WriteThemes();
|
||||
|
||||
WriteSlides();
|
||||
WriteNotes();
|
||||
}
|
||||
|
||||
void NSPresentationEditor::CPPTXWriter::WriteThemes()
|
||||
{
|
||||
std::wstring strPptDirectory = m_strTempDirectory + FILE_SEPARATOR_STR + _T("ppt") + FILE_SEPARATOR_STR ;
|
||||
int nStartLayout = 0, nIndexTheme = 0;
|
||||
|
||||
int nCount = (int)m_pDocument->m_arThemes.size();
|
||||
int nStartLayout = 0;
|
||||
|
||||
for (int nIndexTheme = 0; nIndexTheme < nCount; ++nIndexTheme)
|
||||
for (size_t i = 0; i < m_pDocument->m_arThemes.size(); i++)
|
||||
{
|
||||
CTheme* pTheme = &m_pDocument->m_arThemes[nIndexTheme];
|
||||
|
||||
std::wstring strThemeFile = L"theme" + std::to_wstring(nIndexTheme + 1) + L".xml";
|
||||
strThemeFile = strPptDirectory + _T("theme") + FILE_SEPARATOR_STR + strThemeFile;
|
||||
|
||||
CFile oFile;
|
||||
oFile.CreateFile(strThemeFile);
|
||||
WriteTheme(&m_pDocument->m_arThemes[i], nIndexTheme, nStartLayout, 1);
|
||||
}
|
||||
|
||||
NSPresentationEditor::CStringWriter oStringWriter;
|
||||
WriteTheme(m_pDocument->m_pNotesMaster, nIndexTheme, nStartLayout, 2);
|
||||
WriteTheme(m_pDocument->m_pHandoutMaster, nIndexTheme, nStartLayout, 3);
|
||||
}
|
||||
|
||||
oStringWriter.WriteString(std::wstring(L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?><a:theme xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" name=\""));
|
||||
oStringWriter.WriteStringXML(pTheme->m_sThemeName);
|
||||
oStringWriter.WriteString(std::wstring(L"\"><a:themeElements>"));
|
||||
void NSPresentationEditor::CPPTXWriter::WriteTheme(CTheme* pTheme, int & nIndexTheme, int & nStartLayout, int Type)
|
||||
{
|
||||
if (!pTheme) return;
|
||||
|
||||
std::wstring strPptDirectory = m_strTempDirectory + FILE_SEPARATOR_STR + _T("ppt") + FILE_SEPARATOR_STR ;
|
||||
|
||||
WriteColorScheme(oStringWriter, L"Default", pTheme->m_arColorScheme);
|
||||
std::wstring strThemeFile = L"theme" + std::to_wstring(nIndexTheme + 1) + L".xml";
|
||||
strThemeFile = strPptDirectory + _T("theme") + FILE_SEPARATOR_STR + strThemeFile;
|
||||
|
||||
CFile oFile;
|
||||
oFile.CreateFile(strThemeFile);
|
||||
|
||||
oStringWriter.WriteString(std::wstring(L"<a:fontScheme name=\"default\"><a:majorFont><a:latin typeface=\""));
|
||||
oStringWriter.WriteStringXML(pTheme->m_arFonts[0].Name);
|
||||
oStringWriter.WriteString(std::wstring(L"\"/><a:ea typeface=\"\"/><a:cs typeface=\"\"/></a:majorFont>"));
|
||||
NSPresentationEditor::CStringWriter oStringWriter;
|
||||
|
||||
oStringWriter.WriteString(std::wstring(L"<a:minorFont><a:latin typeface=\""));
|
||||
|
||||
if (pTheme->m_arFonts.size() >1 ) oStringWriter.WriteString(pTheme->m_arFonts[1].Name);
|
||||
else oStringWriter.WriteStringXML(pTheme->m_arFonts[0].Name);
|
||||
oStringWriter.WriteString(std::wstring(L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?><a:theme xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" name=\""));
|
||||
oStringWriter.WriteStringXML(pTheme->m_sThemeName);
|
||||
oStringWriter.WriteString(std::wstring(L"\"><a:themeElements>"));
|
||||
|
||||
oStringWriter.WriteString(std::wstring(L"\"/><a:ea typeface=\"\"/><a:cs typeface=\"\"/></a:minorFont>"));
|
||||
oStringWriter.WriteString(std::wstring(L"</a:fontScheme>"));
|
||||
WriteColorScheme(oStringWriter, L"Default", pTheme->m_arColorScheme);
|
||||
|
||||
oStringWriter.WriteString(std::wstring(L"<a:fontScheme name=\"default\"><a:majorFont><a:latin typeface=\""));
|
||||
oStringWriter.WriteStringXML(pTheme->m_arFonts[0].Name);
|
||||
oStringWriter.WriteString(std::wstring(L"\"/><a:ea typeface=\"\"/><a:cs typeface=\"\"/></a:majorFont>"));
|
||||
|
||||
oStringWriter.WriteString(std::wstring(L"<a:minorFont><a:latin typeface=\""));
|
||||
|
||||
if (pTheme->m_arFonts.size() > 1 ) oStringWriter.WriteString (pTheme->m_arFonts[1].Name);
|
||||
else oStringWriter.WriteStringXML(pTheme->m_arFonts[0].Name);
|
||||
|
||||
oStringWriter.WriteString(std::wstring(L"\"/><a:ea typeface=\"\"/><a:cs typeface=\"\"/></a:minorFont>"));
|
||||
oStringWriter.WriteString(std::wstring(L"</a:fontScheme>"));
|
||||
|
||||
oStringWriter.WriteString(std::wstring(L"<a:fmtScheme name=\"Default\">\
|
||||
<a:fillStyleLst><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:gradFill rotWithShape=\"1\"><a:gsLst><a:gs pos=\"0\"><a:schemeClr val=\"phClr\">\
|
||||
@ -538,58 +551,67 @@ void NSPresentationEditor::CPPTXWriter::WriteThemes()
|
||||
<a:shade val=\"30000\"/><a:satMod val=\"200000\"/></a:schemeClr></a:gs></a:gsLst><a:path path=\"circle\">\
|
||||
<a:fillToRect l=\"50000\" t=\"50000\" r=\"50000\" b=\"50000\"/></a:path></a:gradFill></a:bgFillStyleLst></a:fmtScheme>"));
|
||||
|
||||
oStringWriter.WriteString(std::wstring(L"</a:themeElements><a:objectDefaults/>"));
|
||||
oStringWriter.WriteString(std::wstring(L"<a:extraClrSchemeLst>"));
|
||||
oStringWriter.WriteString(std::wstring(L"</a:themeElements><a:objectDefaults/>"));
|
||||
oStringWriter.WriteString(std::wstring(L"<a:extraClrSchemeLst>"));
|
||||
|
||||
for (size_t i = 0 ; i < pTheme->m_arExtraColorScheme.size(); i++)
|
||||
{
|
||||
std::wstring str = L" " + std::to_wstring(i + 1);
|
||||
WriteColorScheme(oStringWriter, pTheme->m_sThemeName + str, pTheme->m_arExtraColorScheme[i], true); //extra
|
||||
}
|
||||
|
||||
oStringWriter.WriteString(std::wstring(L"</a:extraClrSchemeLst>"));
|
||||
oStringWriter.WriteString(std::wstring(L"</a:theme>"));
|
||||
|
||||
oFile.WriteStringUTF8(oStringWriter.GetData());
|
||||
oFile.CloseFile();
|
||||
|
||||
CRelsGenerator oRels(&m_oManager);
|
||||
int nCountLayouts = (int)pTheme->m_arLayouts.size();
|
||||
oRels.StartMaster(nIndexTheme, nStartLayout, nCountLayouts);
|
||||
|
||||
for (int i = 0 ; i < pTheme->m_arExtraColorScheme.size(); i++)
|
||||
{
|
||||
std::wstring str = L" " + std::to_wstring(i + 1);
|
||||
WriteColorScheme(oStringWriter, pTheme->m_sThemeName + str, pTheme->m_arExtraColorScheme[i], true); //extra
|
||||
}
|
||||
|
||||
oStringWriter.WriteString(std::wstring(L"</a:extraClrSchemeLst>"));
|
||||
oStringWriter.WriteString(std::wstring(L"</a:theme>"));
|
||||
CStringWriter oWriter;
|
||||
oWriter.WriteString(L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>");
|
||||
|
||||
if (Type == 1)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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\">");
|
||||
}
|
||||
oWriter.WriteString(L"<p:cSld>");
|
||||
|
||||
oFile.WriteStringUTF8(oStringWriter.GetData());
|
||||
oFile.CloseFile();
|
||||
|
||||
// теперь masterslide
|
||||
CRelsGenerator oRels(&m_oManager);
|
||||
int nCountLayouts = (int)pTheme->m_arLayouts.size();
|
||||
|
||||
oRels.StartMaster(nIndexTheme, nStartLayout, nCountLayouts);
|
||||
|
||||
CStringWriter oWriter;
|
||||
std::wstring str1 = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\
|
||||
<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\">\
|
||||
<p:cSld>");
|
||||
oWriter.WriteString(str1);
|
||||
|
||||
if (pTheme->m_bIsBackground)
|
||||
{
|
||||
WriteBackground(oWriter, oRels, pTheme->m_oBackground);
|
||||
}
|
||||
std::wstring strElems = _T("<p:spTree><p:nvGrpSpPr><p:cNvPr id=\"1\" name=\"\"/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr>\
|
||||
if (pTheme->m_bIsBackground)
|
||||
{
|
||||
WriteBackground(oWriter, oRels, pTheme->m_oBackground);
|
||||
}
|
||||
oWriter.WriteString(L"<p:spTree><p:nvGrpSpPr><p:cNvPr id=\"1\" name=\"\"/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr>\
|
||||
<a:xfrm><a:off x=\"0\" y=\"0\"/><a:ext cx=\"0\" cy=\"0\"/><a:chOff x=\"0\" y=\"0\"/><a:chExt cx=\"0\" cy=\"0\"/></a:xfrm></p:grpSpPr>");
|
||||
oWriter.WriteString(strElems);
|
||||
|
||||
size_t nElements = pTheme->m_arElements.size();
|
||||
for (size_t nEl = 0; nEl < nElements; ++nEl)
|
||||
{
|
||||
if (isBodyPlaceholder(pTheme->m_arElements[nEl]->m_lPlaceholderType))
|
||||
pTheme->m_arElements[nEl]->m_lPlaceholderType =100; //body тип прописывать !!
|
||||
for (size_t nEl = 0; nEl < pTheme->m_arElements.size(); ++nEl)
|
||||
{
|
||||
if (isBodyPlaceholder(pTheme->m_arElements[nEl]->m_lPlaceholderType))
|
||||
pTheme->m_arElements[nEl]->m_lPlaceholderType =100; //body тип прописывать !!
|
||||
|
||||
if (pTheme->m_arElements[nEl]->m_bBoundsEnabled == false)
|
||||
continue;
|
||||
|
||||
WriteElement(oWriter, oRels, pTheme->m_arElements[nEl]);
|
||||
}
|
||||
if (pTheme->m_arElements[nEl]->m_bBoundsEnabled == false)
|
||||
continue;
|
||||
|
||||
WriteElement(oWriter, oRels, pTheme->m_arElements[nEl]);
|
||||
}
|
||||
|
||||
oWriter.WriteString(std::wstring(L"</p:spTree></p:cSld>"));
|
||||
oWriter.WriteString(std::wstring(L"</p:spTree></p:cSld>"));
|
||||
|
||||
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);
|
||||
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)
|
||||
{
|
||||
oWriter.WriteString(std::wstring(L"<p:sldLayoutIdLst>"));
|
||||
|
||||
size_t __nCountLayouts = 0;
|
||||
@ -601,17 +623,19 @@ void NSPresentationEditor::CPPTXWriter::WriteThemes()
|
||||
}
|
||||
|
||||
oWriter.WriteString(std::wstring(L"</p:sldLayoutIdLst>"));
|
||||
}
|
||||
|
||||
if (pTheme->m_bHasDate || pTheme->m_bHasFooter || pTheme->m_bHasSlideNumber)
|
||||
{
|
||||
oWriter.WriteString(std::wstring(L"<p:hf"));
|
||||
if (!pTheme->m_bHasDate) oWriter.WriteString(std::wstring(L" dt=\"0\""));
|
||||
if (!pTheme->m_bHasSlideNumber) oWriter.WriteString(std::wstring(L" sldNum=\"0\""));
|
||||
oWriter.WriteString(std::wstring(L" hdr=\"0\""));
|
||||
if (!pTheme->m_bHasFooter) oWriter.WriteString(std::wstring(L" ftr=\"0\""));
|
||||
oWriter.WriteString(std::wstring(L"/>"));
|
||||
}
|
||||
|
||||
if (pTheme->m_bHasDate || pTheme->m_bHasFooter || pTheme->m_bHasSlideNumber)
|
||||
{
|
||||
oWriter.WriteString(std::wstring(L"<p:hf"));
|
||||
if (!pTheme->m_bHasDate) oWriter.WriteString(std::wstring(L" dt=\"0\""));
|
||||
if (!pTheme->m_bHasSlideNumber) oWriter.WriteString(std::wstring(L" sldNum=\"0\""));
|
||||
oWriter.WriteString(std::wstring(L" hdr=\"0\""));
|
||||
if (!pTheme->m_bHasFooter) oWriter.WriteString(std::wstring(L" ftr=\"0\""));
|
||||
oWriter.WriteString(std::wstring(L"/>"));
|
||||
}
|
||||
if (Type == 1)
|
||||
{
|
||||
oWriter.WriteString(std::wstring(L"<p:txStyles>"));
|
||||
|
||||
oWriter.WriteString(std::wstring(L"<p:titleStyle>"));
|
||||
@ -626,25 +650,57 @@ void NSPresentationEditor::CPPTXWriter::WriteThemes()
|
||||
CStylesWriter::ConvertStyles(pTheme->m_pStyles[3], pTheme->m_oInfo, oWriter, 9);
|
||||
oWriter.WriteString(std::wstring(L"</p:otherStyle>"));
|
||||
|
||||
oWriter.WriteString(std::wstring(L"</p:txStyles></p:sldMaster>"));
|
||||
|
||||
std::wstring strSlideMasterFile = L"slideMaster" + std::to_wstring(nIndexTheme + 1) + L".xml";
|
||||
strSlideMasterFile = strPptDirectory + _T("slideMasters") + FILE_SEPARATOR_STR + strSlideMasterFile;
|
||||
|
||||
oFile.CreateFile(strSlideMasterFile);
|
||||
std::wstring strMaster = oWriter.GetData();
|
||||
oFile.WriteStringUTF8(strMaster);
|
||||
oFile.CloseFile();
|
||||
|
||||
oRels.CloseRels();
|
||||
|
||||
std::wstring strSlideMasterRelsFile = L"slideMaster" + std::to_wstring(nIndexTheme + 1) + L".xml.rels";
|
||||
strSlideMasterRelsFile = strPptDirectory + _T("slideMasters") + FILE_SEPARATOR_STR + _T("_rels") + FILE_SEPARATOR_STR + strSlideMasterRelsFile;
|
||||
|
||||
oRels.SaveRels(strSlideMasterRelsFile);
|
||||
|
||||
nStartLayout += nCountLayouts;
|
||||
oWriter.WriteString(std::wstring(L"</p:txStyles>"));
|
||||
}
|
||||
else if (Type == 2)
|
||||
{
|
||||
oWriter.WriteString(std::wstring(L"<p:notesStyle>"));
|
||||
CStylesWriter::ConvertStyles(pTheme->m_pStyles[1], pTheme->m_oInfo, oWriter, 9);
|
||||
oWriter.WriteString(std::wstring(L"</p:notesStyle>"));
|
||||
}
|
||||
|
||||
std::wstring strSlideMasterFile;
|
||||
std::wstring strSlideMasterRelsFile;
|
||||
if (Type == 1)
|
||||
{
|
||||
oWriter.WriteString(std::wstring(L"</p:sldMaster>"));
|
||||
|
||||
strSlideMasterFile = L"slideMaster" + std::to_wstring(nIndexTheme + 1) + L".xml";
|
||||
strSlideMasterFile = strPptDirectory + _T("slideMasters") + FILE_SEPARATOR_STR + strSlideMasterFile;
|
||||
|
||||
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)
|
||||
{
|
||||
oWriter.WriteString(std::wstring(L"</p:notesMaster>"));
|
||||
|
||||
strSlideMasterFile = L"notesMaster1.xml";
|
||||
strSlideMasterFile = strPptDirectory + _T("notesMasters") + FILE_SEPARATOR_STR + strSlideMasterFile;
|
||||
|
||||
strSlideMasterRelsFile = L"notesMaster1.xml.rels";
|
||||
strSlideMasterRelsFile = strPptDirectory + _T("notesMasters") + FILE_SEPARATOR_STR + _T("_rels") + FILE_SEPARATOR_STR + strSlideMasterRelsFile;
|
||||
}
|
||||
else if (Type == 3)
|
||||
{
|
||||
oWriter.WriteString(std::wstring(L"</p:handoutMaster>"));
|
||||
|
||||
strSlideMasterFile = L"handoutMaster1.xml";
|
||||
strSlideMasterFile = strPptDirectory + _T("handoutMasters") + FILE_SEPARATOR_STR + strSlideMasterFile;
|
||||
|
||||
strSlideMasterRelsFile = L"handoutMaster1.xml.rels";
|
||||
strSlideMasterRelsFile = strPptDirectory + _T("handoutMasters") + FILE_SEPARATOR_STR + _T("_rels") + FILE_SEPARATOR_STR + strSlideMasterRelsFile;
|
||||
}
|
||||
oFile.CreateFile(strSlideMasterFile);
|
||||
std::wstring strMaster = oWriter.GetData();
|
||||
oFile.WriteStringUTF8(strMaster);
|
||||
oFile.CloseFile();
|
||||
|
||||
oRels.CloseRels();
|
||||
oRels.SaveRels(strSlideMasterRelsFile);
|
||||
|
||||
nStartLayout += nCountLayouts;
|
||||
nIndexTheme++;
|
||||
}
|
||||
|
||||
void NSPresentationEditor::CPPTXWriter::WriteColorScheme(CStringWriter& oStringWriter, const std::wstring & name, const std::vector<CColor> & colors, bool extra)
|
||||
@ -826,14 +882,14 @@ void NSPresentationEditor::CPPTXWriter::WriteSlide(int nIndexSlide)
|
||||
CSlide* pSlide = m_pDocument->m_arSlides[nIndexSlide];
|
||||
|
||||
if (0 == pSlide->m_lThemeID)
|
||||
oRels.StartSlide(pSlide->m_lLayoutID, nIndexSlide);
|
||||
oRels.StartSlide(pSlide->m_lLayoutID, pSlide->m_lNotesID);
|
||||
else
|
||||
{
|
||||
int nLayout = pSlide->m_lLayoutID;
|
||||
for (int i = 0; i < pSlide->m_lThemeID; ++i)
|
||||
nLayout += (int)m_pDocument->m_arThemes[i].m_arLayouts.size();
|
||||
|
||||
oRels.StartSlide(nLayout, nIndexSlide);
|
||||
oRels.StartSlide(nLayout, pSlide->m_lNotesID);
|
||||
}
|
||||
|
||||
oWriter.WriteString(std::wstring(L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"));
|
||||
@ -881,15 +937,66 @@ void NSPresentationEditor::CPPTXWriter::WriteSlide(int nIndexSlide)
|
||||
strFile = L"slide" + std::to_wstring(nIndexSlide + 1) + L".xml.rels";
|
||||
oRels.SaveRels(strFileSlidePath + _T("_rels") + FILE_SEPARATOR_STR + strFile);
|
||||
}
|
||||
void NSPresentationEditor::CPPTXWriter::WriteNotes(int nIndexNotes)
|
||||
{
|
||||
CStringWriter oWriter;
|
||||
CRelsGenerator oRels(&m_oManager);
|
||||
|
||||
CSlide* pNotes = m_pDocument->m_arNotes[nIndexNotes];
|
||||
|
||||
oRels.StartNotes(pNotes->m_lSlideID, m_pDocument->m_pNotesMaster != NULL);
|
||||
|
||||
oWriter.WriteString(std::wstring(L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"));
|
||||
oWriter.WriteString(std::wstring(L"<p:notes 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\""));
|
||||
if (!pNotes->m_bShowMasterShapes)
|
||||
oWriter.WriteString(std::wstring(L" showMasterSp=\"0\""));
|
||||
oWriter.WriteString(std::wstring(L">"));
|
||||
|
||||
oWriter.WriteString(std::wstring(L"<p:cSld>"));
|
||||
|
||||
if (pNotes->m_bIsBackground)
|
||||
{
|
||||
WriteBackground(oWriter, oRels, pNotes->m_oBackground);
|
||||
}
|
||||
|
||||
oWriter.WriteString(std::wstring(L"<p:spTree><p:nvGrpSpPr><p:cNvPr id=\"1\" name=\"\"/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr>\
|
||||
<a:xfrm><a:off x=\"0\" y=\"0\"/><a:ext cx=\"0\" cy=\"0\"/><a:chOff x=\"0\" y=\"0\"/><a:chExt cx=\"0\" cy=\"0\"/></a:xfrm></p:grpSpPr>"));
|
||||
|
||||
for (size_t nEl = 0; nEl < pNotes->m_arElements.size(); ++nEl)
|
||||
{
|
||||
WriteElement(oWriter, oRels, pNotes->m_arElements[nEl], NULL);
|
||||
}
|
||||
oWriter.WriteString(std::wstring(L"</p:spTree></p:cSld>"));
|
||||
|
||||
oWriter.WriteString(std::wstring(L"<p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>"));
|
||||
oWriter.WriteString(std::wstring(L"</p:notes>"));
|
||||
|
||||
oRels.CloseRels();
|
||||
|
||||
std::wstring strXml = oWriter.GetData();
|
||||
std::wstring strFile = L"notesSlide" + std::to_wstring(nIndexNotes + 1) + L".xml";
|
||||
std::wstring strFileSlidePath = m_strTempDirectory + FILE_SEPARATOR_STR + _T("ppt") + FILE_SEPARATOR_STR + _T("notesSlides") + FILE_SEPARATOR_STR;
|
||||
|
||||
CFile oFile;
|
||||
oFile.CreateFile(strFileSlidePath + strFile);
|
||||
oFile.WriteStringUTF8(strXml);
|
||||
oFile.CloseFile();
|
||||
|
||||
strFile = L"notesSlide" + std::to_wstring(nIndexNotes + 1) + L".xml.rels";
|
||||
oRels.SaveRels(strFileSlidePath + _T("_rels") + FILE_SEPARATOR_STR + strFile);
|
||||
}
|
||||
|
||||
void NSPresentationEditor::CPPTXWriter::WriteSlides()
|
||||
{
|
||||
size_t nCountSlides = m_pDocument->m_arSlides.size();
|
||||
|
||||
for (size_t nIndexS = 0; nIndexS < nCountSlides; ++nIndexS)
|
||||
for (size_t nIndexS = 0; nIndexS < m_pDocument->m_arSlides.size(); ++nIndexS)
|
||||
{
|
||||
CRelsGenerator::StartNotes((int)nIndexS, m_strTempDirectory, m_pDocument->m_arSlides[nIndexS]->m_strComment);
|
||||
WriteSlide((int)nIndexS);
|
||||
}
|
||||
}
|
||||
void NSPresentationEditor::CPPTXWriter::WriteNotes()
|
||||
{
|
||||
for (size_t nIndexS = 0; nIndexS < m_pDocument->m_arNotes.size(); ++nIndexS)
|
||||
{
|
||||
WriteNotes((int)nIndexS);
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,8 +54,6 @@ namespace NSPresentationEditor
|
||||
|
||||
CShapeWriter* m_pShapeWriter;
|
||||
|
||||
|
||||
public:
|
||||
CPPTXWriter();
|
||||
~CPPTXWriter();
|
||||
|
||||
@ -74,9 +72,12 @@ namespace NSPresentationEditor
|
||||
void WritePresInfo ();
|
||||
void WriteAll ();
|
||||
void WriteThemes ();
|
||||
void WriteTheme (CTheme* pTheme, int & nIndexTheme, int & nStartLayout, int Type = 1);
|
||||
void WriteSlides ();
|
||||
void WriteNotes ();
|
||||
void WriteLayout (CLayout& oLayout, int nIndexLayout, int nStartLayout, int nIndexTheme);
|
||||
void WriteSlide (int nIndexSlide);
|
||||
void WriteNotes (int nIndexNotes);
|
||||
|
||||
void WriteColorScheme (CStringWriter& oWriter, const std::wstring & name, const std::vector<CColor> & colors, bool extra = false);
|
||||
void WriteBackground (CStringWriter& oWriter, CRelsGenerator& oRels, CBrush& oBackground);
|
||||
|
||||
@ -170,12 +170,11 @@ namespace NSPresentationEditor
|
||||
|
||||
m_oWriter.WriteString(str1);
|
||||
|
||||
int nCurrent = nStartLayoutIndex;
|
||||
for (int i = 0; i < nCountLayouts; ++i)
|
||||
{
|
||||
std::wstring str = L"<Relationship Id=\"rId" + std::to_wstring(m_lNextRelsID++) + L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout\" Target=\"../slideLayouts/slideLayout"
|
||||
+ std::to_wstring(nCurrent + 1) + L".xml\"/>";
|
||||
++nCurrent;
|
||||
+ std::to_wstring(nStartLayoutIndex + 1) + L".xml\"/>";
|
||||
nStartLayoutIndex++;
|
||||
m_oWriter.WriteString(str);
|
||||
}
|
||||
|
||||
@ -196,7 +195,23 @@ namespace NSPresentationEditor
|
||||
|
||||
m_oWriter.WriteString(str);
|
||||
}
|
||||
inline void StartSlide(int nIndexLayout, int nIndexSlide)
|
||||
inline void StartNotes(int nIndexSlide, bool bMaster)
|
||||
{
|
||||
m_oWriter.WriteString(L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\
|
||||
<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">");
|
||||
if (bMaster)
|
||||
{
|
||||
m_oWriter.WriteString(L"<Relationship Id=\"rId" + std::to_wstring(m_lNextRelsID++) +
|
||||
L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster\" Target=\"../notesMasters/notesMaster1.xml\"/>");
|
||||
}
|
||||
if (nIndexSlide >= 0)
|
||||
{
|
||||
m_oWriter.WriteString(L"<Relationship Id=\"rId" + std::to_wstring(m_lNextRelsID++) +
|
||||
L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide\" Target=\"../slides/slide"
|
||||
+ std::to_wstring(nIndexSlide + 1) + L".xml\"/>");
|
||||
}
|
||||
}
|
||||
inline void StartSlide(int nIndexLayout, int nIndexNotes)
|
||||
{
|
||||
m_oWriter.WriteString(L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\
|
||||
<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">");
|
||||
@ -204,51 +219,14 @@ namespace NSPresentationEditor
|
||||
m_oWriter.WriteString(L"<Relationship Id=\"rId" + std::to_wstring(m_lNextRelsID++) + L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout\" Target=\"../slideLayouts/slideLayout"
|
||||
+ std::to_wstring(nIndexLayout + 1) + L".xml\"/>");
|
||||
|
||||
m_oWriter.WriteString(L"<Relationship Id=\"rId" + std::to_wstring(m_lNextRelsID++) +
|
||||
L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide\" Target=\"../notesSlides/notesSlide"
|
||||
+ std::to_wstring(nIndexSlide + 1) + L".xml\"/>");
|
||||
if (nIndexNotes >= 0)
|
||||
{
|
||||
m_oWriter.WriteString(L"<Relationship Id=\"rId" + std::to_wstring(m_lNextRelsID++) +
|
||||
L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide\" Target=\"../notesSlides/notesSlide"
|
||||
+ std::to_wstring(nIndexNotes + 1) + L".xml\"/>");
|
||||
}
|
||||
}
|
||||
static inline void StartNotes(int nIndexSlide, std::wstring strDirectory, std::wstring strComment)
|
||||
{
|
||||
std::wstring sNum = std::to_wstring( nIndexSlide + 1);
|
||||
|
||||
std::wstring strNoteSlideRels = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\
|
||||
<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">\
|
||||
<Relationship Id=\"rId2\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide\" Target=\"../slides/slide") + sNum + _T(".xml\"/>\
|
||||
<Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster\" Target=\"../notesMasters/notesMaster1.xml\"/>\
|
||||
</Relationships>");
|
||||
|
||||
std::wstring strNoteRels = strDirectory + FILE_SEPARATOR_STR + _T("ppt") +
|
||||
+ FILE_SEPARATOR_STR + _T("notesSlides")
|
||||
+ FILE_SEPARATOR_STR + _T("_rels")
|
||||
+ FILE_SEPARATOR_STR + _T("notesSlide") + sNum + _T(".xml.rels");
|
||||
CFile oFile;
|
||||
oFile.CreateFile(strNoteRels);
|
||||
oFile.WriteStringUTF8(strNoteSlideRels);
|
||||
oFile.CloseFile();
|
||||
|
||||
std::wstring strNoteSlide = strDirectory + FILE_SEPARATOR_STR + _T("ppt") +
|
||||
+ FILE_SEPARATOR_STR + _T("notesSlides")
|
||||
+ FILE_SEPARATOR_STR + _T("notesSlide") + sNum + _T(".xml");
|
||||
oFile.CreateFile(strNoteSlide);
|
||||
|
||||
std::wstring strW1 = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\
|
||||
<p:notes 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\">\
|
||||
<p:cSld><p:spTree><p:nvGrpSpPr><p:cNvPr id=\"1\" name=\"\"/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x=\"0\" y=\"0\"/>\
|
||||
<a:ext cx=\"0\" cy=\"0\"/><a:chOff x=\"0\" y=\"0\"/><a:chExt cx=\"0\" cy=\"0\"/></a:xfrm></p:grpSpPr><p:sp><p:nvSpPr><p:cNvPr id=\"100000\" name=\"\"/>\
|
||||
<p:cNvSpPr><a:spLocks noGrp=\"1\" noChangeArrowheads=\"1\"/></p:cNvSpPr><p:nvPr><p:ph type=\"body\" idx=\"1\"/></p:nvPr></p:nvSpPr><p:spPr/>\
|
||||
<p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:r><a:rPr smtClean=\"0\"/><a:t>");
|
||||
std::wstring strW2 = _T("</a:t></a:r><a:endParaRPr/></a:p></p:txBody></p:sp></p:spTree></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:notes>");
|
||||
|
||||
CorrectXmlString(strComment);
|
||||
|
||||
oFile.WriteStringUTF8(strW1);
|
||||
oFile.WriteStringUTF8(strComment);
|
||||
oFile.WriteStringUTF8(strW2);
|
||||
|
||||
oFile.CloseFile();
|
||||
}
|
||||
inline void CloseRels()
|
||||
inline void CloseRels()
|
||||
{
|
||||
std::wstring str = _T("</Relationships>");
|
||||
m_oWriter.WriteString(str);
|
||||
|
||||
@ -68,9 +68,6 @@ void CStylesWriter::ConvertStyleLevel(NSPresentationEditor::CTextStyleLevel& oLe
|
||||
{
|
||||
std::wstring strProp = std::to_wstring(pPF->leftMargin.get());
|
||||
oWriter.WriteString(L" marL=\"" + strProp + L"\"");
|
||||
|
||||
if (pPF->indent.is_init() == false)
|
||||
pPF->indent = (LONG)0;
|
||||
}
|
||||
if (pPF->indent.is_init())
|
||||
{
|
||||
@ -296,21 +293,79 @@ NSPresentationEditor::CShapeWriter::CShapeWriter()
|
||||
m_pImageElement = NULL;
|
||||
m_pShapeElement = NULL;
|
||||
}
|
||||
std::wstring NSPresentationEditor::CShapeWriter::ConvertLine(CPen & pen)
|
||||
std::wstring NSPresentationEditor::CShapeWriter::ConvertLine(CPen & pen)
|
||||
{
|
||||
NSPresentationEditor::CStringWriter line_writer;
|
||||
|
||||
std::wstring str = std::to_wstring( (int)(pen.Size * 36000));
|
||||
line_writer.WriteString(L"<a:ln w=\"" + str + L"\">");
|
||||
std::wstring strL;
|
||||
switch(pen.LineStyle)
|
||||
{
|
||||
case 1: strL = L" cmpd=\"dbl\""; break;
|
||||
case 2: strL = L" cmpd=\"thickThin\""; break;
|
||||
case 3: strL = L" cmpd=\"thinThick\""; break;
|
||||
case 4: strL = L" cmpd=\"tri\""; break;
|
||||
}
|
||||
line_writer.WriteString(L"<a:ln w=\"" + std::to_wstring((int)(pen.Size * 36000)) + L"\"" + strL + L">");
|
||||
|
||||
line_writer.WriteString(L"<a:solidFill>");
|
||||
line_writer.WriteString(ConvertColor(pen.Color, pen.Alpha));
|
||||
line_writer.WriteString(L"</a:solidFill>");
|
||||
|
||||
line_writer.WriteString(L"<a:round/><a:headEnd/><a:tailEnd/></a:ln>");
|
||||
switch(pen.DashStyle)
|
||||
{
|
||||
case 1: line_writer.WriteString(L"<a:prstDash val=\"sysDash\"/>"); break;
|
||||
case 2: line_writer.WriteString(L"<a:prstDash val=\"sysDot\"/>"); break;
|
||||
case 3: line_writer.WriteString(L"<a:prstDash val=\"sysDashDot\"/>"); break;
|
||||
case 4: line_writer.WriteString(L"<a:prstDash val=\"sysDashDotDot\"/>"); break;
|
||||
case 5: line_writer.WriteString(L"<a:prstDash val=\"dot\"/>"); break;
|
||||
case 6: line_writer.WriteString(L"<a:prstDash val=\"dash\"/>"); break;
|
||||
case 7: line_writer.WriteString(L"<a:prstDash val=\"lgDash\"/>"); break;
|
||||
case 8: line_writer.WriteString(L"<a:prstDash val=\"dashDot\"/>"); break;
|
||||
case 9: line_writer.WriteString(L"<a:prstDash val=\"lgDashDot\"/>"); break;
|
||||
case 10:line_writer.WriteString(L"<a:prstDash val=\"lgDashDotDot\"/>"); break;
|
||||
}
|
||||
switch(pen.LineJoin)
|
||||
{
|
||||
case 0: line_writer.WriteString(L"<a:bevel/>"); break;
|
||||
case 1: line_writer.WriteString(L"<a:miter/>"); break;
|
||||
case 2: line_writer.WriteString(L"<a:round/>"); break;
|
||||
}
|
||||
|
||||
line_writer.WriteString(L"<a:headEnd" + ConvertLineEnd(pen.LineStartCap, pen.LineStartLength, pen.LineStartWidth) + L"/>");
|
||||
line_writer.WriteString(L"<a:tailEnd" + ConvertLineEnd(pen.LineEndCap, pen.LineEndLength, pen.LineEndWidth) + L"/>");
|
||||
|
||||
line_writer.WriteString(L"</a:ln>");
|
||||
|
||||
return line_writer.GetData();
|
||||
}
|
||||
std::wstring NSPresentationEditor::CShapeWriter::ConvertLineEnd(unsigned char cap, unsigned char length, unsigned char width)
|
||||
{
|
||||
if (cap < 1) return L"";
|
||||
|
||||
std::wstring sResult;
|
||||
|
||||
switch(cap)
|
||||
{
|
||||
case 1: sResult += L" type=\"triangle\""; break;
|
||||
case 2: sResult += L" type=\"stealth\""; break;
|
||||
case 3: sResult += L" type=\"diamond\""; break;
|
||||
case 4: sResult += L" type=\"oval\""; break;
|
||||
case 5: sResult += L" type=\"arrow\""; break;
|
||||
}
|
||||
switch(length)
|
||||
{
|
||||
case 0: sResult += L" len=\"sm\""; break;
|
||||
case 1: sResult += L" len=\"med\""; break;
|
||||
case 2: sResult += L" len=\"lg\""; break;
|
||||
}
|
||||
switch(width)
|
||||
{
|
||||
case 0: sResult += L" w=\"sm\""; break;
|
||||
case 1: sResult += L" w=\"med\""; break;
|
||||
case 2: sResult += L" w=\"lg\""; break;
|
||||
}
|
||||
return sResult;
|
||||
}
|
||||
std::wstring NSPresentationEditor::CShapeWriter::ConvertBrush(CBrush & brush)
|
||||
{
|
||||
NSPresentationEditor::CStringWriter brush_writer;
|
||||
@ -798,11 +853,7 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
|
||||
if (pPF->leftMargin.is_init())
|
||||
{
|
||||
std::wstring strProp = std::to_wstring( pPF->leftMargin.get() );
|
||||
m_oWriter.WriteString(L" marL=\"" + strProp + L"\"");
|
||||
|
||||
if (pPF->indent.is_init() == false)
|
||||
pPF->indent = (LONG)0;
|
||||
|
||||
m_oWriter.WriteString(L" marL=\"" + strProp + L"\"");
|
||||
}
|
||||
if (pPF->indent.is_init())
|
||||
{
|
||||
@ -1175,7 +1226,8 @@ std::wstring NSPresentationEditor::CShapeWriter::ConvertShape()
|
||||
}
|
||||
m_oWriter.WriteString(std::wstring(L">"));
|
||||
|
||||
m_oWriter.WriteString(L"<a:off x=\"" + std::to_wstring((int)m_pShapeElement->m_rcBoundsOriginal.left) + L"\" y=\"" + std::to_wstring((int)m_pShapeElement->m_rcBoundsOriginal.top) + L"\"/>");
|
||||
m_oWriter.WriteString(L"<a:off x=\"" + std::to_wstring((int)m_pShapeElement->m_rcBoundsOriginal.left) +
|
||||
L"\" y=\"" + std::to_wstring((int)m_pShapeElement->m_rcBoundsOriginal.top) + L"\"/>");
|
||||
|
||||
int width = m_pShapeElement->m_rcBoundsOriginal.right - m_pShapeElement->m_rcBoundsOriginal.left;
|
||||
int height = m_pShapeElement->m_rcBoundsOriginal.bottom - m_pShapeElement->m_rcBoundsOriginal.top;
|
||||
|
||||
@ -213,6 +213,7 @@ namespace NSPresentationEditor
|
||||
std::wstring ConvertShadow (CShadow & shadow);
|
||||
std::wstring ConvertBrush (CBrush & brush);
|
||||
static std::wstring ConvertColor (CColor & color, long alpha);
|
||||
std::wstring ConvertLineEnd(unsigned char cap, unsigned char length, unsigned char width);
|
||||
// тип рендерера-----------------------------------------------------------------------------
|
||||
virtual HRESULT get_Type(LONG* lType) ;
|
||||
//-------- Функции для работы со страницей --------------------------------------------------
|
||||
|
||||
@ -52,8 +52,11 @@ CPPTUserInfo::CPPTUserInfo() : CDocument(),
|
||||
m_pDocumentInfo = NULL;
|
||||
m_lIndexThisUser = -1;
|
||||
|
||||
m_nWriteSlideTimeOffset = 0.0;
|
||||
m_nWriteSlideTime = 0.0;
|
||||
m_pNotesMasterWrapper = NULL;
|
||||
m_pHandoutMasterWrapper = NULL;
|
||||
|
||||
m_nWriteSlideTimeOffset = 0.0;
|
||||
m_nWriteSlideTime = 0.0;
|
||||
|
||||
m_strFileDirectory = _T("");
|
||||
m_bIsSetupEmpty = false;
|
||||
@ -90,6 +93,21 @@ void CPPTUserInfo::Clear()
|
||||
m_mapMasters.clear();
|
||||
m_arrMastersOrder.clear();
|
||||
|
||||
for (std::map<DWORD, CRecordSlide*>::iterator pPair = m_mapNotesMasters.begin(); pPair != m_mapNotesMasters.end(); ++pPair)
|
||||
{
|
||||
RELEASEINTERFACE(pPair->second);
|
||||
}
|
||||
m_mapNotesMasters.clear();
|
||||
|
||||
for (std::map<DWORD, CRecordSlide*>::iterator pPair = m_mapHandoutMasters.begin(); pPair != m_mapHandoutMasters.end(); ++pPair)
|
||||
{
|
||||
RELEASEINTERFACE(pPair->second);
|
||||
}
|
||||
m_mapHandoutMasters.clear();
|
||||
|
||||
RELEASEOBJECT(m_pNotesMasterWrapper);
|
||||
RELEASEOBJECT(m_pHandoutMasterWrapper);
|
||||
|
||||
for (std::map<DWORD, CRecordSlide*>::iterator pPair = m_mapNotes.begin(); pPair != m_mapNotes.end(); ++pPair)
|
||||
{
|
||||
RELEASEINTERFACE(pPair->second);
|
||||
@ -97,11 +115,10 @@ void CPPTUserInfo::Clear()
|
||||
m_mapNotes.clear();
|
||||
m_arrNotesOrder.clear();
|
||||
|
||||
|
||||
m_oExMedia.Clear();
|
||||
m_arrFonts.clear();
|
||||
|
||||
for (int nIndex = 0; nIndex < m_mapAnimations.size(); ++nIndex)
|
||||
for (size_t nIndex = 0; nIndex < m_mapAnimations.size(); ++nIndex)
|
||||
{
|
||||
RELEASEOBJECT ( m_mapAnimations[nIndex]);
|
||||
}
|
||||
@ -148,13 +165,15 @@ bool CPPTUserInfo::ReadFromStream(CRecordUserEditAtom* pUser, POLE::Stream* pStr
|
||||
|
||||
Clear();
|
||||
|
||||
std::map<DWORD, DWORD>::iterator nIndexPsrRef;
|
||||
|
||||
for (size_t index = 0; index < m_oDocument.m_arMasterPersists.size(); ++index)
|
||||
{
|
||||
std::map<DWORD, DWORD>::iterator nPsrRef = m_mapOffsetInPIDs.find(m_oDocument.m_arMasterPersists[index].m_nPsrRef);
|
||||
nIndexPsrRef = m_mapOffsetInPIDs.find(m_oDocument.m_arMasterPersists[index].m_nPsrRef);
|
||||
|
||||
if (nPsrRef != m_mapOffsetInPIDs.end())
|
||||
if (nIndexPsrRef != m_mapOffsetInPIDs.end())
|
||||
{
|
||||
long offset = (long)nPsrRef->second;
|
||||
long offset = (long)nIndexPsrRef->second;
|
||||
|
||||
StreamUtils::StreamSeek(offset, pStream);
|
||||
|
||||
@ -173,10 +192,9 @@ bool CPPTUserInfo::ReadFromStream(CRecordUserEditAtom* pUser, POLE::Stream* pStr
|
||||
}
|
||||
m_arrMastersOrder.push_back(m_oDocument.m_arMasterPersists[index].m_nSlideID);
|
||||
}
|
||||
|
||||
for (size_t index = 0; index < m_oDocument.m_arNotePersists.size(); ++index)
|
||||
{
|
||||
std::map<DWORD, DWORD>::iterator nIndexPsrRef = m_mapOffsetInPIDs.find(m_oDocument.m_arNotePersists[index].m_nPsrRef);
|
||||
nIndexPsrRef = m_mapOffsetInPIDs.find(m_oDocument.m_arNotePersists[index].m_nPsrRef);
|
||||
|
||||
if (m_mapOffsetInPIDs.end() != nIndexPsrRef)
|
||||
{
|
||||
@ -201,7 +219,7 @@ bool CPPTUserInfo::ReadFromStream(CRecordUserEditAtom* pUser, POLE::Stream* pStr
|
||||
|
||||
for (size_t index = 0; index < m_oDocument.m_arSlidePersists.size(); ++index)
|
||||
{
|
||||
std::map<DWORD, DWORD>::iterator nIndexPsrRef = m_mapOffsetInPIDs.find(m_oDocument.m_arSlidePersists[index].m_nPsrRef);
|
||||
nIndexPsrRef = m_mapOffsetInPIDs.find(m_oDocument.m_arSlidePersists[index].m_nPsrRef);
|
||||
|
||||
if (m_mapOffsetInPIDs.end() != nIndexPsrRef)
|
||||
{
|
||||
@ -239,7 +257,47 @@ bool CPPTUserInfo::ReadFromStream(CRecordUserEditAtom* pUser, POLE::Stream* pStr
|
||||
}
|
||||
m_arrSlidesOrder.push_back(m_oDocument.m_arSlidePersists[index].m_nSlideID);
|
||||
}
|
||||
std::vector<CRecordDocumentAtom*> oArrayDoc;
|
||||
m_oDocument.GetRecordsByType(&oArrayDoc, true, true);
|
||||
|
||||
if (!oArrayDoc.empty())
|
||||
{
|
||||
nIndexPsrRef = m_mapOffsetInPIDs.find(oArrayDoc[0]->m_nNotesMasterPersistIDRef);
|
||||
|
||||
if (m_mapOffsetInPIDs.end() != nIndexPsrRef)
|
||||
{
|
||||
long offset = (long)nIndexPsrRef->second;
|
||||
|
||||
StreamUtils::StreamSeek(offset, pStream);
|
||||
|
||||
oHeader.ReadFromStream(pStream);
|
||||
|
||||
CRecordSlide* pSlide = new CRecordSlide();
|
||||
pSlide->ReadFromStream(oHeader, pStream);
|
||||
pSlide->m_oPersist.m_nPsrRef = oArrayDoc[0]->m_nNotesMasterPersistIDRef;
|
||||
pSlide->m_Index = 0;
|
||||
|
||||
m_mapNotesMasters.insert( std::pair<DWORD, CRecordSlide*>(0, pSlide ));
|
||||
}
|
||||
nIndexPsrRef = m_mapOffsetInPIDs.find(oArrayDoc[0]->m_nHandoutMasterPersistIDRef);
|
||||
|
||||
if (m_mapOffsetInPIDs.end() != nIndexPsrRef)
|
||||
{
|
||||
long offset = (long)nIndexPsrRef->second;
|
||||
|
||||
StreamUtils::StreamSeek(offset, pStream);
|
||||
|
||||
oHeader.ReadFromStream(pStream);
|
||||
|
||||
CRecordSlide* pSlide = new CRecordSlide();
|
||||
pSlide->ReadFromStream(oHeader, pStream);
|
||||
pSlide->m_oPersist.m_nPsrRef = oArrayDoc[0]->m_nHandoutMasterPersistIDRef;
|
||||
pSlide->m_Index = 0;
|
||||
|
||||
m_mapHandoutMasters.insert( std::pair<DWORD, CRecordSlide*>(0, pSlide ));
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------
|
||||
// так... теперь берем всю инфу о ExObject -----------------------------
|
||||
m_oExMedia.m_strPresentationDirectory = strFolderMem;
|
||||
m_oExMedia.m_strSourceDirectory = m_strFileDirectory;
|
||||
@ -271,7 +329,7 @@ bool CPPTUserInfo::ReadFromStream(CRecordUserEditAtom* pUser, POLE::Stream* pStr
|
||||
std::vector<CRecordFontEntityAtom*> oArrayFonts;
|
||||
m_oDocument.GetRecordsByType(&oArrayFonts, true);
|
||||
|
||||
for (int nIndex = 0; nIndex < oArrayFonts.size(); ++nIndex)
|
||||
for (size_t nIndex = 0; nIndex < oArrayFonts.size(); ++nIndex)
|
||||
{
|
||||
CFont oFont;
|
||||
oFont.Name = oArrayFonts[nIndex]->m_strFaceName;
|
||||
@ -371,7 +429,7 @@ void CPPTUserInfo::FromDocument()
|
||||
double DurationSlide = PPT_DEFAULT_SLIDE_DURATION;
|
||||
|
||||
m_arSlides.reserve(m_arrSlidesOrder.size());
|
||||
for (int i=0; i< m_arrSlidesOrder.size(); i++)
|
||||
for (size_t i = 0; i < m_arrSlidesOrder.size(); i++)
|
||||
{
|
||||
std::map<DWORD, CRecordSlide*>::iterator pPair = m_mapSlides.find(m_arrSlidesOrder[i]);
|
||||
|
||||
@ -382,12 +440,10 @@ void CPPTUserInfo::FromDocument()
|
||||
|
||||
DurationSlide = PPT_DEFAULT_SLIDE_DURATION;
|
||||
|
||||
CSlide *elm = new CSlide();
|
||||
m_arSlides.push_back(elm);
|
||||
// тут его заполняем...
|
||||
m_arSlides.push_back(new CSlide());
|
||||
|
||||
// если на слайде есть анимации
|
||||
std::map <DWORD, Animations::CSlideTimeLine*>::iterator pTimeLine = m_mapAnimations.find( pPair->first);
|
||||
std::map <DWORD, Animations::CSlideTimeLine*>::iterator pTimeLine = m_mapAnimations.find( pPair->first);
|
||||
|
||||
if ( m_mapAnimations.end() != pTimeLine )
|
||||
{
|
||||
@ -409,12 +465,196 @@ void CPPTUserInfo::FromDocument()
|
||||
pSlide->m_lWidth = (LONG)(c_dMasterUnitsToMillimetreKoef * lOriginWidth);
|
||||
pSlide->m_lHeight = (LONG)(c_dMasterUnitsToMillimetreKoef * lOriginHeight);
|
||||
|
||||
LoadSlide ( pPair->first, m_arSlides.back());
|
||||
LoadSlide ( pPair->first, pSlide);
|
||||
}
|
||||
|
||||
m_arNotes.reserve(m_arrNotesOrder.size());
|
||||
for (size_t i = 0; i< m_arrNotesOrder.size(); i++)
|
||||
{
|
||||
std::map<DWORD, CRecordSlide*>::iterator pPair = m_mapNotes.find(m_arrNotesOrder[i]);
|
||||
|
||||
if (pPair == m_mapNotes.end())
|
||||
continue;
|
||||
|
||||
LoadNotesFromPrevUsers ( pPair->first );
|
||||
|
||||
DurationSlide = PPT_DEFAULT_SLIDE_DURATION;
|
||||
|
||||
m_arNotes.push_back(new CSlide());
|
||||
|
||||
CSlide* pSlide = m_arNotes.back();
|
||||
|
||||
pSlide->m_lOriginalWidth = lOriginWidth;
|
||||
pSlide->m_lOriginalHeight = lOriginHeight;
|
||||
|
||||
pSlide->m_lWidth = (LONG)(c_dMasterUnitsToMillimetreKoef * lOriginWidth);
|
||||
pSlide->m_lHeight = (LONG)(c_dMasterUnitsToMillimetreKoef * lOriginHeight);
|
||||
|
||||
LoadNotes ( pPair->first, pSlide);
|
||||
}
|
||||
|
||||
CalculateEditor(m_oInfo);
|
||||
}
|
||||
|
||||
void CPPTUserInfo::LoadNotes(DWORD dwNoteID, CSlide* pNotes)
|
||||
{
|
||||
std::map<DWORD, CRecordSlide*>::iterator pPairNotes = m_mapNotes.find(dwNoteID);
|
||||
|
||||
if (pPairNotes == m_mapNotes.end()) return;
|
||||
|
||||
CRecordSlide* pRecordSlide = pPairNotes->second;
|
||||
|
||||
if (NULL == pRecordSlide) return;
|
||||
|
||||
pNotes->m_bUseLayoutColorScheme = true;
|
||||
|
||||
CSlideInfo slide_info;
|
||||
m_arNotesWrapper.push_back(slide_info);
|
||||
|
||||
CSlideInfo* pNotesWrapper = &m_arNotesWrapper.back();
|
||||
|
||||
int indexUser = pRecordSlide->m_IndexUser;
|
||||
|
||||
pNotesWrapper->m_parEmptyPictures = &m_pDocumentInfo->m_arUsers[indexUser]->m_arOffsetPictures;
|
||||
pNotesWrapper->m_mapFilePictures = &m_pDocumentInfo->m_mapStoreImageFile;
|
||||
|
||||
//грузим placeholder
|
||||
pNotesWrapper->m_arTextPlaceHolders = pRecordSlide->m_oPersist.m_arTextAttrs;
|
||||
|
||||
std::vector<CRecordNotesAtom*> oArrayNotesAtoms;
|
||||
pRecordSlide->GetRecordsByType(&oArrayNotesAtoms, false, true);
|
||||
if (0 == oArrayNotesAtoms.size())
|
||||
{
|
||||
// ошибка!!!
|
||||
return;
|
||||
}
|
||||
bool bMasterColorScheme = oArrayNotesAtoms[0]->m_bMasterScheme;
|
||||
bool bMasterBackGround = oArrayNotesAtoms[0]->m_bMasterBackground;
|
||||
bool bMasterObjects = oArrayNotesAtoms[0]->m_bMasterObjects;
|
||||
|
||||
std::map<DWORD, CRecordSlide*>::iterator pPairSlide = m_mapSlides.find(oArrayNotesAtoms[0]->m_nSlideIDRef);
|
||||
|
||||
if (pPairSlide == m_mapSlides.end())
|
||||
{
|
||||
//????? у заметок нет слайда !!!
|
||||
}
|
||||
//-----------------------------------------------------
|
||||
CSlide* pSlide = m_arSlides[pPairSlide->second->m_Index];
|
||||
|
||||
pNotes->m_lSlideID = pPairSlide->second->m_Index;
|
||||
pSlide->m_lNotesID = m_arNotes.size() - 1;
|
||||
//-----------------------------------------------------
|
||||
|
||||
CTheme * pTheme = m_pNotesMaster;
|
||||
CSlideInfo * pThemeWrapper = m_pNotesMasterWrapper;
|
||||
|
||||
CLayout* pLayout = NULL;
|
||||
//-----------------------------------------------------
|
||||
std::vector<NSPresentationEditor::CColor>* pArrayColorScheme = pTheme ? &pTheme->m_arColorScheme : NULL;
|
||||
|
||||
// читаем цветовую схему -----------------------------------------------------------
|
||||
pNotes->m_bUseLayoutColorScheme = true;
|
||||
if (!bMasterColorScheme)
|
||||
{
|
||||
std::vector<CRecordColorSchemeAtom*> oArrayColors;
|
||||
pRecordSlide->GetRecordsByType(&oArrayColors, false);
|
||||
|
||||
for (size_t i = 0; i < oArrayColors.size(); ++i)
|
||||
{
|
||||
if (0x01 == oArrayColors[i]->m_oHeader.RecInstance)
|
||||
{
|
||||
pNotes->m_bUseLayoutColorScheme = false;
|
||||
oArrayColors[i]->ToArray(&pNotes->m_arColorScheme);
|
||||
CorrectColorScheme(pNotes->m_arColorScheme);
|
||||
|
||||
// проверим на совпадение
|
||||
size_t nCountC = pNotes->m_arColorScheme.size();
|
||||
size_t nIndexC = 0;
|
||||
if (pArrayColorScheme && nCountC == pArrayColorScheme->size())
|
||||
{
|
||||
for (; nIndexC < nCountC; ++nIndexC)
|
||||
{
|
||||
if (pNotes->m_arColorScheme[i].IsEqual(pArrayColorScheme->at(i)))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (nIndexC == nCountC)
|
||||
{
|
||||
pNotes->m_bUseLayoutColorScheme = true;
|
||||
pNotes->m_arColorScheme.clear();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------
|
||||
bool bHasDate = false;
|
||||
bool bHasSlideNumber = false;
|
||||
bool bHasFooter = false;
|
||||
int nFormatDate = 1;
|
||||
|
||||
std::vector<CRecordHeadersFootersContainer*> oArrayHeadersFootersInfo;
|
||||
pRecordSlide->GetRecordsByType(&oArrayHeadersFootersInfo, true, false);
|
||||
|
||||
if (!oArrayHeadersFootersInfo.empty())
|
||||
{
|
||||
if (oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom)
|
||||
{
|
||||
bHasDate = oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasDate ||
|
||||
oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasTodayDate ||
|
||||
oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasUserDate;
|
||||
bHasFooter = oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasFooter;
|
||||
bHasSlideNumber = oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasSlideNumber;
|
||||
|
||||
if (oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasUserDate) nFormatDate = 2;
|
||||
}
|
||||
for (int i = 0 ; i < 3; i++)
|
||||
pNotes->m_PlaceholdersReplaceString[i] = oArrayHeadersFootersInfo[0]->m_HeadersFootersString[i];
|
||||
}
|
||||
//------------- читаем все элементы ------------------------------------------------------------------------------------------
|
||||
pNotes->m_bIsBackground = false;
|
||||
|
||||
std::vector<CRecordShapeContainer*> oArrayShapes;
|
||||
pRecordSlide->GetRecordsByType(&oArrayShapes, true);
|
||||
|
||||
for (size_t nShape = 0; nShape < oArrayShapes.size(); ++nShape)
|
||||
{
|
||||
IElement* pElement = NULL;
|
||||
|
||||
oArrayShapes[nShape]->GetElement(&pElement, &m_oExMedia, pNotes->m_lOriginalWidth, pNotes->m_lOriginalHeight,
|
||||
pTheme, pLayout, pThemeWrapper, pNotesWrapper, pNotes);
|
||||
|
||||
if (NULL != pElement)
|
||||
{
|
||||
if (pElement->m_bIsBackground && !pElement->m_bHaveAnchor && !bMasterBackGround)
|
||||
{
|
||||
CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElement);
|
||||
if (NULL != pShape)
|
||||
{
|
||||
pShape->SetupProperties(pNotes, pTheme, pLayout);
|
||||
|
||||
pNotes->m_bIsBackground = true;
|
||||
pNotes->m_oBackground = pShape->m_oBrush;
|
||||
}
|
||||
RELEASEOBJECT(pElement);
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
if (pElement->m_bHaveAnchor)
|
||||
{
|
||||
pNotes->m_arElements.push_back(pElement);
|
||||
}
|
||||
if ( pElement->m_lPlaceholderType >0)
|
||||
{
|
||||
pNotes->m_mapPlaceholders.insert(std::pair<int, int>(pElement->m_lPlaceholderType, pNotes->m_arElements.size()-1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide)
|
||||
{
|
||||
@ -562,7 +802,7 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide)
|
||||
std::vector<CRecordColorSchemeAtom*> oArrayColors;
|
||||
pRecordSlide->GetRecordsByType(&oArrayColors, false);
|
||||
|
||||
for (int i = 0; i < oArrayColors.size(); ++i)
|
||||
for (size_t i = 0; i < oArrayColors.size(); ++i)
|
||||
{
|
||||
if (0x01 == oArrayColors[i]->m_oHeader.RecInstance)
|
||||
{
|
||||
@ -573,7 +813,7 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide)
|
||||
// проверим на совпадение
|
||||
size_t nCountC = pSlide->m_arColorScheme.size();
|
||||
size_t nIndexC = 0;
|
||||
if (nCountC == pArrayColorScheme->size())
|
||||
if (pArrayColorScheme && nCountC == pArrayColorScheme->size())
|
||||
{
|
||||
for (; nIndexC < nCountC; ++nIndexC)
|
||||
{
|
||||
@ -628,7 +868,7 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide)
|
||||
std::vector<CRecordCString*> oArrayStrings;
|
||||
pRecordSlide->GetRecordsByType(&oArrayStrings, false, false);
|
||||
|
||||
for (int i=0; i < oArrayStrings.size(); i++)
|
||||
for (size_t i = 0; i < oArrayStrings.size(); i++)
|
||||
{
|
||||
if (oArrayStrings[i]->m_oHeader.RecType == 0x0fba)
|
||||
{
|
||||
@ -642,7 +882,7 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide)
|
||||
|
||||
pSlide->m_bIsBackground = false;
|
||||
|
||||
for (int nShape = 0; nShape < oArrayShapes.size(); ++nShape)
|
||||
for (size_t nShape = 0; nShape < oArrayShapes.size(); ++nShape)
|
||||
{
|
||||
IElement* pElement = NULL;
|
||||
|
||||
@ -1029,7 +1269,8 @@ void CPPTUserInfo::LoadMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, co
|
||||
}
|
||||
std::vector<CRecordCString*> oArrayStrings;
|
||||
pMaster->GetRecordsByType(&oArrayStrings, false, false);
|
||||
for (int i=0; i < oArrayStrings.size(); i++)
|
||||
|
||||
for (size_t i = 0; i < oArrayStrings.size(); i++)
|
||||
{
|
||||
if (oArrayStrings[i]->m_oHeader.RecType == 0x0fba)
|
||||
{
|
||||
@ -1100,7 +1341,7 @@ void CPPTUserInfo::LoadMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, co
|
||||
std::vector<CRecordTextMasterStyleAtom*> oArrayTextMasters;
|
||||
pMaster->GetRecordsByType(&oArrayTextMasters, true, false);
|
||||
|
||||
for (int i = 0; i < oArrayTextMasters.size(); ++i)
|
||||
for (size_t i = 0; i < oArrayTextMasters.size(); ++i)
|
||||
{
|
||||
LONG lType = (LONG)oArrayTextMasters[i]->m_oHeader.RecInstance;
|
||||
if ((0 > lType) || (lType > 8))
|
||||
@ -1142,7 +1383,7 @@ void CPPTUserInfo::LoadMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, co
|
||||
|
||||
CLayout* pLayout = NULL; // ну нету тут разметок ...!!
|
||||
|
||||
for (int nShape = 0; nShape < oArrayShapes.size(); ++nShape)
|
||||
for (size_t nShape = 0; nShape < oArrayShapes.size(); ++nShape)
|
||||
{
|
||||
NSPresentationEditor::IElement* pElement = NULL;
|
||||
oArrayShapes[nShape]->GetElement(&pElement, &m_oExMedia, lOriginWidth, lOriginHeight, pTheme, pLayout, pMasterWrapper, pMasterWrapper);
|
||||
@ -1177,7 +1418,7 @@ void CPPTUserInfo::LoadMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, co
|
||||
|
||||
void CPPTUserInfo::LoadMasters(const LONG& lOriginWidth, const LONG& lOriginHeight)
|
||||
{
|
||||
for (long i=0; i< m_arrMastersOrder.size(); i++)
|
||||
for (size_t i = 0; i< m_arrMastersOrder.size(); i++)
|
||||
{
|
||||
std::map<DWORD, CRecordSlide*>::iterator pPair = m_mapMasters.find(m_arrMastersOrder[i]);
|
||||
if (pPair == m_mapMasters.end())continue;
|
||||
@ -1185,15 +1426,244 @@ void CPPTUserInfo::LoadMasters(const LONG& lOriginWidth, const LONG& lOriginHeig
|
||||
LoadMainMaster(pPair->first, lOriginWidth, lOriginHeight);
|
||||
}
|
||||
|
||||
for (long i=0; i< m_arrMastersOrder.size(); i++)
|
||||
for (size_t i = 0; i< m_arrMastersOrder.size(); i++)
|
||||
{
|
||||
std::map<DWORD, CRecordSlide*>::iterator pPair = m_mapMasters.find(m_arrMastersOrder[i]);
|
||||
if (pPair == m_mapMasters.end())continue;
|
||||
|
||||
LoadNoMainMaster(pPair->first, lOriginWidth, lOriginHeight);
|
||||
}
|
||||
}
|
||||
|
||||
LoadNotesMasterFromPrevUsers(0);
|
||||
if (!m_mapNotesMasters.empty())
|
||||
{
|
||||
std::map<DWORD, CRecordSlide*>::iterator pPair = m_mapNotesMasters.begin();
|
||||
|
||||
LoadMaster(pPair->second, m_pNotesMasterWrapper, m_pNotesMaster);
|
||||
}
|
||||
|
||||
LoadHandoutMasterFromPrevUsers(0);
|
||||
if (!m_mapHandoutMasters.empty())
|
||||
{
|
||||
std::map<DWORD, CRecordSlide*>::iterator pPair = m_mapHandoutMasters.begin();
|
||||
|
||||
LoadMaster(pPair->second, m_pHandoutMasterWrapper, m_pHandoutMaster);
|
||||
}
|
||||
}
|
||||
void CPPTUserInfo::LoadMaster(CRecordSlide* pMaster, CSlideInfo *& pMasterWrapper, CTheme *& pTheme)
|
||||
{
|
||||
if (pMaster == NULL)
|
||||
return;
|
||||
|
||||
LONG lOriginWidth = 0, lOriginHeight = 0;
|
||||
|
||||
bool bMasterColorScheme = false;
|
||||
bool bMasterBackGround = false;
|
||||
bool bMasterObjects = false;
|
||||
|
||||
DWORD dwID = 0;
|
||||
|
||||
std::vector<CRecordSlideAtom*> oArraySlideAtoms;
|
||||
pMaster->GetRecordsByType(&oArraySlideAtoms, true);
|
||||
|
||||
if (!oArraySlideAtoms.empty())
|
||||
{
|
||||
dwID = (DWORD)oArraySlideAtoms[0]->m_nMasterIDRef;
|
||||
|
||||
bMasterColorScheme = oArraySlideAtoms[0]->m_bMasterScheme;
|
||||
bMasterBackGround = oArraySlideAtoms[0]->m_bMasterBackground;
|
||||
bMasterObjects = oArraySlideAtoms[0]->m_bMasterObjects;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<CRecordNotesAtom*> oArrayNotesAtoms;
|
||||
pMaster->GetRecordsByType(&oArrayNotesAtoms, true);
|
||||
|
||||
if (!oArrayNotesAtoms.empty())
|
||||
{
|
||||
dwID = (DWORD)oArrayNotesAtoms[0]->m_nSlideIDRef;
|
||||
|
||||
bMasterColorScheme = oArrayNotesAtoms[0]->m_bMasterScheme;
|
||||
bMasterBackGround = oArrayNotesAtoms[0]->m_bMasterBackground;
|
||||
bMasterObjects = oArrayNotesAtoms[0]->m_bMasterObjects;
|
||||
}
|
||||
}
|
||||
|
||||
pTheme = new CTheme();
|
||||
|
||||
pTheme->m_lOriginalWidth = lOriginWidth;
|
||||
pTheme->m_lOriginalHeight = lOriginHeight;
|
||||
|
||||
std::vector<CRecordHeadersFootersContainer*> oArrayHeadersFootersInfo;
|
||||
pMaster->GetRecordsByType(&oArrayHeadersFootersInfo, true, false);
|
||||
|
||||
if (0 != oArrayHeadersFootersInfo.size())
|
||||
{
|
||||
if (oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom)
|
||||
{
|
||||
pTheme->m_bHasDate = oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasDate ||
|
||||
oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasTodayDate ||
|
||||
oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasUserDate;
|
||||
pTheme->m_bHasFooter = oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasFooter;
|
||||
pTheme->m_bHasSlideNumber = oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasSlideNumber;
|
||||
|
||||
if (oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasUserDate ) pTheme->m_nFormatDate = 2;
|
||||
}
|
||||
for(int i = 0 ; i< 3; i++) pTheme->m_PlaceholdersReplaceString[i] = oArrayHeadersFootersInfo[0]->m_HeadersFootersString[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
pTheme->m_bHasDate = m_bHasDate;
|
||||
pTheme->m_bHasFooter = m_bHasFooter;
|
||||
pTheme->m_bHasSlideNumber = m_bHasSlideNumber;
|
||||
pTheme->m_nFormatDate = m_nFormatDate;
|
||||
for (int i = 0 ; i < 3; i++) pTheme->m_PlaceholdersReplaceString[i] = m_PlaceholdersReplaceString[i];
|
||||
}
|
||||
std::vector<CRecordCString*> oArrayStrings;
|
||||
pMaster->GetRecordsByType(&oArrayStrings, false, false);
|
||||
|
||||
for (size_t i = 0; i < oArrayStrings.size(); i++)
|
||||
{
|
||||
if (oArrayStrings[i]->m_oHeader.RecType == 0x0fba)
|
||||
{
|
||||
pTheme->m_sThemeName = oArrayStrings[i]->m_strText;
|
||||
}
|
||||
}
|
||||
|
||||
pMasterWrapper = new CSlideInfo();
|
||||
|
||||
// записываем шрифты ---------------------------------------------------------------
|
||||
int nCountFonts = m_arrFonts.size();
|
||||
for (int i = 0; i < nCountFonts; ++i)
|
||||
{
|
||||
pTheme->m_arFonts.push_back(m_arrFonts[i]);
|
||||
}
|
||||
// ---------------------------------------------------------------------------------
|
||||
|
||||
// читаем цветовую схему -----------------------------------------------------------
|
||||
std::vector<CRecordColorSchemeAtom*> oArrayColors;
|
||||
pMaster->GetRecordsByType(&oArrayColors, false);
|
||||
|
||||
int nColorCount = oArrayColors.size();
|
||||
for (int i = 0; i < nColorCount; ++i)
|
||||
{
|
||||
if (0x01 == oArrayColors[i]->m_oHeader.RecInstance)
|
||||
{
|
||||
if ( m_oSchemeColors.empty())
|
||||
{
|
||||
oArrayColors[i]->ToArray(&m_oSchemeColors);
|
||||
CorrectColorScheme(m_oSchemeColors);//??
|
||||
}
|
||||
if ( pTheme->m_arColorScheme.empty())
|
||||
{
|
||||
oArrayColors[i]->ToArray(&pTheme->m_arColorScheme);
|
||||
CorrectColorScheme(pTheme->m_arColorScheme);
|
||||
}
|
||||
}
|
||||
|
||||
if (0x06 == oArrayColors[i]->m_oHeader.RecInstance)
|
||||
{
|
||||
std::vector<CColor> extra;
|
||||
oArrayColors[i]->ToArray(&extra);
|
||||
|
||||
CorrectColorScheme(extra);
|
||||
pTheme->m_arExtraColorScheme.push_back(extra);
|
||||
}
|
||||
}
|
||||
if (pTheme->m_arColorScheme.empty() && !pTheme->m_arExtraColorScheme.empty())
|
||||
{
|
||||
pTheme->m_arColorScheme = pTheme->m_arExtraColorScheme[0];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
int indexUser = 0;
|
||||
//std::map<DWORD, CRecordSlide*>::iterator pPairMaster1 = m_mapMasters.find(dwMasterID);
|
||||
//if (pPairMaster1 != m_mapMasters.end())
|
||||
//{
|
||||
// indexUser = pPairMaster1->second->m_IndexUser;
|
||||
// pMasterWrapper->m_arTextPlaceHolders = pPairMaster1->second->m_oPersist.m_arTextAttrs;
|
||||
//}
|
||||
pMasterWrapper->m_parEmptyPictures = &m_pDocumentInfo->m_arUsers[indexUser]->m_arOffsetPictures;
|
||||
pMasterWrapper->m_mapFilePictures = &m_pDocumentInfo->m_mapStoreImageFile;
|
||||
|
||||
// читаем настройки текстовых стилей -----------------------------------------------
|
||||
std::vector<CRecordTextMasterStyleAtom*> oArrayTextMasters;
|
||||
pMaster->GetRecordsByType(&oArrayTextMasters, true, false);
|
||||
|
||||
for (size_t i = 0; i < oArrayTextMasters.size(); ++i)
|
||||
{
|
||||
LONG lType = (LONG)oArrayTextMasters[i]->m_oHeader.RecInstance;
|
||||
if ((0 > lType) || (lType > 8))
|
||||
continue;
|
||||
|
||||
pMasterWrapper->m_pStyles[lType] = new NSPresentationEditor::CTextStyles();
|
||||
pMasterWrapper->m_pStyles[lType]->SetStyles((NSPresentationEditor::CTextStyles*)oArrayTextMasters[i]);
|
||||
|
||||
CTheme::CalculateStyle(pTheme, pMasterWrapper->m_pStyles[lType].get());
|
||||
}
|
||||
if (pMasterWrapper->m_pStyles[3].is_init())
|
||||
pMasterWrapper->m_pStyles[3]->ApplyBefore(m_oDefaultTextStyle);
|
||||
else
|
||||
pMasterWrapper->m_pStyles[3] = m_oDefaultTextStyle;
|
||||
|
||||
CTextStyles oPPTDefaultStyle;
|
||||
CreateDefaultStyle(oPPTDefaultStyle, pTheme);
|
||||
oPPTDefaultStyle.ApplyAfter(m_oDefaultTextStyle);
|
||||
|
||||
// выставим стили теме
|
||||
pTheme->m_pStyles[0] = oPPTDefaultStyle;
|
||||
pTheme->m_pStyles[1] = oPPTDefaultStyle;
|
||||
pTheme->m_pStyles[2] = oPPTDefaultStyle;
|
||||
pTheme->m_pStyles[3] = oPPTDefaultStyle;
|
||||
|
||||
if (pMasterWrapper->m_pStyles[0].is_init())
|
||||
pTheme->m_pStyles[1].ApplyAfter(pMasterWrapper->m_pStyles[0].get());
|
||||
if (pMasterWrapper->m_pStyles[1].is_init())
|
||||
pTheme->m_pStyles[2].ApplyAfter(pMasterWrapper->m_pStyles[1].get());
|
||||
if (pMasterWrapper->m_pStyles[2].is_init())
|
||||
pTheme->m_pStyles[3].ApplyAfter(pMasterWrapper->m_pStyles[3].get());
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
// читаем все элементы...-----------------------------------------------------------
|
||||
std::vector<CRecordShapeContainer*> oArrayShapes;
|
||||
pMaster->GetRecordsByType(&oArrayShapes, true);
|
||||
|
||||
pTheme->CalculateStyles();
|
||||
|
||||
CLayout* pLayout = NULL; // ну нету тут разметок ...!!
|
||||
|
||||
for (size_t nShape = 0; nShape < oArrayShapes.size(); ++nShape)
|
||||
{
|
||||
NSPresentationEditor::IElement* pElement = NULL;
|
||||
oArrayShapes[nShape]->GetElement(&pElement, &m_oExMedia, lOriginWidth, lOriginHeight, pTheme, pLayout, pMasterWrapper, pMasterWrapper);
|
||||
|
||||
if (NULL != pElement)
|
||||
{
|
||||
//AddAnimation ( dwMasterID, lOriginWidth, lOriginHeight, pElement );
|
||||
|
||||
if (pElement->m_bIsBackground && !pElement->m_bHaveAnchor)
|
||||
{
|
||||
CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElement);
|
||||
if (NULL != pShape)
|
||||
{
|
||||
pShape->SetupProperties(NULL, pTheme, pLayout);
|
||||
|
||||
pTheme->m_bIsBackground = true;
|
||||
pTheme->m_oBackground = pShape->m_oBrush;
|
||||
}
|
||||
|
||||
RELEASEINTERFACE(pElement);
|
||||
continue;
|
||||
}
|
||||
pTheme->m_arElements.push_back(pElement);
|
||||
|
||||
if ( pElement->m_lPlaceholderType > 0)
|
||||
{
|
||||
pTheme->m_mapPlaceholders.insert(std::pair<int, int>(pElement->m_lPlaceholderType, pTheme->m_arElements.size()-1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void CPPTUserInfo::LoadNoMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, const LONG& lOriginHeight)
|
||||
{
|
||||
std::map<DWORD, CRecordSlide*>::iterator pPair = m_mapMasters.find(dwMasterID);
|
||||
@ -1266,10 +1736,10 @@ void CPPTUserInfo::LoadNoMainMaster(DWORD dwMasterID, const LONG& lOriginWidth,
|
||||
|
||||
CLayout* pLayout = NULL;
|
||||
|
||||
int lLayoutID = AddNewLayout(pTheme, pCurMaster, false, false);
|
||||
int lLayoutID = AddNewLayout(pTheme, pCurMaster, false, false);
|
||||
|
||||
pLayout = &pTheme->m_arLayouts[lLayoutID];
|
||||
pLayout->m_bShowMasterShapes = false;
|
||||
pLayout->m_bShowMasterShapes = false;
|
||||
|
||||
pTheme->m_mapTitleLayout[dwMasterID] = lLayoutID;
|
||||
|
||||
@ -1281,7 +1751,7 @@ void CPPTUserInfo::LoadNoMainMaster(DWORD dwMasterID, const LONG& lOriginWidth,
|
||||
pCurMaster->GetRecordsByType(&oArrayColors, false);
|
||||
|
||||
pLayout->m_arColorScheme.clear();
|
||||
for (int i = 0; i < oArrayColors.size(); ++i)
|
||||
for (size_t i = 0; i < oArrayColors.size(); ++i)
|
||||
{
|
||||
if (0x01 == oArrayColors[i]->m_oHeader.RecInstance)
|
||||
{
|
||||
@ -1292,7 +1762,7 @@ void CPPTUserInfo::LoadNoMainMaster(DWORD dwMasterID, const LONG& lOriginWidth,
|
||||
// проверим на совпадение
|
||||
size_t nCountC = pLayout->m_arColorScheme.size();
|
||||
size_t nIndexC = 0;
|
||||
if (nCountC == pArrayColorScheme->size())
|
||||
if (pArrayColorScheme && nCountC == pArrayColorScheme->size())
|
||||
{
|
||||
for (; nIndexC < nCountC; ++nIndexC)
|
||||
{
|
||||
@ -1341,7 +1811,7 @@ void CPPTUserInfo::LoadNoMainMaster(DWORD dwMasterID, const LONG& lOriginWidth,
|
||||
std::vector<CRecordCString*> oArrayStrings;
|
||||
pCurMaster->GetRecordsByType(&oArrayStrings, false, false);
|
||||
|
||||
for (int i=0; i < oArrayStrings.size(); i++)
|
||||
for (size_t i = 0; i < oArrayStrings.size(); i++)
|
||||
{
|
||||
if (oArrayStrings[i]->m_oHeader.RecType == 0x0fba)
|
||||
{
|
||||
@ -1352,7 +1822,7 @@ void CPPTUserInfo::LoadNoMainMaster(DWORD dwMasterID, const LONG& lOriginWidth,
|
||||
std::vector<CRecordShapeContainer*> oArrayShapes;
|
||||
pCurMaster->GetRecordsByType(&oArrayShapes, true);
|
||||
|
||||
for (int nShape = 0; nShape < oArrayShapes.size(); ++nShape)
|
||||
for (size_t nShape = 0; nShape < oArrayShapes.size(); ++nShape)
|
||||
{
|
||||
IElement* pElement = NULL;
|
||||
oArrayShapes[nShape]->GetElement(&pElement, &m_oExMedia, lOriginWidth, lOriginHeight, pTheme, pLayout, pThemeWrapper, pMasterWrapper);
|
||||
@ -1467,7 +1937,7 @@ void CPPTUserInfo::LoadMasterFromPrevUsers(DWORD dwMasterID)
|
||||
|
||||
size_t lUsersCount = m_pDocumentInfo->m_arUsers.size();
|
||||
|
||||
for (int lIndexUser = m_lIndexThisUser + 1; lIndexUser < lUsersCount; ++lIndexUser)
|
||||
for (size_t lIndexUser = m_lIndexThisUser + 1; lIndexUser < lUsersCount; ++lIndexUser)
|
||||
{
|
||||
std::map<DWORD, CRecordSlide*>::iterator pPair = m_pDocumentInfo->m_arUsers[lIndexUser]->m_mapMasters.find(dwMasterID);
|
||||
|
||||
@ -1496,23 +1966,21 @@ void CPPTUserInfo::LoadMasterFromPrevUsers(DWORD dwMasterID)
|
||||
}
|
||||
}
|
||||
}
|
||||
void CPPTUserInfo::LoadNoteFromPrevUsers(DWORD dwSlideID)
|
||||
void CPPTUserInfo::LoadNotesFromPrevUsers(DWORD dwSlideID)
|
||||
{
|
||||
if ((NULL == m_pDocumentInfo) || (-1 == m_lIndexThisUser))
|
||||
return;
|
||||
|
||||
std::map<DWORD, CRecordSlide*>::iterator pPair = m_mapNotes.find(dwSlideID);
|
||||
if (pPair != m_mapNotes.end())
|
||||
std::map<DWORD, CRecordSlide*>::iterator pPairSlide = m_mapNotes.find(dwSlideID);
|
||||
|
||||
if (pPairSlide != m_mapNotes.end() && pPairSlide->second)
|
||||
return; //есть
|
||||
|
||||
|
||||
size_t lUsersCount = m_pDocumentInfo->m_arUsers.size();
|
||||
|
||||
// у нас чем раньше - тем больше индекс
|
||||
for (size_t lIndexUser = m_lIndexThisUser + 1; lIndexUser < lUsersCount; lIndexUser++)
|
||||
//for (size_t lIndexUser = lUsersCount - 1; lIndexUser > m_lIndexThisUser; lIndexUser--)
|
||||
{
|
||||
pPair = m_pDocumentInfo->m_arUsers[lIndexUser]->m_mapNotes.find(dwSlideID);
|
||||
|
||||
for (size_t lIndexUser = m_lIndexThisUser + 1; lIndexUser < lUsersCount; ++lIndexUser)
|
||||
{
|
||||
std::map<DWORD, CRecordSlide*>::iterator pPair = m_pDocumentInfo->m_arUsers[lIndexUser]->m_mapNotes.find(dwSlideID);
|
||||
if (pPair == m_pDocumentInfo->m_arUsers[lIndexUser]->m_mapNotes.end())
|
||||
continue;
|
||||
|
||||
@ -1520,13 +1988,103 @@ void CPPTUserInfo::LoadNoteFromPrevUsers(DWORD dwSlideID)
|
||||
if (NULL != pSlideCur)
|
||||
{
|
||||
pSlideCur->AddRef();
|
||||
m_mapNotes.insert(std::pair<DWORD, CRecordSlide*>(dwSlideID, pSlideCur));
|
||||
m_arrNotesOrder.push_back(dwSlideID);
|
||||
|
||||
pSlideCur->m_IndexUser = lIndexUser;
|
||||
|
||||
if (pPairSlide != m_mapNotes.end())
|
||||
{
|
||||
pPairSlide->second = pSlideCur;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_mapNotes.insert(m_mapSlides.end(), std::pair<DWORD, CRecordSlide*>(dwSlideID, pSlideCur));
|
||||
m_arrNotesOrder.push_back(dwSlideID);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CPPTUserInfo::LoadNotesMasterFromPrevUsers(DWORD dwMasterID)
|
||||
{
|
||||
if ((NULL == m_pDocumentInfo) || (-1 == m_lIndexThisUser))
|
||||
return;
|
||||
|
||||
std::map<DWORD, CRecordSlide*>::iterator pPairMaster = m_mapNotesMasters.find(dwMasterID);
|
||||
|
||||
if (pPairMaster != m_mapNotesMasters.end() && pPairMaster->second)
|
||||
return;//есть
|
||||
|
||||
size_t lUsersCount = m_pDocumentInfo->m_arUsers.size();
|
||||
|
||||
for (size_t lIndexUser = m_lIndexThisUser + 1; lIndexUser < lUsersCount; ++lIndexUser)
|
||||
{
|
||||
std::map<DWORD, CRecordSlide*>::iterator pPair = m_pDocumentInfo->m_arUsers[lIndexUser]->m_mapNotesMasters.find(dwMasterID);
|
||||
|
||||
if (pPair == m_pDocumentInfo->m_arUsers[lIndexUser]->m_mapNotesMasters.end())
|
||||
continue;
|
||||
|
||||
CRecordSlide* pSlideCur = pPair->second;
|
||||
if (NULL != pSlideCur)
|
||||
{
|
||||
pSlideCur->AddRef();
|
||||
|
||||
//для каждого пользователя СВОИ активные картинки !!!
|
||||
pSlideCur->m_IndexUser = lIndexUser;
|
||||
|
||||
if (pPairMaster != m_mapNotesMasters.end())
|
||||
{
|
||||
//был найден ранее нулевым
|
||||
pPairMaster->second = pSlideCur;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_mapNotesMasters.insert(m_mapNotesMasters.end(), std::pair<DWORD, CRecordSlide*>(dwMasterID, pSlideCur));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
void CPPTUserInfo::LoadHandoutMasterFromPrevUsers(DWORD dwMasterID)
|
||||
{
|
||||
if ((NULL == m_pDocumentInfo) || (-1 == m_lIndexThisUser))
|
||||
return;
|
||||
|
||||
std::map<DWORD, CRecordSlide*>::iterator pPairMaster = m_mapHandoutMasters.find(dwMasterID);
|
||||
|
||||
if (pPairMaster != m_mapHandoutMasters.end() && pPairMaster->second)
|
||||
return;//есть
|
||||
|
||||
size_t lUsersCount = m_pDocumentInfo->m_arUsers.size();
|
||||
|
||||
for (size_t lIndexUser = m_lIndexThisUser + 1; lIndexUser < lUsersCount; ++lIndexUser)
|
||||
{
|
||||
std::map<DWORD, CRecordSlide*>::iterator pPair = m_pDocumentInfo->m_arUsers[lIndexUser]->m_mapHandoutMasters.find(dwMasterID);
|
||||
|
||||
if (pPair == m_pDocumentInfo->m_arUsers[lIndexUser]->m_mapHandoutMasters.end())
|
||||
continue;
|
||||
|
||||
CRecordSlide* pSlideCur = pPair->second;
|
||||
if (NULL != pSlideCur)
|
||||
{
|
||||
pSlideCur->AddRef();
|
||||
|
||||
//для каждого пользователя СВОИ активные картинки !!!
|
||||
pSlideCur->m_IndexUser = lIndexUser;
|
||||
|
||||
if (pPairMaster != m_mapHandoutMasters.end())
|
||||
{
|
||||
//был найден ранее нулевым
|
||||
pPairMaster->second = pSlideCur;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_mapHandoutMasters.insert(m_mapHandoutMasters.end(), std::pair<DWORD, CRecordSlide*>(dwMasterID, pSlideCur));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
void CPPTUserInfo::LoadExternal(CRecordExObjListContainer* pExObjects)
|
||||
{
|
||||
// читаем SoundCollection
|
||||
@ -1569,7 +2127,7 @@ void CPPTUserInfo::LoadExternal(CRecordExObjListContainer* pExObjects)
|
||||
std::vector<CRecordExVideoContainer*> oArray;
|
||||
pExObjects->GetRecordsByType(&oArray, true);
|
||||
|
||||
for (int nIndex = 0; nIndex < oArray.size(); ++nIndex)
|
||||
for (size_t nIndex = 0; nIndex < oArray.size(); ++nIndex)
|
||||
{
|
||||
LoadExVideo(oArray[nIndex]);
|
||||
}
|
||||
@ -1588,15 +2146,15 @@ void CPPTUserInfo::LoadExternal(CRecordExObjListContainer* pExObjects)
|
||||
pExObjects->GetRecordsByType(&oArrayWAVLink , true);
|
||||
pExObjects->GetRecordsByType(&oArrayAudioEmbedded , true);
|
||||
|
||||
for (int nIndex = 0; nIndex < oArrayAudioMIDI.size(); ++nIndex)
|
||||
for (size_t nIndex = 0; nIndex < oArrayAudioMIDI.size(); ++nIndex)
|
||||
{
|
||||
LoadExAudio(oArrayAudioMIDI[nIndex]);
|
||||
}
|
||||
for (int nIndex = 0; nIndex < oArrayWAVLink.size(); ++nIndex)
|
||||
for (size_t nIndex = 0; nIndex < oArrayWAVLink.size(); ++nIndex)
|
||||
{
|
||||
LoadExAudio(oArrayWAVLink[nIndex]);
|
||||
}
|
||||
for (int nIndex = 0; nIndex < oArrayAudioEmbedded.size(); ++nIndex)
|
||||
for (size_t nIndex = 0; nIndex < oArrayAudioEmbedded.size(); ++nIndex)
|
||||
{
|
||||
DWORD dwKeySound = oArrayAudioEmbedded[nIndex]->m_nSoundID;
|
||||
DWORD dwKeyObj = oArrayAudioEmbedded[nIndex]->m_oMedia.m_nExObjID;
|
||||
@ -1613,7 +2171,7 @@ void CPPTUserInfo::LoadExternal(CRecordExObjListContainer* pExObjects)
|
||||
m_oExMedia.m_arAudios.push_back(oAudio);
|
||||
}
|
||||
}
|
||||
for (int nIndex = 0; nIndex < oArrayAudioCD.size(); ++nIndex)
|
||||
for (size_t nIndex = 0; nIndex < oArrayAudioCD.size(); ++nIndex)
|
||||
{
|
||||
DWORD dwKeyObj = oArrayAudioCD[nIndex]->m_oMedia.m_nExObjID;
|
||||
|
||||
@ -1633,7 +2191,7 @@ void CPPTUserInfo::LoadExternal(CRecordExObjListContainer* pExObjects)
|
||||
|
||||
pExObjects->GetRecordsByType(&oArrayHyperlinkContainer , true);
|
||||
|
||||
for (int nIndex = 0; nIndex < oArrayHyperlinkContainer.size(); ++nIndex)
|
||||
for (size_t nIndex = 0; nIndex < oArrayHyperlinkContainer.size(); ++nIndex)
|
||||
{
|
||||
std::vector<CRecordExHyperlinkAtom*> oArrayHyperlink;
|
||||
std::vector<CRecordCString*> oArrayCString;
|
||||
@ -1645,8 +2203,8 @@ void CPPTUserInfo::LoadExternal(CRecordExObjListContainer* pExObjects)
|
||||
{
|
||||
NSPresentationEditor::CExFilesInfo oInfo;
|
||||
|
||||
oInfo.m_dwID = oArrayHyperlink[0]->m_nHyperlinkID;
|
||||
for (int i = 0 ; i < oArrayCString.size(); i++)
|
||||
oInfo.m_dwID = oArrayHyperlink[0]->m_nHyperlinkID;
|
||||
for (size_t i = 0 ; i < oArrayCString.size(); i++)
|
||||
{
|
||||
if (oArrayCString[i]->m_oHeader.RecInstance == 1)
|
||||
oInfo.m_strFilePath = oArrayCString[i]->m_strText;
|
||||
|
||||
@ -47,12 +47,13 @@ public:
|
||||
std::map<DWORD, DWORD> m_mapOffsetInPIDs;
|
||||
CRecordDocument m_oDocument;
|
||||
|
||||
//todooo при переходе на C++11 использовать НУЖНЫЙ здесь unsorted_map - m_arr .. Order уберутся
|
||||
|
||||
std::map<DWORD, CRecordSlide*> m_mapSlides;
|
||||
std::map<DWORD, CRecordSlide*> m_mapMasters;
|
||||
std::map<DWORD, CRecordSlide*> m_mapNotes;
|
||||
|
||||
std::map<DWORD, CRecordSlide*> m_mapNotesMasters;
|
||||
std::map<DWORD, CRecordSlide*> m_mapHandoutMasters;
|
||||
|
||||
std::vector<DWORD> m_arrSlidesOrder;
|
||||
std::vector<DWORD> m_arrMastersOrder;
|
||||
std::vector<DWORD> m_arrNotesOrder;
|
||||
@ -66,6 +67,10 @@ public:
|
||||
// это как бы ППT-шная обертка над слайдом
|
||||
std::vector<CSlideInfo> m_arSlideWrapper;
|
||||
std::vector<CSlideInfo> m_arMasterWrapper;
|
||||
std::vector<CSlideInfo> m_arNotesWrapper;
|
||||
|
||||
CSlideInfo* m_pNotesMasterWrapper;
|
||||
CSlideInfo* m_pHandoutMasterWrapper;
|
||||
|
||||
// эти параметры - одни на весь документ.
|
||||
// чтобы поддержать нашу схему (пптх) - копируем их в темы
|
||||
@ -106,8 +111,8 @@ public:
|
||||
nullable<WORD> m_wLanguage; // язык пользователя (редактора)
|
||||
bool m_bRtl;
|
||||
bool m_bShowComments;
|
||||
public:
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
CPPTUserInfo();
|
||||
~CPPTUserInfo();
|
||||
|
||||
@ -119,15 +124,20 @@ public:
|
||||
void NormalizeCoords(long lWidth, long lHeight);
|
||||
|
||||
void LoadSlide(DWORD dwSlideID, CSlide* pSlide);
|
||||
void LoadNotes(DWORD dwNotesID, CSlide* pSlide);
|
||||
|
||||
void LoadMasters(const LONG& lOriginWidth, const LONG& lOriginHeight);
|
||||
|
||||
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 LoadSlideFromPrevUsers (DWORD dwSlideID);
|
||||
void LoadMasterFromPrevUsers(DWORD dwSlideID);
|
||||
void LoadNoteFromPrevUsers (DWORD dwSlideID);
|
||||
void LoadSlideFromPrevUsers (DWORD dwSlideID);
|
||||
void LoadMasterFromPrevUsers (DWORD dwSlideID);
|
||||
void LoadNotesFromPrevUsers (DWORD dwSlideID);
|
||||
void LoadNotesMasterFromPrevUsers (DWORD dwSlideID);
|
||||
void LoadHandoutMasterFromPrevUsers (DWORD dwSlideID);
|
||||
|
||||
void LoadExternal(CRecordExObjListContainer* pExObjects);
|
||||
|
||||
@ -169,7 +179,6 @@ public:
|
||||
|
||||
oScheme = oArrayMem;
|
||||
}
|
||||
|
||||
|
||||
std::wstring ConvertLayoutType(INT nGeom, BYTE* pPlaceholders)
|
||||
{
|
||||
@ -287,6 +296,7 @@ public:
|
||||
return _T("blank");
|
||||
}
|
||||
|
||||
|
||||
void AddAnimation (DWORD dwSlideID, double Width, double Height, IElement* pElement);
|
||||
void AddAudioTransition (DWORD dwSlideID, CTransition* pTransition, const std::wstring& strFilePath);
|
||||
|
||||
|
||||
@ -73,10 +73,26 @@ typedef BYTE BOOL1;
|
||||
#define RECORD_TYPE_EXOBJLIST_ATOM 1034
|
||||
#define RECORD_TYPE_PPDRAWING_GROUP 1035
|
||||
#define RECORD_TYPE_PPDRAWING 1036
|
||||
#define RT_RoundTripTheme12Atom 1038
|
||||
#define RT_RoundTripColorMapping12Atom 1039
|
||||
#define RECORD_TYPE_NAMEDSHOWS 1040
|
||||
#define RECORD_TYPE_NAMEDSHOW 1041
|
||||
#define RECORD_TYPE_NAMEDSHOW_SLIDES 1042
|
||||
#define RECORD_TYPE_SHEET_PROPERTIES 1044
|
||||
|
||||
#define RECORD_TYPE_ORIGINALMAINMASTERID 1052
|
||||
#define RECORD_TYPE_COMPOSITEMASTERID 1053
|
||||
#define RECORD_TYPE_ROUNDTRIPCONTENTMASTERINFO12 1054
|
||||
#define RECORD_TYPE_ROUNDTRIPSHAPEID12 1055
|
||||
#define RECORD_TYPE_ROUNDTRIPHFPLACEHOLDER12 1056
|
||||
#define RECORD_TYPE_ROUNDTRIPCONTENTMASTERID 1058
|
||||
#define RECORD_TYPE_ROUNDTRIPOARTTEXTSTYLES12 1059
|
||||
#define RECORD_TYPE_ROUNDTRIPHEADERFOOTERDEFAULTS12ATOM 1060
|
||||
#define RECORD_TYPE_ROUNDTRIPDOCFLAGS12 1061
|
||||
#define RECORD_TYPE_ROUNDTRIPSHAPECHECKSUMFORCUSTOMLAYOUTS12 1062
|
||||
#define RECORD_TYPE_ROUNDTRIPNOTESMASTERTEXTSTYLES12 1063
|
||||
#define RECORD_TYPE_ROUNDTRIPCUSTOMTABLESTYLES12 1064
|
||||
|
||||
#define RECORD_TYPE_LIST 2000
|
||||
#define RECORD_TYPE_FONTCOLLECTION 2005
|
||||
#define RECORD_TYPE_BOOKMARKCOLLECTION 2019
|
||||
@ -182,19 +198,6 @@ typedef BYTE BOOL1;
|
||||
// Records ~12050 seem to be related to Document Encryption
|
||||
#define RECORD_TYPE_DOCUMENT_ENCRYPTION_ATOM 12052
|
||||
|
||||
#define RECORD_TYPE_ORIGINALMAINMASTERID 1052
|
||||
#define RECORD_TYPE_COMPOSITEMASTERID 1053
|
||||
#define RECORD_TYPE_ROUNDTRIPCONTENTMASTERINFO12 1054
|
||||
#define RECORD_TYPE_ROUNDTRIPSHAPEID12 1055
|
||||
#define RECORD_TYPE_ROUNDTRIPHFPLACEHOLDER12 1056
|
||||
#define RECORD_TYPE_ROUNDTRIPCONTENTMASTERID 1058
|
||||
#define RECORD_TYPE_ROUNDTRIPOARTTEXTSTYLES12 1059
|
||||
#define RECORD_TYPE_ROUNDTRIPHEADERFOOTERDEFAULTS12ATOM 1060
|
||||
#define RECORD_TYPE_ROUNDTRIPDOCFLAGS12 1061
|
||||
#define RECORD_TYPE_ROUNDTRIPSHAPECHECKSUMFORCUSTOMLAYOUTS12 1062
|
||||
#define RECORD_TYPE_ROUNDTRIPNOTESMASTERTEXTSTYLES12 1063
|
||||
#define RECORD_TYPE_ROUNDTRIPCUSTOMTABLESTYLES12 1064
|
||||
|
||||
//records greater then 0xF000 belong to with Microsoft Office Drawing format also known as Escher
|
||||
#define RECORD_TYPE_ESCHER_DGG_CONTAINER 0xF000
|
||||
#define RECORD_TYPE_ESCHER_DGG 0xF006
|
||||
@ -398,48 +401,47 @@ static std::string GetRecordName(DWORD dwType)
|
||||
case RECORD_TYPE_ROUNDTRIPNOTESMASTERTEXTSTYLES12 : { strName = ("RoundTripNotesMasterTextStyles12"); break; }
|
||||
case RECORD_TYPE_ROUNDTRIPCUSTOMTABLESTYLES12 : { strName = ("RoundTripCustomTableStyles12"); break; }
|
||||
|
||||
//records greater then 0xF000 belong to with Microsoft Office Drawing format also known as Escher
|
||||
case RECORD_TYPE_ESCHER_DGG_CONTAINER : { strName = ("Escher_DrawingGroupContainer"); break; }
|
||||
case RECORD_TYPE_ESCHER_DGG : { strName = ("Escher_DrawingGroupRecord"); break; }
|
||||
case RECORD_TYPE_ESCHER_CLSID : { strName = ("Escher_CLSID_Record"); break; }
|
||||
case RECORD_TYPE_ESCHER_OPT : { strName = ("Escher_OPT"); break; }
|
||||
case RECORD_TYPE_ESCHER_BSTORE_CONTAINER : { strName = ("Escher_BlipStoreContainer"); break; }
|
||||
case RECORD_TYPE_ESCHER_BSE : { strName = ("Escher_BlipStoreEntry"); break; }
|
||||
case RECORD_TYPE_ESCHER_BLIP_START : { strName = ("Escher_BlipStart"); break; }
|
||||
case RECORD_TYPE_ESCHER_BLIP_END : { strName = ("Escher_BlipEnd"); break; }
|
||||
case RECORD_TYPE_ESCHER_DG_CONTAINER : { strName = ("Escher_DrawingContainer"); break; }
|
||||
case RECORD_TYPE_ESCHER_DG : { strName = ("Escher_DrawingRecord"); break; }
|
||||
case RECORD_TYPE_ESCHER_REGROUPITEMS : { strName = ("Escher_RegGroupItems"); break; }
|
||||
case RECORD_TYPE_ESCHER_COLORSCHEME : { strName = ("Escher_ColorSheme"); break; }
|
||||
case RECORD_TYPE_ESCHER_SPGR_CONTAINER : { strName = ("Escher_GroupShapeContainer"); break; }
|
||||
case RECORD_TYPE_ESCHER_SP_CONTAINER : { strName = ("Escher_ShapeContainer"); break; }
|
||||
case RECORD_TYPE_ESCHER_SPGR : { strName = ("Escher_GroupShapeRecord"); break; }
|
||||
case RECORD_TYPE_ESCHER_SP : { strName = ("Escher_ShapeRecord"); break; }
|
||||
case RECORD_TYPE_ESCHER_TEXTBOX : { strName = ("Escher_TextBox"); break; }
|
||||
case RECORD_TYPE_ESCHER_CLIENTTEXTBOX : { strName = ("Escher_ClientTextBox"); break; }
|
||||
case RECORD_TYPE_ESCHER_ANCHOR : { strName = ("Escher_Anchor"); break; }
|
||||
case RECORD_TYPE_ESCHER_CHILDANCHOR : { strName = ("Escher_ChildAnchor"); break; }
|
||||
case RECORD_TYPE_ESCHER_CLIENTANCHOR : { strName = ("Escher_ClientAnchor"); break; }
|
||||
case RECORD_TYPE_ESCHER_CLIENTDATA : { strName = ("Escher_ClientData"); break; }
|
||||
case RECORD_TYPE_ESCHER_SOLVERCONTAINER : { strName = ("Escher_SolverContainer"); break; }
|
||||
case RECORD_TYPE_ESCHER_CONNECTORRULE : { strName = ("Escher_ConnectorRule"); break; }
|
||||
case RECORD_TYPE_ESCHER_ALIGNRULE : { strName = ("Escher_AlignRule"); break; }
|
||||
case RECORD_TYPE_ESCHER_ARCRULE : { strName = ("Escher_ArcRule"); break; }
|
||||
case RECORD_TYPE_ESCHER_CLIENTRULE : { strName = ("Escher_ClientRule"); break; }
|
||||
case RECORD_TYPE_ESCHER_CALLOUTRULE : { strName = ("Escher_CallOutRule"); break; }
|
||||
case RECORD_TYPE_ESCHER_SELECTION : { strName = ("Escher_Selection"); break; }
|
||||
case RECORD_TYPE_ESCHER_COLORMRU : { strName = ("Escher_ColorMRU"); break; }
|
||||
case RECORD_TYPE_ESCHER_DELETEDPSPL : { strName = ("Escher_DeletedPSPL"); break; }
|
||||
case RECORD_TYPE_ESCHER_SPLITMENUCOLORS : { strName = ("Escher_SplitMenuColors"); break; }
|
||||
case RECORD_TYPE_ESCHER_OLEOBJECT : { strName = ("Escher_OleObject"); break; }
|
||||
case RECORD_TYPE_ESCHER_SECONDARY_OPT : { strName = ("Escher_SecondaryOPT"); break; }
|
||||
case RECORD_TYPE_ESCHER_TETRIARY_OPT : { strName = ("Escher_TetriaryOPT"); break; }
|
||||
case RECORD_TYPE_ESCHER_DGG_CONTAINER : { strName = ("DrawingGroupContainer"); break; }
|
||||
case RECORD_TYPE_ESCHER_DGG : { strName = ("DrawingGroupRecord"); break; }
|
||||
case RECORD_TYPE_ESCHER_CLSID : { strName = ("CLSID_Record"); break; }
|
||||
case RECORD_TYPE_ESCHER_OPT : { strName = ("OPT"); break; }
|
||||
case RECORD_TYPE_ESCHER_BSTORE_CONTAINER : { strName = ("BlipStoreContainer"); break; }
|
||||
case RECORD_TYPE_ESCHER_BSE : { strName = ("BlipStoreEntry"); break; }
|
||||
case RECORD_TYPE_ESCHER_BLIP_START : { strName = ("BlipStart"); break; }
|
||||
case RECORD_TYPE_ESCHER_BLIP_END : { strName = ("BlipEnd"); break; }
|
||||
case RECORD_TYPE_ESCHER_DG_CONTAINER : { strName = ("DrawingContainer"); break; }
|
||||
case RECORD_TYPE_ESCHER_DG : { strName = ("DrawingRecord"); break; }
|
||||
case RECORD_TYPE_ESCHER_REGROUPITEMS : { strName = ("RegGroupItems"); break; }
|
||||
case RECORD_TYPE_ESCHER_COLORSCHEME : { strName = ("ColorSheme"); break; }
|
||||
case RECORD_TYPE_ESCHER_SPGR_CONTAINER : { strName = ("GroupShapeContainer"); break; }
|
||||
case RECORD_TYPE_ESCHER_SP_CONTAINER : { strName = ("ShapeContainer"); break; }
|
||||
case RECORD_TYPE_ESCHER_SPGR : { strName = ("GroupShapeRecord"); break; }
|
||||
case RECORD_TYPE_ESCHER_SP : { strName = ("ShapeRecord"); break; }
|
||||
case RECORD_TYPE_ESCHER_TEXTBOX : { strName = ("TextBox"); break; }
|
||||
case RECORD_TYPE_ESCHER_CLIENTTEXTBOX : { strName = ("ClientTextBox"); break; }
|
||||
case RECORD_TYPE_ESCHER_ANCHOR : { strName = ("Anchor"); break; }
|
||||
case RECORD_TYPE_ESCHER_CHILDANCHOR : { strName = ("ChildAnchor"); break; }
|
||||
case RECORD_TYPE_ESCHER_CLIENTANCHOR : { strName = ("ClientAnchor"); break; }
|
||||
case RECORD_TYPE_ESCHER_CLIENTDATA : { strName = ("ClientData"); break; }
|
||||
case RECORD_TYPE_ESCHER_SOLVERCONTAINER : { strName = ("SolverContainer"); break; }
|
||||
case RECORD_TYPE_ESCHER_CONNECTORRULE : { strName = ("ConnectorRule"); break; }
|
||||
case RECORD_TYPE_ESCHER_ALIGNRULE : { strName = ("AlignRule"); break; }
|
||||
case RECORD_TYPE_ESCHER_ARCRULE : { strName = ("ArcRule"); break; }
|
||||
case RECORD_TYPE_ESCHER_CLIENTRULE : { strName = ("ClientRule"); break; }
|
||||
case RECORD_TYPE_ESCHER_CALLOUTRULE : { strName = ("CallOutRule"); break; }
|
||||
case RECORD_TYPE_ESCHER_SELECTION : { strName = ("Selection"); break; }
|
||||
case RECORD_TYPE_ESCHER_COLORMRU : { strName = ("ColorMRU"); break; }
|
||||
case RECORD_TYPE_ESCHER_DELETEDPSPL : { strName = ("DeletedPSPL"); break; }
|
||||
case RECORD_TYPE_ESCHER_SPLITMENUCOLORS : { strName = ("SplitMenuColors"); break; }
|
||||
case RECORD_TYPE_ESCHER_OLEOBJECT : { strName = ("OleObject"); break; }
|
||||
case RECORD_TYPE_ESCHER_SECONDARY_OPT : { strName = ("SecondaryOPT"); break; }
|
||||
case RECORD_TYPE_ESCHER_TETRIARY_OPT : { strName = ("TetriaryOPT"); break; }
|
||||
default: break;
|
||||
};
|
||||
|
||||
if ((dwType > RECORD_TYPE_ESCHER_BLIP_START) && (dwType < RECORD_TYPE_ESCHER_BLIP_END))
|
||||
{
|
||||
strName = ("Escher_Blip");
|
||||
strName = ("Blip");
|
||||
}
|
||||
|
||||
return strName;
|
||||
|
||||
@ -95,8 +95,8 @@ IRecord* CreateByType(SRecordHeader oHeader)
|
||||
//CREATE_BY_TYPE(RECORD_TYPE_DOC_ROUTING_SLIP , CRecordDocRoutingSlipAtom)
|
||||
//CREATE_BY_TYPE(RECORD_TYPE_EXOBJLIST_ATOM , CRecordExObjListAtom)
|
||||
//CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN , CRecordGridSpacing10Atom)
|
||||
//CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN , CRecordRoundTripThemeAtom)
|
||||
//CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN , CRecordRoundTripColorMappingAtom)
|
||||
CREATE_BY_TYPE(RT_RoundTripTheme12Atom , CRecordRoundTripThemeAtom)
|
||||
CREATE_BY_TYPE(RT_RoundTripColorMapping12Atom , CRecordRoundTripColorMappingAtom)
|
||||
//CREATE_BY_TYPE(RECORD_TYPE_NAMEDSHOW_SLIDES , CRecordNamedShowSlidesAtom)
|
||||
//CREATE_BY_TYPE(RECORD_TYPE_SHEET_PROPERTIES , CRecordNormalViewSetInfoAtom)
|
||||
|
||||
@ -109,10 +109,10 @@ IRecord* CreateByType(SRecordHeader oHeader)
|
||||
CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPHFPLACEHOLDER12 , CRecordRoundTripHFPlaceholder12Atom)
|
||||
//CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPCONTENTMASTERID , CRecordRoundTripContentMasterId12Atom)
|
||||
//CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPOARTTEXTSTYLES12 , CRecordRoundTripOArtTextStyles12Atom)
|
||||
CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPHEADERFOOTERDEFAULTS12ATOM , CRecordRoundTripHeaderFooterDefaults12Atom)
|
||||
CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPHEADERFOOTERDEFAULTS12ATOM , CRecordRoundTripHeaderFooterDefaults12Atom)
|
||||
CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPNOTESMASTERTEXTSTYLES12 , CRecordRoundTripNotesMasterTextStyles12Atom)
|
||||
//CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPDOCFLAGS12 , CRecordRoundTripDocFlags12Atom)
|
||||
//CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPSHAPECHECKSUMFORCUSTOMLAYOUTS12 , CRecordRoundTripShapeCheckSumForCustomLayouts12Atom)
|
||||
//CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPNOTESMASTERTEXTSTYLES12 , CRecordRoundTripNotesMasterTextStyles12Atom)
|
||||
//CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPCUSTOMTABLESTYLES12 , CRecordRoundTripCustomTableStyles12Atom)
|
||||
|
||||
//CREATE_BY_TYPE(RECORD_TYPE_BOOKMARK_SEED_ATOM , CRecordBookmarkSeedAtom)
|
||||
|
||||
@ -182,7 +182,7 @@ public:
|
||||
return;
|
||||
|
||||
// возвращаем указатели, их не удалять наверху!!!!
|
||||
for (int nIndex = 0; nIndex < m_arRecords.size(); ++nIndex)
|
||||
for (size_t nIndex = 0; nIndex < m_arRecords.size(); ++nIndex)
|
||||
{
|
||||
T pRec = dynamic_cast<T>(m_arRecords[nIndex]);
|
||||
if (NULL != pRec)
|
||||
|
||||
@ -85,7 +85,6 @@ public:
|
||||
std::map<int, std::wstring>* m_mapFilePictures;
|
||||
nullable_base<NSPresentationEditor::CTextStyles> m_pStyles[9];
|
||||
|
||||
public:
|
||||
CSlideInfo()
|
||||
{
|
||||
}
|
||||
|
||||
@ -206,7 +206,7 @@ namespace Animations
|
||||
std::vector<std::wstring> arMovePath;
|
||||
boost::algorithm::split(arMovePath, MovePath, boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on);
|
||||
|
||||
for (int i = 0 ; i < arMovePath.size(); i++)
|
||||
for (size_t i = 0 ; i < arMovePath.size(); i++)
|
||||
{
|
||||
ActionPoint aPoint;
|
||||
aPoint.TYPE = arMovePath[i++][0];
|
||||
@ -245,7 +245,7 @@ namespace Animations
|
||||
{
|
||||
std::wstring MovePath;
|
||||
|
||||
for ( int i = 0; i < m_Points.size(); ++i )
|
||||
for ( size_t i = 0; i < m_Points.size(); ++i )
|
||||
{
|
||||
std::wstring NextPoint;
|
||||
|
||||
|
||||
@ -39,9 +39,7 @@ public:
|
||||
std::vector<SSlidePersist> m_arNotePersists;
|
||||
std::vector<SSlidePersist> m_arSlidePersists;
|
||||
|
||||
public:
|
||||
|
||||
CRecordDocument() : m_arMasterPersists(), m_arNotePersists(), m_arSlidePersists()
|
||||
CRecordDocument()
|
||||
{
|
||||
}
|
||||
|
||||
@ -52,84 +50,6 @@ public:
|
||||
m_arSlidePersists.clear();
|
||||
}
|
||||
|
||||
/*virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
|
||||
{
|
||||
m_oHeader = oHeader;
|
||||
|
||||
m_arMasterPersists.clear();
|
||||
m_arNotePersists.clear();
|
||||
m_arSlidePersists.clear();
|
||||
|
||||
m_arRecords.clear();
|
||||
|
||||
UINT lCurLen = 0;
|
||||
ULONG lReadLen = 0;
|
||||
SRecordHeader oRec;
|
||||
while (lCurLen < m_oHeader.RecLen)
|
||||
{
|
||||
pStream->Read(&oRec, sizeof(oRec), &lReadLen);
|
||||
if (0 >= lReadLen)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (RECORD_TYPE_SLIDELISTWITHTEXT == oRec.RecType)
|
||||
{
|
||||
CRecordSlideListWithText* pAtom = new CRecordSlideListWithText();
|
||||
pAtom->ReadFromStream(oRec, pStream);
|
||||
std::vector<SSlidePersist>* pArray = NULL;
|
||||
|
||||
switch (pAtom->m_Type)
|
||||
{
|
||||
case CRecordSlideListWithText::CollectionOfMasterSlides:
|
||||
{
|
||||
pArray = &m_arMasterPersists;
|
||||
break;
|
||||
}
|
||||
|
||||
case CRecordSlideListWithText::CollectionOfNotesSlides:
|
||||
{
|
||||
pArray = &m_arNotePersists;
|
||||
break;
|
||||
}
|
||||
|
||||
case CRecordSlideListWithText::CollectionOfSlides:
|
||||
{
|
||||
pArray = &m_arSlidePersists;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
// этого не может быть...
|
||||
lCurLen += (8 + oRec.RecLen);
|
||||
continue;
|
||||
}
|
||||
};
|
||||
|
||||
size_t nCountItems = pAtom->m_arSlides.size();
|
||||
for (size_t index = 0; index < nCountItems; ++index)
|
||||
{
|
||||
SSlidePersist oPersist;
|
||||
oPersist.m_nPsrRef = pAtom->m_arSlides[index]->m_nPsrRef;
|
||||
oPersist.m_nSlideID = pAtom->m_arSlides[index]->m_nSlideID;
|
||||
|
||||
oPersist.m_arTextAttrs += pAtom->m_arTextPlaceHolders[index];
|
||||
|
||||
pArray->Add(oPersist);
|
||||
}
|
||||
|
||||
delete pAtom;
|
||||
}
|
||||
else
|
||||
{
|
||||
IRecord* pRecord = CreateByType(oRec);
|
||||
pRecord->ReadFromStream(oRec, pStream);
|
||||
m_arRecords.Add(pRecord);
|
||||
}
|
||||
lCurLen += (8 + oRec.RecLen);
|
||||
}
|
||||
}*/
|
||||
|
||||
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
|
||||
{
|
||||
m_oHeader = oHeader;
|
||||
@ -145,31 +65,26 @@ public:
|
||||
std::vector<CRecordSlideListWithText*> oArraySlideWithText;
|
||||
this->GetRecordsByType(&oArraySlideWithText, true, false);
|
||||
|
||||
for (int nIndexList = 0; nIndexList < oArraySlideWithText.size(); ++nIndexList)
|
||||
for (size_t nIndexList = 0; nIndexList < oArraySlideWithText.size(); ++nIndexList)
|
||||
{
|
||||
CRecordSlideListWithText* pAtom = oArraySlideWithText[nIndexList];
|
||||
std::vector<SSlidePersist>* pArray = NULL;
|
||||
|
||||
switch (pAtom->m_Type)
|
||||
{
|
||||
case CRecordSlideListWithText::CollectionOfMasterSlides:
|
||||
case CRecordSlideListWithText::CollectionOfMasterSlides:
|
||||
{
|
||||
pArray = &m_arMasterPersists;
|
||||
break;
|
||||
}
|
||||
|
||||
case CRecordSlideListWithText::CollectionOfNotesSlides:
|
||||
pArray = &m_arMasterPersists;
|
||||
}break;
|
||||
case CRecordSlideListWithText::CollectionOfNotesSlides:
|
||||
{
|
||||
pArray = &m_arNotePersists;
|
||||
break;
|
||||
}
|
||||
|
||||
case CRecordSlideListWithText::CollectionOfSlides:
|
||||
pArray = &m_arNotePersists;
|
||||
}break;
|
||||
case CRecordSlideListWithText::CollectionOfSlides:
|
||||
{
|
||||
pArray = &m_arSlidePersists;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
pArray = &m_arSlidePersists;
|
||||
}break;
|
||||
default:
|
||||
{
|
||||
// этого не может быть...
|
||||
continue;
|
||||
|
||||
@ -53,7 +53,7 @@ public:
|
||||
pArray->clear();
|
||||
|
||||
std::map<DWORD, int> image_map;
|
||||
for (int nIndex = 0; nIndex < m_arRecords.size(); ++nIndex)
|
||||
for (size_t nIndex = 0; nIndex < m_arRecords.size(); ++nIndex)
|
||||
{
|
||||
CRecordBlipStoreEntry* pEntry = dynamic_cast<CRecordBlipStoreEntry*>(m_arRecords[nIndex]);
|
||||
if (NULL != pEntry)
|
||||
|
||||
@ -71,7 +71,7 @@ public:
|
||||
oArrayShapes[0]->bGroupShape = true;//тут описание самой группы
|
||||
|
||||
int nIndexBreak = -1;
|
||||
for (int nIndex = 0; nIndex < oArrayShapes.size(); ++nIndex)
|
||||
for (size_t nIndex = 0; nIndex < oArrayShapes.size(); ++nIndex)
|
||||
{
|
||||
std::vector<CRecordGroupShape*> oArrayGroupShapes;
|
||||
oArrayShapes[nIndex]->GetRecordsByType(&oArrayGroupShapes, false, true);
|
||||
@ -120,7 +120,7 @@ public:
|
||||
bool bIsRecalc = ((lW1 > 0) && (lH1 > 0) && (lW2 > 0) && (lH2 > 0));
|
||||
if (bIsRecalc)
|
||||
{
|
||||
for (int nIndex = 0; nIndex < oArrayShapes.size(); ++nIndex)
|
||||
for (size_t nIndex = 0; nIndex < oArrayShapes.size(); ++nIndex)
|
||||
{
|
||||
if (nIndex != nIndexBreak)
|
||||
{
|
||||
|
||||
@ -575,212 +575,134 @@ public:
|
||||
}
|
||||
// line --------------------------------------------------------
|
||||
case lineBoolean: //Line Style Boolean Properties
|
||||
{
|
||||
bool bNoLineDrawDash = GETBIT(pProperty->m_lValue, 0);
|
||||
bool bLineFillShape = GETBIT(pProperty->m_lValue, 1);
|
||||
bool bHitTestLine = GETBIT(pProperty->m_lValue, 2);
|
||||
bool bLine = GETBIT(pProperty->m_lValue, 3);
|
||||
bool bArrowheadsOK = GETBIT(pProperty->m_lValue, 4);
|
||||
bool bInsetPenOK = GETBIT(pProperty->m_lValue, 5);
|
||||
bool bInsetPen = GETBIT(pProperty->m_lValue, 6);
|
||||
bool bLineOpaqueBackColor = GETBIT(pProperty->m_lValue, 9);
|
||||
{
|
||||
bool bNoLineDrawDash = GETBIT(pProperty->m_lValue, 0);
|
||||
bool bLineFillShape = GETBIT(pProperty->m_lValue, 1);
|
||||
bool bHitTestLine = GETBIT(pProperty->m_lValue, 2);
|
||||
bool bLine = GETBIT(pProperty->m_lValue, 3);
|
||||
bool bArrowheadsOK = GETBIT(pProperty->m_lValue, 4);
|
||||
bool bInsetPenOK = GETBIT(pProperty->m_lValue, 5);
|
||||
bool bInsetPen = GETBIT(pProperty->m_lValue, 6);
|
||||
bool bLineOpaqueBackColor = GETBIT(pProperty->m_lValue, 9);
|
||||
|
||||
bool bUsefNoLineDrawDash = GETBIT(pProperty->m_lValue, 16);
|
||||
bool bUsefLineFillShape = GETBIT(pProperty->m_lValue, 17);
|
||||
bool bUsefHitTestLine = GETBIT(pProperty->m_lValue, 18);
|
||||
bool bUsefLine = GETBIT(pProperty->m_lValue, 19);
|
||||
bool bUsefArrowheadsOK = GETBIT(pProperty->m_lValue, 20);
|
||||
bool bUsefInsetPenOK = GETBIT(pProperty->m_lValue, 21);
|
||||
bool bUsefInsetPen = GETBIT(pProperty->m_lValue, 22);
|
||||
bool bUsefLineOpaqueBackColor = GETBIT(pProperty->m_lValue, 25);
|
||||
bool bUsefNoLineDrawDash = GETBIT(pProperty->m_lValue, 16);
|
||||
bool bUsefLineFillShape = GETBIT(pProperty->m_lValue, 17);
|
||||
bool bUsefHitTestLine = GETBIT(pProperty->m_lValue, 18);
|
||||
bool bUsefLine = GETBIT(pProperty->m_lValue, 19);
|
||||
bool bUsefArrowheadsOK = GETBIT(pProperty->m_lValue, 20);
|
||||
bool bUsefInsetPenOK = GETBIT(pProperty->m_lValue, 21);
|
||||
bool bUsefInsetPen = GETBIT(pProperty->m_lValue, 22);
|
||||
bool bUsefLineOpaqueBackColor = GETBIT(pProperty->m_lValue, 25);
|
||||
|
||||
if (bUsefLine)
|
||||
pElement->m_bLine = bLine;
|
||||
}break;
|
||||
case lineStyle:
|
||||
if (bUsefLine)
|
||||
pElement->m_bLine = bLine;
|
||||
}break;
|
||||
case lineDashStyle://from Complex
|
||||
{
|
||||
pElement->m_bLine = true;
|
||||
}break;
|
||||
{
|
||||
pElement->m_bLine = true;
|
||||
}break;
|
||||
case lineColor:
|
||||
{
|
||||
SColorAtom oAtom;
|
||||
oAtom.FromValue(pProperty->m_lValue);
|
||||
|
||||
if (oAtom.bSysIndex)
|
||||
pElement->m_oPen.Color = CorrectSysColor(pProperty->m_lValue, pElement, pTheme);
|
||||
else
|
||||
oAtom.ToColor(&pElement->m_oPen.Color);
|
||||
break;
|
||||
}
|
||||
{
|
||||
SColorAtom oAtom;
|
||||
oAtom.FromValue(pProperty->m_lValue);
|
||||
|
||||
if (oAtom.bSysIndex)
|
||||
pElement->m_oPen.Color = CorrectSysColor(pProperty->m_lValue, pElement, pTheme);
|
||||
else
|
||||
oAtom.ToColor(&pElement->m_oPen.Color);
|
||||
}break;
|
||||
case lineOpacity:
|
||||
{
|
||||
pElement->m_oPen.Alpha = (BYTE)(std::min)(255, (int)CDirectory::NormFixedPoint(pProperty->m_lValue, 255));
|
||||
break;
|
||||
}
|
||||
{
|
||||
pElement->m_oPen.Alpha = (BYTE)(std::min)(255, (int)CDirectory::NormFixedPoint(pProperty->m_lValue, 255));
|
||||
}break;
|
||||
case lineBackColor:
|
||||
{
|
||||
SColorAtom oAtom;
|
||||
oAtom.FromValue(pProperty->m_lValue);
|
||||
|
||||
if (oAtom.bSysIndex)
|
||||
pElement->m_oPen.Color2 = CorrectSysColor(pProperty->m_lValue, pElement, pTheme);
|
||||
else
|
||||
oAtom.ToColor(&pElement->m_oPen.Color2);
|
||||
{
|
||||
SColorAtom oAtom;
|
||||
oAtom.FromValue(pProperty->m_lValue);
|
||||
|
||||
if (oAtom.bSysIndex)
|
||||
pElement->m_oPen.Color2 = CorrectSysColor(pProperty->m_lValue, pElement, pTheme);
|
||||
else
|
||||
oAtom.ToColor(&pElement->m_oPen.Color2);
|
||||
|
||||
}break;
|
||||
}break;
|
||||
case lineWidth:
|
||||
{
|
||||
pElement->m_oPen.Size = (double)pProperty->m_lValue / EMU_MM;
|
||||
pElement->m_bLine = true;
|
||||
break;
|
||||
}
|
||||
{
|
||||
pElement->m_oPen.Size = (double)pProperty->m_lValue / EMU_MM;
|
||||
pElement->m_bLine = true;
|
||||
}break;
|
||||
case lineStyle:
|
||||
{
|
||||
pElement->m_bLine = true;
|
||||
pElement->m_oPen.LineStyle = pProperty->m_lValue;
|
||||
}break;
|
||||
case lineDashing:
|
||||
{
|
||||
BYTE nDashStyle = 0;
|
||||
switch (pProperty->m_lValue)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
nDashStyle = 0; // solid
|
||||
}break;
|
||||
case 1:
|
||||
case 6:
|
||||
case 7:
|
||||
{
|
||||
nDashStyle = 1; // dash
|
||||
}break;
|
||||
case 2:
|
||||
case 5:
|
||||
{
|
||||
nDashStyle = 2; // dot
|
||||
}break;
|
||||
case 3:
|
||||
case 8:
|
||||
case 9:
|
||||
{
|
||||
nDashStyle = 3; // dashdot
|
||||
}break;
|
||||
case 4:
|
||||
case 10:
|
||||
{
|
||||
nDashStyle = 4;// dashdotdot
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
pElement->m_bLine = true;
|
||||
pElement->m_oPen.DashStyle = nDashStyle;
|
||||
break;
|
||||
}
|
||||
{
|
||||
pElement->m_bLine = true;
|
||||
pElement->m_oPen.DashStyle = pProperty->m_lValue;
|
||||
}break;
|
||||
case lineJoinStyle:
|
||||
{
|
||||
BYTE nLineJoin = 2;
|
||||
switch (pProperty->m_lValue)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
nLineJoin = 1; // bevel
|
||||
}break;
|
||||
case 1:
|
||||
{
|
||||
nLineJoin = 1; // Miter
|
||||
}break;
|
||||
case 2:
|
||||
{
|
||||
nLineJoin = 2; // round
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
||||
pElement->m_oPen.LineJoin = nLineJoin;
|
||||
break;
|
||||
}
|
||||
{
|
||||
pElement->m_oPen.LineJoin = pProperty->m_lValue;
|
||||
}break;
|
||||
case lineStartArrowLength:
|
||||
{
|
||||
pElement->m_oPen.LineStartLength = pProperty->m_lValue;
|
||||
}break;
|
||||
case lineEndArrowLength:
|
||||
{
|
||||
pElement->m_oPen.LineEndLength = pProperty->m_lValue;
|
||||
}break;
|
||||
case lineStartArrowWidth:
|
||||
{
|
||||
pElement->m_oPen.LineStartWidth = pProperty->m_lValue;
|
||||
}break;
|
||||
case lineEndArrowWidth:
|
||||
{
|
||||
pElement->m_oPen.LineEndWidth = pProperty->m_lValue;
|
||||
}break;
|
||||
case lineStartArrowhead:
|
||||
{
|
||||
BYTE nStartCap = 0;
|
||||
switch (pProperty->m_lValue)
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
case 5:
|
||||
{
|
||||
nStartCap = 0x14;
|
||||
}break;
|
||||
case 3:
|
||||
case 4:
|
||||
|
||||
{
|
||||
nStartCap = 2;
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
||||
pElement->m_oPen.LineStartCap = nStartCap;
|
||||
|
||||
break;
|
||||
}
|
||||
{
|
||||
pElement->m_oPen.LineStartCap = pProperty->m_lValue;
|
||||
}break;
|
||||
case lineEndArrowhead:
|
||||
{
|
||||
BYTE nEndCap = 0;
|
||||
switch (pProperty->m_lValue)
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
case 5:
|
||||
{
|
||||
nEndCap = 0x14;
|
||||
}break;
|
||||
case 3:
|
||||
case 4:
|
||||
|
||||
{
|
||||
nEndCap = 2;
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
||||
pElement->m_oPen.LineEndCap = nEndCap;
|
||||
break;
|
||||
}
|
||||
{
|
||||
pElement->m_oPen.LineEndCap = pProperty->m_lValue;
|
||||
}break;
|
||||
case shadowType:
|
||||
{
|
||||
pElement->m_oShadow.Type = pProperty->m_lValue;
|
||||
|
||||
}break;
|
||||
{
|
||||
pElement->m_oShadow.Type = pProperty->m_lValue;
|
||||
}break;
|
||||
case shadowOriginX://in emu, relative from center shape
|
||||
{
|
||||
pElement->m_oShadow.OriginX = FixedPointToDouble(pProperty->m_lValue);
|
||||
}break;
|
||||
{
|
||||
pElement->m_oShadow.OriginX = FixedPointToDouble(pProperty->m_lValue);
|
||||
}break;
|
||||
case shadowOriginY:
|
||||
{
|
||||
pElement->m_oShadow.OriginY = FixedPointToDouble(pProperty->m_lValue);
|
||||
}break;
|
||||
{
|
||||
pElement->m_oShadow.OriginY = FixedPointToDouble(pProperty->m_lValue);
|
||||
}break;
|
||||
case shadowColor:
|
||||
{
|
||||
SColorAtom oAtom;
|
||||
oAtom.FromValue(pProperty->m_lValue);
|
||||
{
|
||||
SColorAtom oAtom;
|
||||
oAtom.FromValue(pProperty->m_lValue);
|
||||
|
||||
if (oAtom.bSysIndex)
|
||||
pElement->m_oShadow.Color = CorrectSysColor(pProperty->m_lValue, pElement, pTheme);
|
||||
else
|
||||
oAtom.ToColor(&pElement->m_oShadow.Color);
|
||||
if (oAtom.bSysIndex)
|
||||
pElement->m_oShadow.Color = CorrectSysColor(pProperty->m_lValue, pElement, pTheme);
|
||||
else
|
||||
oAtom.ToColor(&pElement->m_oShadow.Color);
|
||||
|
||||
}break;
|
||||
}break;
|
||||
case shadowWeight:
|
||||
{
|
||||
}break;
|
||||
case shadowOpacity:
|
||||
{
|
||||
pElement->m_oShadow.Alpha = (BYTE)(std::min)(255, (int)CDirectory::NormFixedPoint(pProperty->m_lValue, 255));
|
||||
}break;
|
||||
{
|
||||
pElement->m_oShadow.Alpha = (BYTE)(std::min)(255, (int)CDirectory::NormFixedPoint(pProperty->m_lValue, 255));
|
||||
}break;
|
||||
case shadowHighlight:
|
||||
{
|
||||
//оттенок двойной тени
|
||||
}break;
|
||||
{
|
||||
//оттенок двойной тени
|
||||
}break;
|
||||
case shadowOffsetX:
|
||||
{
|
||||
pElement->m_oShadow.DistanceX = ((int)pProperty->m_lValue) / EMU_MM;
|
||||
@ -949,65 +871,80 @@ public:
|
||||
|
||||
switch (pProperty->m_ePID)
|
||||
{
|
||||
// здесь просто применяем проперти...
|
||||
// geometry ----------------------------------------------------
|
||||
// top, left, right, bottom logic
|
||||
case NSOfficeDrawing::metroBlob:
|
||||
{
|
||||
//альтернатива в формате oox
|
||||
//NSFile::CFileBinary f;
|
||||
//f.CreateFileW(L"d:\\test.zip");
|
||||
//f.WriteFile(pProperty->m_pOptions, pProperty->m_lValue);
|
||||
//f.CloseFile();
|
||||
}break;
|
||||
{
|
||||
//альтернатива в формате oox
|
||||
//NSFile::CFileBinary f;
|
||||
//f.CreateFileW(L"d:\\test.zip");
|
||||
//f.WriteFile(pProperty->m_pOptions, pProperty->m_lValue);
|
||||
//f.CloseFile();
|
||||
}break;
|
||||
case NSOfficeDrawing::geoRight:
|
||||
{
|
||||
if (0 < pProperty->m_lValue)
|
||||
pParentShape->m_dWidthLogic = (double)(pProperty->m_lValue);
|
||||
}break;
|
||||
{
|
||||
if (0 < pProperty->m_lValue)
|
||||
pParentShape->m_dWidthLogic = (double)(pProperty->m_lValue);
|
||||
}break;
|
||||
case NSOfficeDrawing::geoBottom:
|
||||
{
|
||||
if (0 < pProperty->m_lValue)
|
||||
pParentShape->m_dHeightLogic = (double)(pProperty->m_lValue);
|
||||
}break;
|
||||
// shapePath
|
||||
{
|
||||
if (0 < pProperty->m_lValue)
|
||||
pParentShape->m_dHeightLogic = (double)(pProperty->m_lValue);
|
||||
}break;
|
||||
case NSOfficeDrawing::shapePath:
|
||||
{
|
||||
pShape->m_oCustomVML.SetPath((RulesType)pProperty->m_lValue);
|
||||
pShape->m_bCustomShape = true;
|
||||
}break;
|
||||
// segmentsInfo
|
||||
{
|
||||
pShape->m_oCustomVML.SetPath((RulesType)pProperty->m_lValue);
|
||||
pShape->m_bCustomShape = true;
|
||||
}break;
|
||||
case NSOfficeDrawing::pSegmentInfo:
|
||||
{
|
||||
if (pProperty->m_bComplex)
|
||||
{
|
||||
if (pProperty->m_bComplex)
|
||||
{
|
||||
pShape->m_oCustomVML.LoadSegments(pProperty);
|
||||
pShape->m_bCustomShape = true;
|
||||
}
|
||||
}break;
|
||||
// verticesInfo
|
||||
pShape->m_oCustomVML.LoadSegments(pProperty);
|
||||
pShape->m_bCustomShape = true;
|
||||
}
|
||||
}break;
|
||||
case NSOfficeDrawing::pVertices:
|
||||
{
|
||||
if (pProperty->m_bComplex)
|
||||
{
|
||||
if (pProperty->m_bComplex)
|
||||
{
|
||||
pShape->m_oCustomVML.LoadVertices(pProperty);
|
||||
pShape->m_bCustomShape = true;
|
||||
}
|
||||
}break;
|
||||
pShape->m_oCustomVML.LoadVertices(pProperty);
|
||||
pShape->m_bCustomShape = true;
|
||||
}
|
||||
}break;
|
||||
case NSOfficeDrawing::pConnectionSites:
|
||||
{
|
||||
if (pProperty->m_bComplex)
|
||||
{
|
||||
pShape->m_oCustomVML.LoadConnectionSites(pProperty);
|
||||
}
|
||||
}break;
|
||||
case NSOfficeDrawing::pConnectionSitesDir:
|
||||
{
|
||||
if (pProperty->m_bComplex)
|
||||
{
|
||||
pShape->m_oCustomVML.LoadConnectionSitesDir(pProperty);
|
||||
}
|
||||
}break;
|
||||
case NSOfficeDrawing::pGuides:
|
||||
{
|
||||
if (pProperty->m_bComplex/* && pShape->m_eType != sptNotchedCircularArrow*/)
|
||||
{//Тікбұрышты үшбұрыштарды.ppt - slide 25
|
||||
pShape->m_oCustomVML.LoadGuides(pProperty);
|
||||
}
|
||||
}break;
|
||||
case NSOfficeDrawing::pInscribe:
|
||||
{
|
||||
if (pProperty->m_bComplex)
|
||||
{
|
||||
if (pProperty->m_bComplex && pShape->m_eType != sptNotchedCircularArrow)
|
||||
{//Тікбұрышты үшбұрыштарды.ppt - slide 25
|
||||
pShape->m_oCustomVML.LoadGuides(pProperty);
|
||||
}
|
||||
}break;
|
||||
pShape->m_oCustomVML.LoadInscribe(pProperty);
|
||||
}
|
||||
}break;
|
||||
case NSOfficeDrawing::pAdjustHandles:
|
||||
{
|
||||
if (pProperty->m_bComplex)
|
||||
{
|
||||
if (pProperty->m_bComplex)
|
||||
{
|
||||
pShape->m_oCustomVML.LoadAHs(pProperty);
|
||||
}
|
||||
}break;
|
||||
pShape->m_oCustomVML.LoadAHs(pProperty);
|
||||
}
|
||||
}break;
|
||||
case NSOfficeDrawing::adjustValue:
|
||||
case NSOfficeDrawing::adjust2Value:
|
||||
case NSOfficeDrawing::adjust3Value:
|
||||
@ -1890,7 +1827,7 @@ protected:
|
||||
|
||||
if (master_levels)
|
||||
{
|
||||
for (int i = 0; i < pText->m_arParagraphs.size(); i++)
|
||||
for (size_t i = 0; i < pText->m_arParagraphs.size(); i++)
|
||||
{
|
||||
if (i >= master_levels->m_arrProps.size()) break;
|
||||
|
||||
@ -2198,7 +2135,7 @@ protected:
|
||||
pTextSettings->m_oStyles.ApplyAfter(pThemeWrapper->m_pStyles[nIndexType].get());
|
||||
}
|
||||
}
|
||||
if (eTypeOwn != NSOfficePPT::NoPresent && eTypeOwn != NSOfficePPT::Other && eTypeOwn != eTypePersist && eTypeOwn != eTypeMaster)
|
||||
if (eTypeOwn != NSOfficePPT::NoPresent/* && eTypeOwn != NSOfficePPT::Other*/ && eTypeOwn != eTypePersist && eTypeOwn != eTypeMaster)
|
||||
{
|
||||
int nIndexType = (int)eTypeOwn;
|
||||
|
||||
|
||||
@ -198,7 +198,7 @@ public:
|
||||
{
|
||||
CRecordsContainer::ReadFromStream(oHeader, pStream);
|
||||
|
||||
for (int i = 0 ; i < m_arRecords.size(); i++)
|
||||
for (size_t i = 0 ; i < m_arRecords.size(); i++)
|
||||
{
|
||||
switch(m_arRecords[i]->m_oHeader.RecType)
|
||||
{
|
||||
|
||||
@ -34,13 +34,12 @@
|
||||
|
||||
class CRecordNotesAtom : public CUnknownRecord
|
||||
{
|
||||
public:
|
||||
UINT m_nSlideIDRef;
|
||||
|
||||
bool m_bMasterObjects;
|
||||
bool m_bMasterScheme;
|
||||
bool m_bMasterBackground;
|
||||
|
||||
public:
|
||||
|
||||
CRecordNotesAtom()
|
||||
{
|
||||
@ -54,11 +53,11 @@ public:
|
||||
{
|
||||
m_oHeader = oHeader;
|
||||
|
||||
m_nSlideIDRef = (UINT)StreamUtils::ReadDWORD(pStream);
|
||||
m_nSlideIDRef = (UINT)StreamUtils::ReadDWORD(pStream);
|
||||
|
||||
USHORT nFlag = StreamUtils::ReadWORD(pStream);
|
||||
m_bMasterObjects = ((nFlag & 0x01) == 0x01);
|
||||
m_bMasterScheme = ((nFlag & 0x02) == 0x02);
|
||||
USHORT nFlag = StreamUtils::ReadWORD(pStream);
|
||||
m_bMasterObjects = ((nFlag & 0x01) == 0x01);
|
||||
m_bMasterScheme = ((nFlag & 0x02) == 0x02);
|
||||
m_bMasterBackground = ((nFlag & 0x04) == 0x04);
|
||||
|
||||
StreamUtils::StreamSkip(2, pStream);
|
||||
|
||||
@ -91,6 +91,7 @@
|
||||
#include "RoundTripColorMappingAtom.h"
|
||||
#include "RoundTripNewPlaceholderId12Atom.h"
|
||||
#include "RoundTripThemeAtom.h"
|
||||
#include "RoundTripNotesMasterTextStyles12Atom.h"
|
||||
#include "TextRulerAtom.h"
|
||||
#include "ShapeFlags10Atom.h"
|
||||
#include "ShapeFlagsAtom.h"
|
||||
|
||||
@ -34,9 +34,8 @@
|
||||
|
||||
class CRecordRoundTripColorMappingAtom : public CUnknownRecord
|
||||
{
|
||||
std::wstring m_pString;
|
||||
|
||||
public:
|
||||
std::string m_strData;
|
||||
|
||||
CRecordRoundTripColorMappingAtom()
|
||||
{
|
||||
@ -48,6 +47,7 @@ public:
|
||||
|
||||
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
|
||||
{
|
||||
return CUnknownRecord::ReadFromStream(oHeader, pStream);
|
||||
m_oHeader = oHeader;
|
||||
m_strData = StreamUtils::ReadStringA(pStream, (long)m_oHeader.RecLen);
|
||||
}
|
||||
};
|
||||
|
||||
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* (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 "../Reader/Records.h"
|
||||
|
||||
class CRecordRoundTripNotesMasterTextStyles12Atom : public CUnknownRecord
|
||||
{
|
||||
public:
|
||||
std::string m_strData;
|
||||
|
||||
CRecordRoundTripNotesMasterTextStyles12Atom()
|
||||
{
|
||||
}
|
||||
|
||||
~CRecordRoundTripNotesMasterTextStyles12Atom()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
|
||||
{
|
||||
m_oHeader = oHeader;
|
||||
m_strData = StreamUtils::ReadStringA(pStream, (long)m_oHeader.RecLen);
|
||||
}
|
||||
};
|
||||
@ -34,9 +34,8 @@
|
||||
|
||||
class CRecordRoundTripThemeAtom : public CUnknownRecord
|
||||
{
|
||||
std::wstring m_strData;
|
||||
|
||||
public:
|
||||
std::string m_strData;
|
||||
|
||||
CRecordRoundTripThemeAtom()
|
||||
{
|
||||
@ -48,6 +47,7 @@ public:
|
||||
|
||||
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
|
||||
{
|
||||
return CUnknownRecord::ReadFromStream(oHeader, pStream);
|
||||
m_oHeader = oHeader;
|
||||
m_strData = StreamUtils::ReadStringA(pStream, (long)m_oHeader.RecLen);
|
||||
}
|
||||
};
|
||||
|
||||
@ -129,7 +129,7 @@ public:
|
||||
|
||||
bool IsSlide()
|
||||
{
|
||||
for (int nIndex = 0; nIndex < m_arRecords.size(); ++nIndex)
|
||||
for (size_t nIndex = 0; nIndex < m_arRecords.size(); ++nIndex)
|
||||
{
|
||||
if ((RECORD_TYPE_SLIDE == m_arRecords[nIndex]->m_oHeader.RecType) ||
|
||||
(RECORD_TYPE_MAINMASTER == m_arRecords[nIndex]->m_oHeader.RecType) ||
|
||||
|
||||
@ -59,7 +59,7 @@ public:
|
||||
{
|
||||
pStream->read(pUTF16_low, m_oHeader.RecLen);
|
||||
|
||||
for (int i = 0 ; i < m_oHeader.RecLen; i++)
|
||||
for (UINT i = 0 ; i < m_oHeader.RecLen; i++)
|
||||
{
|
||||
pUTF16[i] = pUTF16_low[i];
|
||||
}
|
||||
|
||||
@ -86,11 +86,12 @@ public:
|
||||
|
||||
int pos_text = 0, pos_si = 0;
|
||||
int ind = 0;
|
||||
for (int i = 0; i < pText->m_arParagraphs.size(); i++)
|
||||
|
||||
for (size_t i = 0; i < pText->m_arParagraphs.size(); i++)
|
||||
{
|
||||
if (ind >= m_arrSIs.size()) break;
|
||||
|
||||
for (int j = 0 ; j < pText->m_arParagraphs[i].m_arSpans.size(); j++)
|
||||
for (size_t j = 0 ; j < pText->m_arParagraphs[i].m_arSpans.size(); j++)
|
||||
{
|
||||
if (pos_text + pText->m_arParagraphs[i].m_arSpans[j].m_strText.length() > pos_si + m_arrSIs[ind].lCount )
|
||||
{
|
||||
|
||||
@ -462,10 +462,6 @@
|
||||
RelativePath="..\Reader\ClassesAtom.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\ASCPresentationEditor\OfficeDrawing\Document.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Reader\PPTDocumentInfo.h"
|
||||
>
|
||||
@ -1030,6 +1026,26 @@
|
||||
RelativePath="..\..\..\ASCOfficePPTXFile\Editor\Drawing\XmlWriter.h"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="ppt shapes"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\..\ASCOfficePPTXFile\Editor\Drawing\Shapes\BaseShape\PPTShape\customgeomshape.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\ASCOfficePPTXFile\Editor\Drawing\Shapes\BaseShape\PPTShape\elementsettings.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\ASCOfficePPTXFile\Editor\Drawing\Shapes\BaseShape\PPTShape\formula.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\ASCOfficePPTXFile\Editor\Drawing\Shapes\BaseShape\PPTShape\PPTShape.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="OOXWriter"
|
||||
|
||||
@ -31,22 +31,30 @@
|
||||
*/
|
||||
// PptFormatTest.cpp : Defines the entry point for the console application.
|
||||
//
|
||||
#include "../../PPTFormatLib/PPTFormatLib.h"
|
||||
#include "../../../OfficeUtils/src/OfficeUtils.h"
|
||||
#include "../PPTFormatLib/PPTFormatLib.h"
|
||||
#include "../../OfficeUtils/src/OfficeUtils.h"
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h"
|
||||
#include "../../DesktopEditor/common/Directory.h"
|
||||
|
||||
#include <tchar.h>
|
||||
|
||||
#if defined(_WIN64)
|
||||
#pragma comment(lib, "../../build/bin/icu/win_64/icuuc.lib")
|
||||
#elif defined (_WIN32)
|
||||
#pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib")
|
||||
#endif
|
||||
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
{
|
||||
if (argc < 2) return 1;
|
||||
|
||||
std::wstring sSrcPpt = argv[1];
|
||||
std::wstring sDstPptx = argc > 2 ? argv[2] : sSrcDoc + L"-my.pptx";
|
||||
std::wstring sDstPptx = argc > 2 ? argv[2] : sSrcPpt + L"-my.pptx";
|
||||
|
||||
std::wstring outputDir = FileSystem::Directory::GetFolderPath(sDstPptx);
|
||||
std::wstring dstTempPath = FileSystem::Directory::CreateDirectoryWithUniqueName(outputDir);
|
||||
std::wstring outputDir = NSDirectory::GetFolderPath(sDstPptx);
|
||||
std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
|
||||
|
||||
std::wstring tempPath = FileSystem::Directory::CreateDirectoryWithUniqueName(outputDir);
|
||||
std::wstring tempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
|
||||
|
||||
COfficePPTFile pptFile;
|
||||
|
||||
@ -60,8 +68,8 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
hRes = oCOfficeUtils.CompressFileOrDirectory(dstTempPath.c_str(), sDstPptx, -1);
|
||||
}
|
||||
|
||||
FileSystem::Directory::DeleteDirectory(dstTempPath);
|
||||
FileSystem::Directory::DeleteDirectory(tempPath);
|
||||
NSDirectory::DeleteDirectory(dstTempPath);
|
||||
NSDirectory::DeleteDirectory(tempPath);
|
||||
|
||||
return hRes;
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\Common\OfficeDrawing;"..\..\DesktopEditor\freetype-2.5.2\include";..\..\Common\OfficeDrawing\Shapes"
|
||||
PreprocessorDefinitions="_DEBUG;_CONSOLE;USE_ATL_CSTRINGS;_USE_MATH_DEFINES;PPTX_DEF;PPT_DEF;ENABLE_PPT_TO_PPTX_CONVERT;PPT_FORMAT;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;_PRESENTATION_WRITER_;_SVG_CONVERT_TO_IMAGE_"
|
||||
PreprocessorDefinitions="_DEBUG;_CONSOLE;USE_ATL_CSTRINGS;_USE_MATH_DEFINES;PPTX_DEF;PPT_DEF;ENABLE_PPT_TO_PPTX_CONVERT;PPT_FORMAT;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;_PRESENTATION_WRITER_;_SVG_CONVERT_TO_IMAGE_;DONT_WRITE_EMBEDDED_FONTS"
|
||||
MinimalRebuild="false"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
@ -340,14 +340,34 @@
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="..\..\ASCOfficeDocxFile2\BinWriter\BinWriters.cpp"
|
||||
<Filter
|
||||
Name="common"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\build\bin\icu\win_32\icuuc.lib"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ASCOfficeDocxFile2\BinWriter\BinWriters.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Common\OfficeFileFormatChecker2.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ASCOfficeDocxFile2\BinReader\Readers.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\UnicodeConverter\UnicodeConverter.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\DesktopEditor\xml\src\xmldom.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\DesktopEditor\xml\src\xmllight.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath="PptFormatTest.cpp"
|
||||
>
|
||||
|
||||
@ -478,10 +478,17 @@ namespace NSPresentationEditor
|
||||
long Alpha;
|
||||
double Size;
|
||||
|
||||
BYTE DashStyle;
|
||||
BYTE LineStartCap;
|
||||
BYTE LineEndCap;
|
||||
BYTE LineJoin;
|
||||
unsigned char DashStyle;
|
||||
unsigned char LineStyle;
|
||||
unsigned char LineJoin;
|
||||
|
||||
unsigned char LineEndCap;
|
||||
unsigned char LineEndLength;
|
||||
unsigned char LineEndWidth;
|
||||
|
||||
unsigned char LineStartCap;
|
||||
unsigned char LineStartLength;
|
||||
unsigned char LineStartWidth;
|
||||
|
||||
double* DashPattern;
|
||||
long Count;
|
||||
@ -492,9 +499,8 @@ namespace NSPresentationEditor
|
||||
double MiterLimit;
|
||||
|
||||
CColor Color2; //backLine
|
||||
public:
|
||||
|
||||
void GetDashPattern(double* arrDashPattern, long& nCount) const
|
||||
void GetDashPattern(double* arrDashPattern, long& nCount) const
|
||||
{
|
||||
if (nCount == Count)
|
||||
{
|
||||
@ -579,10 +585,16 @@ namespace NSPresentationEditor
|
||||
Alpha = 255;
|
||||
Size = 0.26458;
|
||||
|
||||
DashStyle = 0;
|
||||
LineStartCap = 0;
|
||||
LineEndCap = 0;
|
||||
LineJoin = 0;
|
||||
LineStyle = 0; //single(Simple)
|
||||
DashStyle = 0; //Solid
|
||||
LineJoin = 2; //round
|
||||
|
||||
LineStartCap = 0;
|
||||
LineEndCap = 0;
|
||||
LineEndLength = 1; //med
|
||||
LineStartLength = 1;
|
||||
LineEndWidth = 1;
|
||||
LineStartWidth = 1;
|
||||
|
||||
DashPattern = NULL;
|
||||
Count = 0;
|
||||
|
||||
@ -41,82 +41,59 @@ namespace NSPresentationEditor
|
||||
public:
|
||||
std::vector<CTheme> m_arThemes;
|
||||
std::vector<CSlide*> m_arSlides;
|
||||
std::vector<CSlide*> m_arNotes;
|
||||
|
||||
CTheme* m_pNotesMaster;
|
||||
CTheme* m_pHandoutMaster;
|
||||
|
||||
CMetricInfo m_oInfo;
|
||||
|
||||
public:
|
||||
|
||||
CDocument() : m_arThemes(), m_arSlides()
|
||||
{
|
||||
m_pHandoutMaster = NULL;
|
||||
m_pNotesMaster = NULL;
|
||||
}
|
||||
|
||||
~CDocument()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
CDocument& operator=(const CDocument& oSrc)
|
||||
{
|
||||
m_arThemes = oSrc.m_arThemes;
|
||||
m_arSlides = oSrc.m_arSlides;
|
||||
|
||||
m_oInfo = oSrc.m_oInfo;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
CDocument(const CDocument& oSrc)
|
||||
{
|
||||
*this = oSrc;
|
||||
}
|
||||
|
||||
public:
|
||||
inline void Clear()
|
||||
{
|
||||
ClearThemes();
|
||||
m_arThemes.clear();
|
||||
try
|
||||
{
|
||||
ClearSlides();
|
||||
ClearNotes();
|
||||
|
||||
RELEASEOBJECT(m_pHandoutMaster);
|
||||
RELEASEOBJECT(m_pNotesMaster);
|
||||
}catch(...)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// работа с темами
|
||||
inline void ClearThemes()
|
||||
{
|
||||
m_arThemes.clear();
|
||||
}
|
||||
inline void AddTheme(const CTheme& oTheme)
|
||||
{
|
||||
m_arThemes.push_back(oTheme);
|
||||
}
|
||||
inline void UpdateTheme(size_t nIndex, const CTheme& oTheme)
|
||||
{
|
||||
if (nIndex >= m_arThemes.size())
|
||||
return;
|
||||
|
||||
m_arThemes[nIndex] = oTheme;
|
||||
}
|
||||
// работа со слайдом
|
||||
inline void ClearSlides()
|
||||
{
|
||||
for (int i = 0 ; i < m_arSlides.size(); i++)
|
||||
for (size_t i = 0 ; i < m_arSlides.size(); i++)
|
||||
{
|
||||
RELEASEOBJECT(m_arSlides[i]);
|
||||
}
|
||||
m_arSlides.clear();
|
||||
}
|
||||
inline void AddSlide(CSlide* oSlide)
|
||||
inline void ClearNotes()
|
||||
{
|
||||
m_arSlides.push_back(oSlide);
|
||||
for (size_t i = 0 ; i < m_arNotes.size(); i++)
|
||||
{
|
||||
RELEASEOBJECT(m_arNotes[i]);
|
||||
}
|
||||
m_arNotes.clear();
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// функция производит расчет по теме и слайдам
|
||||
std::wstring GetXmlSlideTransition ( CSlide& oSlide/*, CAudioOverlay& oAudioOverlay*/ )
|
||||
#if defined (_DEBUG)
|
||||
std::wstring GetXmlSlideTransition ( CSlide& oSlide/*, CAudioOverlay& oAudioOverlay*/ )
|
||||
{
|
||||
std::wstring Source = std::wstring ( _T("") );
|
||||
std::wstring Source = std::wstring ( _T("") );
|
||||
|
||||
int EffectID = 1;
|
||||
int lEffectDirection = oSlide.m_oSlideShow.m_oTransition.m_nEffectDirection;
|
||||
@ -314,7 +291,7 @@ namespace NSPresentationEditor
|
||||
break;
|
||||
}
|
||||
|
||||
Source = L"<VideoCompose Time=\"" + std::to_wstring(oSlide.m_oSlideShow.m_oTransition.m_dSpeed) + L"\" effectid=\"" + std::to_wstring(EffectID) + L"\"/>";
|
||||
Source = L"<VideoCompose Time=\"" + std::to_wstring(oSlide.m_oSlideShow.m_oTransition.m_dSpeed) + L"\" effectid=\"" + std::to_wstring(EffectID) + L"\"/>";
|
||||
|
||||
/*
|
||||
|
||||
@ -338,7 +315,7 @@ namespace NSPresentationEditor
|
||||
|
||||
return Source;
|
||||
}
|
||||
|
||||
#endif
|
||||
double CalculateTimes(CAudioOverlay& oAudioOverlay)
|
||||
{
|
||||
CaclulateSlideTimes();
|
||||
@ -486,7 +463,6 @@ namespace NSPresentationEditor
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
void ResetAutoText(IElement *pElement, vector_string const (&placeholdersReplaceString)[3])
|
||||
{
|
||||
CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElement);
|
||||
|
||||
@ -488,6 +488,9 @@ namespace NSCustomVML
|
||||
std::vector<CSegment> m_arSegments;
|
||||
std::vector<CGuide> m_arGuides;
|
||||
std::vector<LONG>* m_pAdjustValues;
|
||||
std::vector<Aggplus::POINT> m_arConnectionSites;
|
||||
std::vector<Aggplus::RECT> m_arInscribe;
|
||||
std::vector<double> m_arConnectionSitesDir;
|
||||
|
||||
bool m_bIsVerticesPresent;
|
||||
bool m_bIsPathPresent;
|
||||
@ -496,7 +499,7 @@ namespace NSCustomVML
|
||||
CPen m_oPen;
|
||||
|
||||
public:
|
||||
CCustomVML() : m_arVertices(), m_arSegments(), m_arGuides(), m_pAdjustValues(NULL)
|
||||
CCustomVML() : m_pAdjustValues(NULL)
|
||||
{
|
||||
m_ePath = rtCurveTo/*rtLineTo*/;
|
||||
|
||||
@ -579,6 +582,63 @@ namespace NSCustomVML
|
||||
m_arVertices.push_back(oPoint);
|
||||
}
|
||||
}
|
||||
void LoadConnectionSitesDir(CProperty* pProperty)
|
||||
{
|
||||
NSOfficeDrawing::CBinaryReader oReader(pProperty->m_pOptions, pProperty->m_lValue);
|
||||
m_arConnectionSitesDir.clear();
|
||||
|
||||
WORD lCount = (WORD)(pProperty->m_lValue / 4);
|
||||
|
||||
for (WORD lIndex = 0; lIndex < lCount; ++lIndex)
|
||||
{
|
||||
DWORD v = oReader.ReadLONG();
|
||||
double val = (double)((WORD)(v >> 16) + ((WORD)(v) / 65536.0));
|
||||
m_arConnectionSitesDir.push_back(val);
|
||||
}
|
||||
}
|
||||
void LoadConnectionSites(CProperty* pProperty)
|
||||
{
|
||||
NSOfficeDrawing::CBinaryReader oReader(pProperty->m_pOptions, pProperty->m_lValue);
|
||||
m_arConnectionSites.clear();
|
||||
|
||||
WORD lCount = (WORD)(pProperty->m_lValue / 8);
|
||||
if (pProperty->m_bIsTruncated)
|
||||
{
|
||||
lCount = (WORD)(pProperty->m_lValue / 4);
|
||||
}
|
||||
|
||||
for (WORD lIndex = 0; lIndex < lCount; ++lIndex)
|
||||
{
|
||||
Aggplus::POINT oPoint;
|
||||
if (pProperty->m_bIsTruncated)
|
||||
{
|
||||
oPoint.x = (short)oReader.ReadWORD();
|
||||
oPoint.y = (short)oReader.ReadWORD();
|
||||
}
|
||||
else
|
||||
{
|
||||
oPoint.x = oReader.ReadLONG();
|
||||
oPoint.y = oReader.ReadLONG();
|
||||
}
|
||||
|
||||
LONG lMinF = (LONG)0x80000000;
|
||||
LONG lMaxF = (LONG)0x8000007F;
|
||||
if (lMinF <= oPoint.x)
|
||||
{
|
||||
int nGuideIndex = (DWORD)oPoint.x - 0x80000000;
|
||||
|
||||
bool b = false;
|
||||
}
|
||||
if (lMinF <= oPoint.y)
|
||||
{
|
||||
int nGuideIndex = (DWORD)oPoint.y - 0x80000000;
|
||||
|
||||
bool b = false;
|
||||
}
|
||||
|
||||
m_arConnectionSites.push_back(oPoint);
|
||||
}
|
||||
}
|
||||
void LoadVertices(CProperty* pProperty)
|
||||
{
|
||||
NSOfficeDrawing::CBinaryReader oReader(pProperty->m_pOptions, pProperty->m_lValue);
|
||||
@ -704,8 +764,38 @@ namespace NSCustomVML
|
||||
oInfo.Read(oReader);
|
||||
m_arGuides.push_back(oInfo);
|
||||
}
|
||||
|
||||
}
|
||||
void LoadInscribe(CProperty* pProperty)
|
||||
{
|
||||
NSOfficeDrawing::CBinaryReader oReader(pProperty->m_pOptions, pProperty->m_lValue);
|
||||
m_arInscribe.clear();
|
||||
|
||||
WORD lCount = (WORD)(pProperty->m_lValue / 16);
|
||||
if (pProperty->m_bIsTruncated)
|
||||
{
|
||||
lCount = (WORD)(pProperty->m_lValue / 8);
|
||||
}
|
||||
|
||||
for (WORD lIndex = 0; lIndex < lCount; ++lIndex)
|
||||
{
|
||||
Aggplus::RECT oRect;
|
||||
if (pProperty->m_bIsTruncated)
|
||||
{
|
||||
oRect.left = (short)oReader.ReadWORD();
|
||||
oRect.right = (short)oReader.ReadWORD();
|
||||
oRect.top = (short)oReader.ReadWORD();
|
||||
oRect.bottom = (short)oReader.ReadWORD();
|
||||
}
|
||||
else
|
||||
{
|
||||
oRect.left = (short)oReader.ReadLONG();
|
||||
oRect.right = (short)oReader.ReadLONG();
|
||||
oRect.top = (short)oReader.ReadLONG();
|
||||
oRect.bottom = (short)oReader.ReadLONG();
|
||||
}
|
||||
m_arInscribe.push_back(oRect);
|
||||
}
|
||||
}
|
||||
void LoadAdjusts(LONG lIndex, LONG lValue)
|
||||
{
|
||||
if (NULL == m_pAdjustValues)
|
||||
|
||||
@ -47,10 +47,10 @@ CPPTShape* CPPTShape::CreateByType(PPTShapes::ShapeType type)
|
||||
CPPTShape* pShape = NULL;
|
||||
switch (type)
|
||||
{
|
||||
// msosptNotchedCircularArrow 0x00000064 A value that SHOULD NOT be used.
|
||||
// msosptNotchedCircularArrow 0x00000064 A value that SHOULD NOT be used.
|
||||
// msosptHostControl 0x000000C9 A value that SHOULD NOT be used.
|
||||
|
||||
case sptNotchedCircularArrow:
|
||||
//case sptNotchedCircularArrow:
|
||||
case sptHostControl:
|
||||
{ pShape = new CPPTShape(); pShape->m_eType = type; break; }
|
||||
case 0: { pShape = new CRectangleType(); break; }
|
||||
|
||||
@ -41,6 +41,9 @@ namespace NSPresentationEditor
|
||||
LONG m_lThemeID;
|
||||
LONG m_lLayoutID;
|
||||
|
||||
LONG m_lSlideID; //for notes rels
|
||||
LONG m_lNotesID; //for slide rels
|
||||
|
||||
std::vector<IElement*> m_arElements;
|
||||
CSlideShowInfo m_oSlideShow;
|
||||
std::multimap<int,int> m_mapPlaceholders;
|
||||
@ -91,6 +94,8 @@ namespace NSPresentationEditor
|
||||
|
||||
m_lThemeID = -1;
|
||||
m_lLayoutID = -1;
|
||||
m_lSlideID = -1;
|
||||
m_lNotesID = -1;
|
||||
|
||||
m_lWidth = 270;
|
||||
m_lHeight = 190;
|
||||
@ -125,6 +130,8 @@ namespace NSPresentationEditor
|
||||
|
||||
m_lThemeID = oSrc.m_lThemeID;
|
||||
m_lLayoutID = oSrc.m_lLayoutID;
|
||||
m_lNotesID = oSrc.m_lNotesID;
|
||||
m_lSlideID = oSrc.m_lSlideID;
|
||||
|
||||
m_lWidth = oSrc.m_lWidth;
|
||||
m_lHeight = oSrc.m_lHeight;
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
#pragma once
|
||||
#include "Structures.h"
|
||||
#include "Layout.h"
|
||||
//#include "../PPTXWriter/CSS.h"
|
||||
|
||||
namespace NSPresentationEditor
|
||||
{
|
||||
|
||||
@ -45,7 +45,11 @@ namespace PPTX
|
||||
public:
|
||||
PPTX_LOGIC_BASE(CornerDirectionTransition)
|
||||
|
||||
public:
|
||||
virtual OOX::EElementType getType() const
|
||||
{
|
||||
return OOX::et_p_CornerDirectionTransition;
|
||||
}
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
name = XmlUtils::GetNameNoNS(node.GetName());
|
||||
@ -61,8 +65,8 @@ namespace PPTX
|
||||
}
|
||||
|
||||
public:
|
||||
std::wstring name;
|
||||
nullable_limit<Limit::CornerDirectionVal> dir;
|
||||
std::wstring name;
|
||||
nullable_limit<Limit::CornerDirectionVal> dir;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds(){};
|
||||
};
|
||||
|
||||
@ -45,7 +45,11 @@ namespace PPTX
|
||||
public:
|
||||
PPTX_LOGIC_BASE(EightDirectionTransition)
|
||||
|
||||
public:
|
||||
virtual OOX::EElementType getType() const
|
||||
{
|
||||
return OOX::et_p_EightDirectionTransition;
|
||||
}
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
name = XmlUtils::GetNameNoNS(node.GetName());
|
||||
@ -60,8 +64,7 @@ namespace PPTX
|
||||
return XmlUtils::CreateNode(_T("p:") + name, oAttr);
|
||||
}
|
||||
|
||||
public:
|
||||
std::wstring name;
|
||||
std::wstring name;
|
||||
nullable_limit<Limit::EightDirectionVal> dir;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds(){};
|
||||
|
||||
@ -44,7 +44,11 @@ namespace PPTX
|
||||
public:
|
||||
PPTX_LOGIC_BASE(EmptyTransition)
|
||||
|
||||
public:
|
||||
virtual OOX::EElementType getType() const
|
||||
{
|
||||
return OOX::et_p_EmptyTransition;
|
||||
}
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
name = XmlUtils::GetNameNoNS(node.GetName());
|
||||
@ -55,7 +59,6 @@ namespace PPTX
|
||||
return _T("<p:") + name + _T("/>");
|
||||
}
|
||||
|
||||
public:
|
||||
std::wstring name;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds(){};
|
||||
|
||||
@ -44,10 +44,14 @@ namespace PPTX
|
||||
public:
|
||||
PPTX_LOGIC_BASE(OptionalBlackTransition)
|
||||
|
||||
public:
|
||||
virtual OOX::EElementType getType() const
|
||||
{
|
||||
return OOX::et_p_OptionalBlackTransition;
|
||||
}
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
name = XmlUtils::GetNameNoNS(node.GetName());
|
||||
name = XmlUtils::GetNameNoNS(node.GetName());
|
||||
node.ReadAttributeBase(L"thruBlk", thruBlk);
|
||||
}
|
||||
|
||||
@ -59,9 +63,9 @@ namespace PPTX
|
||||
return XmlUtils::CreateNode(_T("p:") + name, oAttr);
|
||||
}
|
||||
|
||||
public:
|
||||
std::wstring name;
|
||||
nullable_bool thruBlk;
|
||||
std::wstring name;
|
||||
nullable_bool thruBlk;
|
||||
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds(){};
|
||||
};
|
||||
|
||||
@ -45,7 +45,11 @@ namespace PPTX
|
||||
public:
|
||||
PPTX_LOGIC_BASE(OrientationTransition)
|
||||
|
||||
public:
|
||||
virtual OOX::EElementType getType() const
|
||||
{
|
||||
return OOX::et_p_OrientationTransition;
|
||||
}
|
||||
|
||||
void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
name = XmlUtils::GetNameNoNS(node.GetName());
|
||||
@ -60,9 +64,8 @@ namespace PPTX
|
||||
return XmlUtils::CreateNode(_T("p:") + name, oAttr);
|
||||
}
|
||||
|
||||
public:
|
||||
std::wstring name;
|
||||
nullable_limit<Limit::Orient> dir;
|
||||
std::wstring name;
|
||||
nullable_limit<Limit::Orient> dir;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds(){};
|
||||
};
|
||||
|
||||
@ -45,7 +45,11 @@ namespace PPTX
|
||||
public:
|
||||
PPTX_LOGIC_BASE(SideDirectionTransition)
|
||||
|
||||
public:
|
||||
virtual OOX::EElementType getType() const
|
||||
{
|
||||
return OOX::et_p_SideDirectionTransition;
|
||||
}
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
name = XmlUtils::GetNameNoNS(node.GetName());
|
||||
@ -60,8 +64,7 @@ namespace PPTX
|
||||
return XmlUtils::CreateNode(_T("p:") + name, oAttr);
|
||||
}
|
||||
|
||||
public:
|
||||
std::wstring name;
|
||||
std::wstring name;
|
||||
nullable_limit<Limit::SideDirectionVal> dir;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds(){};
|
||||
|
||||
@ -46,7 +46,11 @@ namespace PPTX
|
||||
public:
|
||||
PPTX_LOGIC_BASE(SplitTransition)
|
||||
|
||||
public:
|
||||
virtual OOX::EElementType getType() const
|
||||
{
|
||||
return OOX::et_p_SplitTransition;
|
||||
}
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
node.ReadAttributeBase(L"dir", dir);
|
||||
@ -62,7 +66,6 @@ namespace PPTX
|
||||
return XmlUtils::CreateNode(_T("p:split"), oAttr);
|
||||
}
|
||||
|
||||
public:
|
||||
nullable_limit<Limit::InOutDirectionVal> dir;
|
||||
nullable_limit<Limit::Orient> orient;
|
||||
protected:
|
||||
|
||||
@ -49,7 +49,6 @@ namespace PPTX
|
||||
explicit TransitionBase(XmlUtils::CXmlNode& node);
|
||||
const TransitionBase& operator =(XmlUtils::CXmlNode& node);
|
||||
|
||||
public:
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node);
|
||||
virtual void GetTransitionTypeFrom(XmlUtils::CXmlNode& element);
|
||||
virtual bool is_init()const{return (base.IsInit());};
|
||||
@ -59,8 +58,7 @@ namespace PPTX
|
||||
template<class T> const T& as() const { return base.as<T>(); }
|
||||
|
||||
virtual std::wstring toXML() const;
|
||||
//public:
|
||||
private:
|
||||
|
||||
smart_ptr<WrapperWritingElement> base;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds(){};
|
||||
|
||||
@ -44,7 +44,11 @@ namespace PPTX
|
||||
public:
|
||||
PPTX_LOGIC_BASE(WheelTransition)
|
||||
|
||||
public:
|
||||
virtual OOX::EElementType getType() const
|
||||
{
|
||||
return OOX::et_p_WheelTransition;
|
||||
}
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
node.ReadAttributeBase(L"spokes", spokes);
|
||||
@ -58,7 +62,6 @@ namespace PPTX
|
||||
return XmlUtils::CreateNode(_T("p:wheel"), oAttr);
|
||||
}
|
||||
|
||||
public:
|
||||
nullable_int spokes;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds(){};
|
||||
|
||||
@ -45,7 +45,11 @@ namespace PPTX
|
||||
public:
|
||||
PPTX_LOGIC_BASE(ZoomTransition)
|
||||
|
||||
public:
|
||||
virtual OOX::EElementType getType() const
|
||||
{
|
||||
return OOX::et_p_ZoomTransition;
|
||||
}
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
node.ReadAttributeBase(L"dir", dir);
|
||||
@ -59,8 +63,7 @@ namespace PPTX
|
||||
return XmlUtils::CreateNode(_T("p:zoom"), oAttr);
|
||||
}
|
||||
|
||||
public:
|
||||
nullable_limit<Limit::InOutDirectionVal> dir;
|
||||
nullable_limit<Limit::InOutDirectionVal> dir;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds(){};
|
||||
};
|
||||
|
||||
@ -45,6 +45,12 @@
|
||||
#pragma comment(lib,"Shell32.lib")
|
||||
#pragma comment(lib,"Advapi32.lib")
|
||||
|
||||
#if defined(_WIN64)
|
||||
#pragma comment(lib, "../../build/bin/icu/win_64/icuuc.lib")
|
||||
#elif defined (_WIN32)
|
||||
#pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib")
|
||||
#endif
|
||||
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="windows-1251"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Version="8,00"
|
||||
Name="XlsFormatTest"
|
||||
ProjectGUID="{C2882DDD-07E6-4314-AD4B-48F43F38D722}"
|
||||
RootNamespace="ASCOfficeOdfFileTest"
|
||||
@ -367,14 +367,6 @@
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath="..\..\build\bin\icu\win_32\icudt.lib"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\build\bin\icu\win_32\icuuc.lib"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
|
||||
@ -312,7 +312,7 @@ namespace NSCustomShapesConvert
|
||||
if (lMaxF > m_arVertices[nIndex].x ) nGuideIndex_x = (DWORD)m_arVertices[nIndex].x - (DWORD)lMinF;
|
||||
if (lMaxF > m_arVertices[nIndex].y ) nGuideIndex_y = (DWORD)m_arVertices[nIndex].y - (DWORD)lMinF;
|
||||
|
||||
if (nGuideIndex_x >= 0 )
|
||||
if (nGuideIndex_x >= 0 && nGuideIndex_x < m_arGuides.size())
|
||||
{
|
||||
strPath += std::to_wstring(m_arGuides[nGuideIndex_x].m_param_value1) + L",";
|
||||
}
|
||||
@ -320,7 +320,7 @@ namespace NSCustomShapesConvert
|
||||
{
|
||||
strPath += std::to_wstring(m_arVertices[nIndex].x) + L",";
|
||||
}
|
||||
if (nGuideIndex_y >= 0)
|
||||
if (nGuideIndex_y >= 0 && nGuideIndex_y < m_arGuides.size())
|
||||
{
|
||||
strPath += std::to_wstring(m_arGuides[nGuideIndex_y].m_param_value1) + L",";
|
||||
}
|
||||
@ -388,7 +388,7 @@ namespace NSCustomShapesConvert
|
||||
if (lMaxF > m_arVertices[nV].x ) nGuideIndex_x = (DWORD)m_arVertices[nV].x - (DWORD)lMinF;
|
||||
if (lMaxF > m_arVertices[nV].y ) nGuideIndex_y = (DWORD)m_arVertices[nV].y - (DWORD)lMinF;
|
||||
|
||||
if (nGuideIndex_x >= 0 )
|
||||
if (nGuideIndex_x >= 0 && nGuideIndex_x < m_arGuides.size() )
|
||||
{
|
||||
strPath += std::to_wstring(m_arGuides[nGuideIndex_x].m_param_value1) + L",";
|
||||
}
|
||||
@ -396,7 +396,7 @@ namespace NSCustomShapesConvert
|
||||
{
|
||||
strPath += std::to_wstring(m_arVertices[nV].x) + L",";
|
||||
}
|
||||
if (nGuideIndex_y >= 0)
|
||||
if (nGuideIndex_y >= 0 && nGuideIndex_y < m_arGuides.size())
|
||||
{
|
||||
strPath += std::to_wstring(m_arGuides[nGuideIndex_y].m_param_value1) + L",";
|
||||
}
|
||||
|
||||
@ -251,6 +251,19 @@ namespace oox
|
||||
case msosptRectangle : return L"rect";
|
||||
case msosptEllipse : return L"ellipse";
|
||||
case msosptLine : return L"line";
|
||||
case msosptActionButtonBlank : return L"actionButtonBlank";
|
||||
case msosptActionButtonHome : return L"actionButtonHome";
|
||||
case msosptActionButtonHelp : return L"actionButtonHelp";
|
||||
case msosptActionButtonInformation : return L"actionButtonInformation";
|
||||
case msosptActionButtonForwardNext : return L"actionButtonForwardNext";
|
||||
case msosptActionButtonBackPrevious : return L"actionButtonBackPrevious";
|
||||
case msosptActionButtonEnd : return L"actionButtonEnd";
|
||||
case msosptActionButtonBeginning : return L"actionButtonBeginning";
|
||||
case msosptActionButtonReturn : return L"actionButtonReturn";
|
||||
case msosptActionButtonDocument : return L"actionButtonDocument";
|
||||
case msosptActionButtonSound : return L"actionButtonSound";
|
||||
case msosptActionButtonMovie : return L"actionButtonMovie";
|
||||
case msosptLeftArrow : return L"leftArrow";
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
|
||||
@ -799,7 +799,7 @@ namespace ComplexTypes
|
||||
if ( m_oVal.IsInit() )
|
||||
{
|
||||
sResult += _T("w:val=\"");
|
||||
sResult += m_oVal->ToString();
|
||||
sResult += std::to_wstring(m_oVal->ToHps());
|
||||
sResult += _T("\" ");
|
||||
}
|
||||
|
||||
|
||||
@ -3085,6 +3085,11 @@ namespace SimpleTypes
|
||||
m_dValue = fabs( dValue * 72.0 );
|
||||
return m_dValue;
|
||||
}
|
||||
virtual double FromHps(double dValue)
|
||||
{
|
||||
m_dValue = dValue / 2;
|
||||
return m_dValue;
|
||||
}
|
||||
SimpleType_FromString (double)
|
||||
SimpleType_Operator_Equal (CHpsMeasure)
|
||||
UniversalMeasure_AdditionalOpearators(CHpsMeasure)
|
||||
|
||||
@ -142,6 +142,8 @@ namespace OOX
|
||||
pItem = new CSmartTag( oItem );
|
||||
//else if ( _T("w:subDoc") == sName )
|
||||
// pItem = new CSubDoc( oItem );
|
||||
else if ( _T("w:ffData") == sName )
|
||||
m_oFFData = new CFFData( oItem );
|
||||
|
||||
if ( pItem )
|
||||
m_arrItems.push_back( pItem );
|
||||
@ -232,6 +234,8 @@ namespace OOX
|
||||
pItem = new CSmartTag( oReader );
|
||||
//else if ( _T("w:subDoc") == sName )
|
||||
// pItem = new CSubDoc( oReader );
|
||||
else if ( _T("w:ffData") == sName )
|
||||
m_oFFData = new CFFData( oReader );
|
||||
|
||||
if ( pItem )
|
||||
m_arrItems.push_back( pItem );
|
||||
@ -259,6 +263,11 @@ namespace OOX
|
||||
|
||||
sResult += _T(">");
|
||||
|
||||
if (m_oFFData.IsInit())
|
||||
{
|
||||
sResult += m_oFFData->toXML();
|
||||
}
|
||||
|
||||
for (unsigned int nIndex = 0; nIndex < m_arrItems.size(); nIndex++ )
|
||||
{
|
||||
if ( m_arrItems[nIndex] )
|
||||
|
||||
@ -38,6 +38,7 @@
|
||||
#include "../WritingElement.h"
|
||||
#include "../../Common/SimpleTypes_Word.h"
|
||||
#include "../../Common/SimpleTypes_Shared.h"
|
||||
#include "../../DocxFormat/Logic/FldChar.h"
|
||||
|
||||
namespace OOX
|
||||
{
|
||||
@ -120,6 +121,7 @@ namespace OOX
|
||||
nullable<std::wstring > m_sInstr;
|
||||
|
||||
// Childs
|
||||
nullable<OOX::Logic::CFFData > m_oFFData;
|
||||
};
|
||||
|
||||
} // namespace Logic
|
||||
|
||||
@ -375,6 +375,16 @@ namespace OOX
|
||||
et_p_fld,
|
||||
et_p_br,
|
||||
et_p_MathPara,
|
||||
|
||||
et_p_EmptyTransition,
|
||||
et_p_OrientationTransition,
|
||||
et_p_EightDirectionTransition,
|
||||
et_p_OptionalBlackTransition,
|
||||
et_p_CornerDirectionTransition,
|
||||
et_p_SideDirectionTransition,
|
||||
et_p_WheelTransition,
|
||||
et_p_SplitTransition,
|
||||
et_p_ZoomTransition,
|
||||
|
||||
et_a_textFit,
|
||||
et_a_hyperlink,
|
||||
|
||||
@ -326,7 +326,7 @@ private:
|
||||
if (differenceInLength < 0)
|
||||
differenceInLength = -differenceInLength;
|
||||
|
||||
for (int i = number1.size() - 1; i >= 0; --i)
|
||||
for (int i = (int)(number1.size()) - 1; i >= 0; --i)
|
||||
{
|
||||
add[i] = ((carry-'0')+(number1[i]-'0')+(number2[i]-'0')) + '0';
|
||||
|
||||
@ -364,7 +364,7 @@ private:
|
||||
if (differenceInLength < 0)
|
||||
differenceInLength = -differenceInLength;
|
||||
|
||||
for (int i = number1.length() - 1; i >= 0; --i)
|
||||
for (int i = (int)(number1.length()) - 1; i >= 0; --i)
|
||||
{
|
||||
if (number1[i] < number2[i])
|
||||
{
|
||||
@ -386,13 +386,13 @@ private:
|
||||
n1.swap(n2);
|
||||
|
||||
std::string res = "0";
|
||||
for (int i = n1.length() - 1; i >= 0; --i)
|
||||
for (int i = (int)(n1.length()) - 1; i >= 0; --i)
|
||||
{
|
||||
std::string temp = n2;
|
||||
int currentDigit = n1[i] - '0';
|
||||
int carry = 0;
|
||||
|
||||
for (int j = temp.length() - 1; j >= 0; --j)
|
||||
for (int j = (int)(temp.length()) - 1; j >= 0; --j)
|
||||
{
|
||||
temp[j] = ((temp[j]-'0') * currentDigit) + carry;
|
||||
|
||||
|
||||
@ -11,6 +11,19 @@ TEMPLATE = lib
|
||||
CONFIG += staticlib
|
||||
QMAKE_CXXFLAGS += -Wall -g
|
||||
|
||||
DEFINES += \
|
||||
LIBXML_READER_ENABLED \
|
||||
LIBXML_PUSH_ENABLED \
|
||||
LIBXML_HTML_ENABLED \
|
||||
LIBXML_XPATH_ENABLED \
|
||||
LIBXML_OUTPUT_ENABLED \
|
||||
LIBXML_C14N_ENABLED \
|
||||
LIBXML_SAX1_ENABLED \
|
||||
LIBXML_TREE_ENABLED \
|
||||
LIBXML_XPTR_ENABLED \
|
||||
IN_LIBXML \
|
||||
LIBXML_STATIC
|
||||
|
||||
CORE_ROOT_DIR = $$PWD/../../../..
|
||||
PWD_ROOT_DIR = $$PWD
|
||||
include(../../../../Common/base.pri)
|
||||
|
||||
@ -305,6 +305,19 @@ namespace XmlUtils
|
||||
strValues.push_back (NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)p->second.c_str(), (long)p->second.length()));
|
||||
}
|
||||
}
|
||||
template<typename T>
|
||||
void ReadAllAttributesA(T& strNames, T& strValues)
|
||||
{
|
||||
if (!IsValid())
|
||||
return;
|
||||
|
||||
std::map<std::string, std::string>::iterator p;
|
||||
for (p = m_pBase->m_attributes.begin(); p != m_pBase->m_attributes.end(); ++p)
|
||||
{
|
||||
strNames.push_back(p->first);
|
||||
strValues.push_back(p->second);
|
||||
}
|
||||
}
|
||||
template <typename T>
|
||||
void ReadNodeValueBase(const wchar_t* bsName, T& value)
|
||||
{
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
|
||||
#include "./XmlCanonicalizator.h"
|
||||
#include "./XmlSignerBase.h"
|
||||
#include "./XmlTransform.h"
|
||||
|
||||
class COOXMLSigner
|
||||
{
|
||||
@ -23,167 +24,6 @@ public:
|
||||
|
||||
std::wstring m_guid;
|
||||
|
||||
public:
|
||||
class COOXMLRelationship
|
||||
{
|
||||
public:
|
||||
std::wstring rid;
|
||||
std::wstring type;
|
||||
std::wstring target;
|
||||
std::wstring target_mode;
|
||||
|
||||
public:
|
||||
|
||||
COOXMLRelationship()
|
||||
{
|
||||
}
|
||||
|
||||
COOXMLRelationship(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
rid = node.GetAttribute("Id");
|
||||
type = node.GetAttribute("Type");
|
||||
target = node.GetAttribute("Target");
|
||||
|
||||
CheckTargetMode();
|
||||
}
|
||||
|
||||
std::wstring GetXml()
|
||||
{
|
||||
NSStringUtils::CStringBuilder builder;
|
||||
builder.WriteString(L"<Relationship Id=\"");
|
||||
builder.WriteEncodeXmlString(rid);
|
||||
builder.WriteString(L"\" Type=\"");
|
||||
builder.WriteEncodeXmlString(type);
|
||||
builder.WriteString(L"\" Target=\"");
|
||||
builder.WriteEncodeXmlString(target);
|
||||
builder.WriteString(L"\" TargetMode=\"");
|
||||
builder.WriteEncodeXmlString(target_mode);
|
||||
builder.WriteString(L"\" />");
|
||||
return builder.GetData();
|
||||
}
|
||||
|
||||
static bool Compare(const COOXMLRelationship& i, const COOXMLRelationship& j)
|
||||
{
|
||||
return i.rid < j.rid;
|
||||
}
|
||||
|
||||
protected:
|
||||
void CheckTargetMode()
|
||||
{
|
||||
if (0 == target.find(L"http") || 0 == target.find(L"www") || 0 == target.find(L"ftp"))
|
||||
target_mode = L"External";
|
||||
else
|
||||
target_mode = L"Internal";
|
||||
}
|
||||
};
|
||||
|
||||
class COOXMLRelationships
|
||||
{
|
||||
public:
|
||||
std::vector<COOXMLRelationship> rels;
|
||||
|
||||
public:
|
||||
|
||||
COOXMLRelationships()
|
||||
{
|
||||
}
|
||||
|
||||
COOXMLRelationships(std::wstring& file)
|
||||
{
|
||||
XmlUtils::CXmlNode oNode;
|
||||
if (!oNode.FromXmlFile(file))
|
||||
return;
|
||||
|
||||
XmlUtils::CXmlNodes oNodes;
|
||||
if (!oNode.GetNodes(L"Relationship", oNodes))
|
||||
return;
|
||||
|
||||
int nCount = oNodes.GetCount();
|
||||
for (int i = 0; i < nCount; ++i)
|
||||
{
|
||||
XmlUtils::CXmlNode oRel;
|
||||
oNodes.GetAt(i, oRel);
|
||||
rels.push_back(COOXMLRelationship(oRel));
|
||||
}
|
||||
}
|
||||
|
||||
std::wstring GetXml()
|
||||
{
|
||||
NSStringUtils::CStringBuilder builder;
|
||||
|
||||
builder.WriteString(L"<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">");
|
||||
|
||||
// sort by rId
|
||||
std::sort(rels.begin(), rels.end(), COOXMLRelationship::Compare);
|
||||
|
||||
for (std::vector<COOXMLRelationship>::iterator i = rels.begin(); i != rels.end(); i++)
|
||||
builder.WriteString(i->GetXml());
|
||||
|
||||
builder.WriteString(L"</Relationships>");
|
||||
|
||||
return builder.GetData();
|
||||
}
|
||||
|
||||
std::wstring GetTransforms()
|
||||
{
|
||||
NSStringUtils::CStringBuilder builder;
|
||||
|
||||
builder.WriteString(L"<Transforms><Transform Algorithm=\"http://schemas.openxmlformats.org/package/2006/RelationshipTransform\">");
|
||||
|
||||
for (std::vector<COOXMLRelationship>::iterator i = rels.begin(); i != rels.end(); i++)
|
||||
{
|
||||
builder.WriteString(L"<mdssi:RelationshipReference xmlns:mdssi=\"http://schemas.openxmlformats.org/package/2006/digital-signature\" SourceId=\"");
|
||||
builder.WriteEncodeXmlString(i->rid);
|
||||
builder.WriteString(L"\" />");
|
||||
}
|
||||
|
||||
builder.WriteString(L"</Transform><Transform Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"/></Transforms>");
|
||||
|
||||
return builder.GetData();
|
||||
}
|
||||
|
||||
void CheckOriginSigs(std::wstring& file)
|
||||
{
|
||||
int rId = 0;
|
||||
std::vector<COOXMLRelationship>::iterator i = rels.begin();
|
||||
while (i != rels.end())
|
||||
{
|
||||
if (0 == i->target.find(L"_xmlsignatures/"))
|
||||
return;
|
||||
|
||||
std::wstring rid = i->rid;
|
||||
rid = rid.substr(3);
|
||||
|
||||
int nTemp = std::stoi(rid);
|
||||
|
||||
if (nTemp > rId)
|
||||
rId = nTemp;
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
std::string sXmlA;
|
||||
NSFile::CFileBinary::ReadAllTextUtf8A(file, sXmlA);
|
||||
|
||||
std::string::size_type pos = sXmlA.rfind("</Relationships>");
|
||||
if (pos == std::string::npos)
|
||||
return;
|
||||
|
||||
rId++;
|
||||
std::string sRet = sXmlA.substr(0, pos);
|
||||
sRet += ("<Relationship Id=\"rId" + std::to_string(rId) + "\" \
|
||||
Type=\"http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/origin\" Target=\"_xmlsignatures/origin.sigs\"/>\
|
||||
</Relationships>");
|
||||
|
||||
NSFile::CFileBinary::Remove(file);
|
||||
|
||||
NSFile::CFileBinary oFile;
|
||||
oFile.CreateFileW(file);
|
||||
oFile.WriteFile((BYTE*)sRet.c_str(), (DWORD)sRet.length());
|
||||
oFile.CloseFile();
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
COOXMLSigner(const std::wstring& sFolder, ICertificate* pContext)
|
||||
{
|
||||
@ -204,7 +44,7 @@ public:
|
||||
std::wstring sXml = L"<Reference URI=\"" + file + L"?ContentType=" + content_type + L"\">";
|
||||
sXml += L"<DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"/>";
|
||||
sXml += L"<DigestValue>";
|
||||
sXml += UTF8_TO_U(m_certificate->GetHash(m_sFolder + file));
|
||||
sXml += UTF8_TO_U(m_certificate->GetHash(m_sFolder + file, OOXML_HASH_ALG_SHA1));
|
||||
sXml += L"</DigestValue>";
|
||||
sXml += L"</Reference>";
|
||||
return sXml;
|
||||
@ -214,7 +54,7 @@ public:
|
||||
{
|
||||
std::string sXmlSigned = U_TO_UTF8(xml);
|
||||
sXmlSigned = CXmlCanonicalizator::Execute(sXmlSigned, XML_C14N_1_0);
|
||||
return m_certificate->GetHash(sXmlSigned);
|
||||
return m_certificate->GetHash(sXmlSigned, OOXML_HASH_ALG_SHA1);
|
||||
}
|
||||
|
||||
std::string GetReferenceMain(const std::wstring& xml, const std::wstring& id, const bool& isCannon = true)
|
||||
@ -259,7 +99,7 @@ public:
|
||||
|
||||
std::wstring GetRelsReference(const std::wstring& file)
|
||||
{
|
||||
COOXMLRelationships oRels(m_sFolder + file);
|
||||
COOXMLRelationships oRels(m_sFolder + file, true);
|
||||
|
||||
if (L"/_rels/.rels" == file)
|
||||
{
|
||||
@ -651,7 +491,7 @@ Type=\"http://schemas.openxmlformats.org/package/2006/relationships/digital-sign
|
||||
m_signed_info.WriteString("<Reference Type=\"http://uri.etsi.org/01903#SignedProperties\" URI=\"#idSignedProperties\">");
|
||||
m_signed_info.WriteString("<Transforms><Transform Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"/></Transforms>");
|
||||
m_signed_info.WriteString("<DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"/><DigestValue>");
|
||||
m_signed_info.WriteString(m_certificate->GetHash(sXmlTmp));
|
||||
m_signed_info.WriteString(m_certificate->GetHash(sXmlTmp, OOXML_HASH_ALG_SHA1));
|
||||
m_signed_info.WriteString("</DigestValue></Reference>");
|
||||
|
||||
return (L"<Object><xd:QualifyingProperties xmlns:xd=\"http://uri.etsi.org/01903/v1.3.2#\" Target=\"#idPackageSignature\">\
|
||||
|
||||
450
DesktopEditor/xmlsec/src/OOXMLVerifier.h
Normal file
450
DesktopEditor/xmlsec/src/OOXMLVerifier.h
Normal file
@ -0,0 +1,450 @@
|
||||
#ifndef _XML_OOXMLVERIFIER_H_
|
||||
#define _XML_OOXMLVERIFIER_H_
|
||||
|
||||
#include "./XmlCanonicalizator.h"
|
||||
#include "./XmlTransform.h"
|
||||
#include "./XmlCertificate.h"
|
||||
|
||||
#define OOXML_SIGNATURE_VALID 0
|
||||
#define OOXML_SIGNATURE_INVALID 1
|
||||
#define OOXML_SIGNATURE_NOTSUPPORTED 2
|
||||
#define OOXML_SIGNATURE_BAD 3
|
||||
|
||||
class COOXMLSignature
|
||||
{
|
||||
private:
|
||||
int m_valid;
|
||||
std::string m_guid;
|
||||
ICertificate* m_cert;
|
||||
|
||||
std::string m_sImageValidBase64;
|
||||
std::string m_sImageInvalidBase64;
|
||||
|
||||
std::wstring m_sFolder;
|
||||
|
||||
private:
|
||||
XmlUtils::CXmlNode m_node; // signature file
|
||||
|
||||
class CXmlStackNamespaces
|
||||
{
|
||||
public:
|
||||
std::wstring m_namespaces;
|
||||
XmlUtils::CXmlNode m_node;
|
||||
|
||||
public:
|
||||
CXmlStackNamespaces(const CXmlStackNamespaces& src)
|
||||
{
|
||||
m_namespaces = src.m_namespaces;
|
||||
m_node = src.m_node;
|
||||
}
|
||||
CXmlStackNamespaces()
|
||||
{
|
||||
}
|
||||
CXmlStackNamespaces(const XmlUtils::CXmlNode& node)
|
||||
{
|
||||
m_node = node;
|
||||
}
|
||||
|
||||
CXmlStackNamespaces& operator=(const CXmlStackNamespaces& src)
|
||||
{
|
||||
m_namespaces = src.m_namespaces;
|
||||
m_node = src.m_node;
|
||||
return *this;
|
||||
}
|
||||
|
||||
CXmlStackNamespaces GetById(const std::string& id, const bool& isNameUse = false)
|
||||
{
|
||||
return GetByIdRec(*this, id, isNameUse);
|
||||
}
|
||||
|
||||
CXmlStackNamespaces GetByIdRec(CXmlStackNamespaces& stack, const std::string& id, const bool& isNameUse = false)
|
||||
{
|
||||
if (stack.m_node.GetAttributeA("Id") == id)
|
||||
return stack;
|
||||
|
||||
if (isNameUse)
|
||||
{
|
||||
std::string sName = U_TO_UTF8((stack.m_node.GetName()));
|
||||
if (sName == id)
|
||||
return stack;
|
||||
}
|
||||
|
||||
CXmlStackNamespaces ret = stack;
|
||||
|
||||
std::vector<std::wstring> _names;
|
||||
std::vector<std::wstring> _values;
|
||||
ret.m_node.ReadAllAttributes(_names, _values);
|
||||
|
||||
NSStringUtils::CStringBuilder oBuilder;
|
||||
oBuilder.WriteString(L" ");
|
||||
for (std::vector<std::wstring>::iterator i = _names.begin(), j = _values.begin(); i != _names.end(); i++, j++)
|
||||
{
|
||||
if (i->find(L"xmlns") == 0)
|
||||
{
|
||||
oBuilder.WriteString(*i);
|
||||
oBuilder.WriteString(L"=\"");
|
||||
oBuilder.WriteEncodeXmlString(*j);
|
||||
oBuilder.WriteString(L"\"");
|
||||
}
|
||||
}
|
||||
|
||||
if (oBuilder.GetCurSize() != 1)
|
||||
ret.m_namespaces += oBuilder.GetData();
|
||||
|
||||
XmlUtils::CXmlNodes oNodes;
|
||||
if (stack.m_node.GetChilds(oNodes))
|
||||
{
|
||||
int nCount = oNodes.GetCount();
|
||||
|
||||
for (int i = 0; i < nCount; i++)
|
||||
{
|
||||
oNodes.GetAt(i, ret.m_node);
|
||||
CXmlStackNamespaces _retRecursion = ret.GetByIdRec(ret, id, isNameUse);
|
||||
if (_retRecursion.m_node.IsValid())
|
||||
return _retRecursion;
|
||||
}
|
||||
}
|
||||
|
||||
return CXmlStackNamespaces();
|
||||
}
|
||||
|
||||
std::string GetXml()
|
||||
{
|
||||
std::wstring sXml = m_node.GetXml();
|
||||
if (!m_namespaces.empty())
|
||||
{
|
||||
std::wstring sName = m_node.GetName();
|
||||
|
||||
std::wstring sXmlFind = L"<" + sName + L" ";
|
||||
if (0 == sXml.find(sXmlFind))
|
||||
{
|
||||
sXml.replace(0, sXmlFind.length(), L"<" + sName + L" " + m_namespaces + L" ");
|
||||
}
|
||||
else
|
||||
{
|
||||
sXmlFind = L"<" + sName + L">";
|
||||
if (0 == sXml.find(sXmlFind))
|
||||
sXml.replace(0, sXmlFind.length(), L"<" + sName + L" " + m_namespaces + L">");
|
||||
}
|
||||
}
|
||||
|
||||
return U_TO_UTF8(sXml);
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
COOXMLSignature()
|
||||
{
|
||||
m_valid = OOXML_SIGNATURE_INVALID;
|
||||
m_guid = "";
|
||||
m_cert = NULL;
|
||||
}
|
||||
~COOXMLSignature()
|
||||
{
|
||||
RELEASEOBJECT(m_cert);
|
||||
}
|
||||
|
||||
public:
|
||||
int GetValid()
|
||||
{
|
||||
return m_valid;
|
||||
}
|
||||
std::string GetGuid()
|
||||
{
|
||||
return m_guid;
|
||||
}
|
||||
ICertificate* GetCertificate()
|
||||
{
|
||||
return m_cert;
|
||||
}
|
||||
std::string GetImageValidBase64()
|
||||
{
|
||||
return m_sImageValidBase64;
|
||||
}
|
||||
std::string GetImageInvalidBase64()
|
||||
{
|
||||
return m_sImageInvalidBase64;
|
||||
}
|
||||
|
||||
public:
|
||||
void Check()
|
||||
{
|
||||
// 1) Certificate
|
||||
XmlUtils::CXmlNode oNodeCert = m_node.ReadNode(L"KeyInfo").ReadNode(L"X509Data").ReadNode(L"X509Certificate");
|
||||
if (!oNodeCert.IsValid())
|
||||
{
|
||||
m_valid = OOXML_SIGNATURE_NOTSUPPORTED;
|
||||
return;
|
||||
}
|
||||
m_cert = new CCertificate();
|
||||
if (!m_cert->LoadFromBase64Data(U_TO_UTF8(oNodeCert.GetText())))
|
||||
{
|
||||
m_valid = OOXML_SIGNATURE_NOTSUPPORTED;
|
||||
return;
|
||||
}
|
||||
|
||||
// 2) Check files (Manifect)
|
||||
XmlUtils::CXmlNode nodeManifect = GetObjectById("idPackageObject");
|
||||
if (!nodeManifect.IsValid())
|
||||
{
|
||||
m_valid = OOXML_SIGNATURE_INVALID;
|
||||
return;
|
||||
}
|
||||
|
||||
XmlUtils::CXmlNodes nodesManifestRefs = nodeManifect.ReadNode(L"Manifest").GetNodes(L"Reference");
|
||||
int nRefsCount = nodesManifestRefs.GetCount();
|
||||
for (int i = 0; i < nRefsCount; i++)
|
||||
{
|
||||
XmlUtils::CXmlNode tmp;
|
||||
nodesManifestRefs.GetAt(i, tmp);
|
||||
|
||||
m_valid = CheckManifestReference(tmp);
|
||||
if (OOXML_SIGNATURE_VALID != m_valid)
|
||||
return;
|
||||
}
|
||||
|
||||
// 3) Images
|
||||
XmlUtils::CXmlNode nodeImageValid = GetObjectById("idValidSigLnImg");
|
||||
if (nodeImageValid.IsValid())
|
||||
m_sImageValidBase64 = U_TO_UTF8(nodeImageValid.GetText());
|
||||
XmlUtils::CXmlNode nodeImageInvalid = GetObjectById("idInvalidSigLnImg");
|
||||
if (nodeImageInvalid.IsValid())
|
||||
m_sImageInvalidBase64 = U_TO_UTF8(nodeImageInvalid.GetText());
|
||||
|
||||
// 4) Objects
|
||||
XmlUtils::CXmlNodes nodesReferences;
|
||||
m_node.ReadNode(L"SignedInfo").GetNodes(L"Reference", nodesReferences);
|
||||
nRefsCount = nodesReferences.GetCount();
|
||||
for (int i = 0; i < nRefsCount; i++)
|
||||
{
|
||||
XmlUtils::CXmlNode tmp;
|
||||
nodesReferences.GetAt(i, tmp);
|
||||
|
||||
m_valid = CheckObjectReference(tmp);
|
||||
if (OOXML_SIGNATURE_VALID != m_valid)
|
||||
return;
|
||||
}
|
||||
|
||||
// 5) Check signature
|
||||
CXmlStackNamespaces stack(m_node);
|
||||
CXmlStackNamespaces stackRes = stack.GetById("SignedInfo", true);
|
||||
std::string sXml = stackRes.GetXml();
|
||||
|
||||
std::string sCanonicalizationMethod = m_node.ReadNode(L"SignedInfo").ReadNode(L"CanonicalizationMethod").GetAttributeA("Algorithm");
|
||||
std::string sSignatureMethod = m_node.ReadNode(L"SignedInfo").ReadNode(L"SignatureMethod").GetAttributeA("Algorithm");
|
||||
|
||||
int nSignatureMethod = ICertificate::GetOOXMLHashAlg(sSignatureMethod);
|
||||
if (OOXML_HASH_ALG_INVALID == nSignatureMethod)
|
||||
{
|
||||
m_valid = OOXML_SIGNATURE_NOTSUPPORTED;
|
||||
return;
|
||||
}
|
||||
|
||||
IXmlTransform* pCanonicalizationMethodTransform = IXmlTransform::GetFromType(sCanonicalizationMethod);
|
||||
if (NULL == pCanonicalizationMethodTransform)
|
||||
{
|
||||
m_valid = OOXML_SIGNATURE_NOTSUPPORTED;
|
||||
return;
|
||||
}
|
||||
|
||||
std::string sSignatureCalcValue = pCanonicalizationMethodTransform->Transform(sXml);
|
||||
RELEASEOBJECT(pCanonicalizationMethodTransform);
|
||||
|
||||
std::string sSignatureValue = U_TO_UTF8((m_node.ReadValueString(L"SignatureValue")));
|
||||
|
||||
if (!m_cert->Verify(sSignatureCalcValue, sSignatureValue, nSignatureMethod))
|
||||
m_valid = OOXML_SIGNATURE_INVALID;
|
||||
}
|
||||
|
||||
XmlUtils::CXmlNode GetObjectById(std::string sId)
|
||||
{
|
||||
XmlUtils::CXmlNodes oNodes = m_node.GetNodes(L"Object");
|
||||
int nCount = oNodes.GetCount();
|
||||
for (int i = 0; i < nCount; i++)
|
||||
{
|
||||
XmlUtils::CXmlNode tmp;
|
||||
oNodes.GetAt(i, tmp);
|
||||
if (sId == tmp.GetAttributeA("Id"))
|
||||
return tmp;
|
||||
}
|
||||
XmlUtils::CXmlNode ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
friend class COOXMLVerifier;
|
||||
|
||||
private:
|
||||
|
||||
int CheckManifestReference(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
std::wstring sFile = node.GetAttribute("URI");
|
||||
std::wstring::size_type nPos = sFile.find(L"?");
|
||||
if (nPos == std::wstring::npos)
|
||||
return OOXML_SIGNATURE_INVALID;
|
||||
|
||||
sFile = sFile.substr(0, nPos);
|
||||
sFile = m_sFolder + sFile;
|
||||
|
||||
if (!NSFile::CFileBinary::Exists(sFile))
|
||||
return OOXML_SIGNATURE_INVALID;
|
||||
|
||||
XmlUtils::CXmlNode nodeMethod = node.ReadNode(L"DigestMethod");
|
||||
if (!nodeMethod.IsValid())
|
||||
return OOXML_SIGNATURE_INVALID;
|
||||
|
||||
int nAlg = ICertificate::GetOOXMLHashAlg(nodeMethod.GetAttributeA("Algorithm"));
|
||||
|
||||
if (OOXML_HASH_ALG_INVALID == nAlg)
|
||||
return OOXML_SIGNATURE_NOTSUPPORTED;
|
||||
|
||||
std::string sValue = U_TO_UTF8((node.ReadNodeText(L"DigestValue")));
|
||||
std::string sCalcValue = "";
|
||||
|
||||
XmlUtils::CXmlNode nodeTransform = node.ReadNode(L"Transforms");
|
||||
if (!nodeTransform.IsValid())
|
||||
{
|
||||
// simple hash
|
||||
sCalcValue = m_cert->GetHash(sFile, nAlg);
|
||||
sValue = U_TO_UTF8((node.ReadNodeText(L"DigestValue")));
|
||||
}
|
||||
else
|
||||
{
|
||||
// XML
|
||||
CXmlTransforms oTransforms(nodeTransform);
|
||||
if (!oTransforms.GetValid())
|
||||
return OOXML_SIGNATURE_NOTSUPPORTED;
|
||||
|
||||
std::string sXml;
|
||||
NSFile::CFileBinary::ReadAllTextUtf8A(sFile, sXml);
|
||||
|
||||
sXml = oTransforms.Transform(sXml);
|
||||
|
||||
sCalcValue = m_cert->GetHash(sXml, nAlg);
|
||||
sValue = U_TO_UTF8((node.ReadNodeText(L"DigestValue")));
|
||||
}
|
||||
|
||||
if (sCalcValue != sValue)
|
||||
return OOXML_SIGNATURE_INVALID;
|
||||
|
||||
return OOXML_SIGNATURE_VALID;
|
||||
}
|
||||
|
||||
int CheckObjectReference(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
std::string sURI = node.GetAttributeA("URI");
|
||||
if ("" == sURI)
|
||||
return OOXML_SIGNATURE_INVALID;
|
||||
|
||||
if (0 == sURI.find("#"))
|
||||
sURI = sURI.substr(1);
|
||||
|
||||
std::string sValue = U_TO_UTF8((node.ReadNodeText(L"DigestValue")));
|
||||
|
||||
CXmlTransforms oTransforms;
|
||||
|
||||
CXmlTransformC14N* pTransform = new CXmlTransformC14N();
|
||||
pTransform->CheckC14NTransform("http://www.w3.org/TR/2001/REC-xml-c14n-20010315");
|
||||
oTransforms.AddTransform(pTransform);
|
||||
|
||||
#if 0
|
||||
XmlUtils::CXmlNode nodeTransform = node.ReadNode(L"Transforms");
|
||||
if (!nodeTransform.IsValid())
|
||||
{
|
||||
// simple hash
|
||||
sCalcValue = m_cert->GetHash(sFile, nAlg);
|
||||
sValue = U_TO_UTF8((node.ReadNodeText(L"DigestValue")));
|
||||
}
|
||||
else
|
||||
{
|
||||
// XML
|
||||
CXmlTransforms oTransforms(nodeTransform);
|
||||
if (!oTransforms.GetValid())
|
||||
return OOXML_SIGNATURE_NOTSUPPORTED;
|
||||
|
||||
std::string sXml;
|
||||
NSFile::CFileBinary::ReadAllTextUtf8A(sFile, sXml);
|
||||
|
||||
sXml = oTransforms.Transform(sXml);
|
||||
|
||||
sCalcValue = m_cert->GetHash(sXml, nAlg);
|
||||
sValue = U_TO_UTF8((node.ReadNodeText(L"DigestValue")));
|
||||
}
|
||||
#endif
|
||||
|
||||
CXmlStackNamespaces stack(m_node);
|
||||
CXmlStackNamespaces stackRes = stack.GetById(sURI);
|
||||
std::string sXml = stackRes.GetXml();
|
||||
|
||||
sXml = oTransforms.Transform(sXml);
|
||||
|
||||
XmlUtils::CXmlNode nodeMethod = node.ReadNode(L"DigestMethod");
|
||||
if (!nodeMethod.IsValid())
|
||||
return OOXML_SIGNATURE_INVALID;
|
||||
|
||||
int nAlg = ICertificate::GetOOXMLHashAlg(nodeMethod.GetAttributeA("Algorithm"));
|
||||
std::string sCalcValue = m_cert->GetHash(sXml, nAlg);
|
||||
|
||||
if (sCalcValue != sValue)
|
||||
return OOXML_SIGNATURE_INVALID;
|
||||
|
||||
return OOXML_SIGNATURE_VALID;
|
||||
}
|
||||
};
|
||||
|
||||
class COOXMLVerifier
|
||||
{
|
||||
public:
|
||||
std::wstring m_sFolder;
|
||||
std::vector<COOXMLSignature*> m_arSignatures;
|
||||
|
||||
public:
|
||||
COOXMLVerifier(const std::wstring& sFolder)
|
||||
{
|
||||
m_sFolder = sFolder;
|
||||
|
||||
if (!NSFile::CFileBinary::Exists(m_sFolder + L"/_xmlsignatures/origin.sigs"))
|
||||
return;
|
||||
|
||||
XmlUtils::CXmlNode oContentTypes;
|
||||
if (!oContentTypes.FromXmlFile(m_sFolder + L"/[Content_Types].xml"))
|
||||
return;
|
||||
|
||||
XmlUtils::CXmlNodes oOverrides = oContentTypes.GetNodes(L"Override");
|
||||
int nCount = oOverrides.GetCount();
|
||||
|
||||
for (int i = 0; i < nCount; i++)
|
||||
{
|
||||
XmlUtils::CXmlNode node;
|
||||
oOverrides.GetAt(i, node);
|
||||
|
||||
if (node.GetAttributeA("ContentType") != "application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml")
|
||||
continue;
|
||||
|
||||
std::wstring sFile = m_sFolder + node.GetAttribute("PartName");
|
||||
XmlUtils::CXmlNode nodeSig;
|
||||
if (!nodeSig.FromXmlFile(sFile))
|
||||
continue;
|
||||
|
||||
if (nodeSig.GetName() != L"Signature")
|
||||
continue;
|
||||
|
||||
COOXMLSignature* pSignature = new COOXMLSignature();
|
||||
pSignature->m_node = nodeSig;
|
||||
pSignature->m_sFolder = m_sFolder;
|
||||
pSignature->Check();
|
||||
|
||||
m_arSignatures.push_back(pSignature);
|
||||
}
|
||||
}
|
||||
~COOXMLVerifier()
|
||||
{
|
||||
for (std::vector<COOXMLSignature*>::iterator i = m_arSignatures.begin(); i != m_arSignatures.end(); i++)
|
||||
{
|
||||
COOXMLSignature* v = *i;
|
||||
RELEASEOBJECT(v);
|
||||
}
|
||||
m_arSignatures.clear();
|
||||
}
|
||||
};
|
||||
|
||||
#endif //_XML_OOXMLVERIFIER_H_
|
||||
@ -8,6 +8,10 @@
|
||||
#include "../../xml/include/xmlutils.h"
|
||||
#include "../../xml/libxml2/include/libxml/c14n.h"
|
||||
|
||||
#ifndef XML_UNUSED
|
||||
#define XML_UNUSED( arg ) ( (arg) = (arg) )
|
||||
#endif
|
||||
|
||||
class CXmlCanonicalizator
|
||||
{
|
||||
private:
|
||||
@ -33,11 +37,14 @@ private:
|
||||
|
||||
static int buffer_xmlBufferIOClose(CXmlBuffer* buf)
|
||||
{
|
||||
XML_UNUSED(buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int buffer_xmlC14NIsVisibleCallback(void * user_data, xmlNodePtr node, xmlNodePtr parent)
|
||||
{
|
||||
XML_UNUSED(user_data);
|
||||
XML_UNUSED(parent);
|
||||
if (node->type == XML_TEXT_NODE)
|
||||
{
|
||||
const char* cur = (char*)node->content;
|
||||
@ -53,7 +60,7 @@ private:
|
||||
}
|
||||
|
||||
public:
|
||||
static std::string Execute(const std::string& sXml, int mode)
|
||||
static std::string Execute(const std::string& sXml, int mode = XML_C14N_1_0, bool withComments = false)
|
||||
{
|
||||
xmlDocPtr xmlDoc = xmlParseMemory((char*)sXml.c_str(), (int)sXml.length());
|
||||
|
||||
@ -63,21 +70,18 @@ public:
|
||||
&bufferC14N,
|
||||
NULL);
|
||||
|
||||
xmlC14NExecute(xmlDoc, buffer_xmlC14NIsVisibleCallback, NULL, mode, NULL, 0, _buffer);
|
||||
xmlC14NExecute(xmlDoc, buffer_xmlC14NIsVisibleCallback, NULL, mode, NULL, withComments ? 1 : 0, _buffer);
|
||||
|
||||
xmlOutputBufferClose(_buffer);
|
||||
|
||||
return bufferC14N.builder.GetData();
|
||||
}
|
||||
|
||||
static std::string Execute(const std::wstring& sXmlFile, int mode)
|
||||
static std::string Execute(const std::wstring& sXmlFile, int mode = XML_C14N_1_0, bool withComments = false)
|
||||
{
|
||||
std::string sXml;
|
||||
NSFile::CFileBinary::ReadAllTextUtf8A(sXmlFile, sXml);
|
||||
|
||||
xmlDocPtr xmlDoc = xmlParseMemory((char*)sXml.c_str(), (int)sXml.length());
|
||||
|
||||
return Execute(sXml, mode);
|
||||
return Execute(sXml, mode, withComments);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
17
DesktopEditor/xmlsec/src/XmlCertificate.h
Normal file
17
DesktopEditor/xmlsec/src/XmlCertificate.h
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef _XMLSIGNER_CERTIFICATE_H_
|
||||
#define _XMLSIGNER_CERTIFICATE_H_
|
||||
|
||||
#ifdef WIN32
|
||||
#include "XmlSigner_mscrypto.h"
|
||||
#define CCertificate CCertificate_mscrypto
|
||||
#endif
|
||||
|
||||
#if defined(_LINUX) && !defined(_MAC)
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _MAC
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _XMLSIGNER_CERTIFICATE_H_
|
||||
199
DesktopEditor/xmlsec/src/XmlRels.h
Normal file
199
DesktopEditor/xmlsec/src/XmlRels.h
Normal file
@ -0,0 +1,199 @@
|
||||
#ifndef _XML_RELS_H_
|
||||
#define _XML_RELS_H_
|
||||
|
||||
#include "./XmlCanonicalizator.h"
|
||||
|
||||
class COOXMLRelationship
|
||||
{
|
||||
public:
|
||||
std::wstring rid;
|
||||
std::wstring type;
|
||||
std::wstring target;
|
||||
std::wstring target_mode;
|
||||
|
||||
public:
|
||||
|
||||
COOXMLRelationship()
|
||||
{
|
||||
}
|
||||
|
||||
COOXMLRelationship(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
rid = node.GetAttribute("Id");
|
||||
type = node.GetAttribute("Type");
|
||||
target = node.GetAttribute("Target");
|
||||
|
||||
CheckTargetMode();
|
||||
}
|
||||
|
||||
std::wstring GetXml()
|
||||
{
|
||||
NSStringUtils::CStringBuilder builder;
|
||||
builder.WriteString(L"<Relationship Id=\"");
|
||||
builder.WriteEncodeXmlString(rid);
|
||||
builder.WriteString(L"\" Type=\"");
|
||||
builder.WriteEncodeXmlString(type);
|
||||
builder.WriteString(L"\" Target=\"");
|
||||
builder.WriteEncodeXmlString(target);
|
||||
builder.WriteString(L"\" TargetMode=\"");
|
||||
builder.WriteEncodeXmlString(target_mode);
|
||||
builder.WriteString(L"\" />");
|
||||
return builder.GetData();
|
||||
}
|
||||
|
||||
static bool Compare(const COOXMLRelationship& i, const COOXMLRelationship& j)
|
||||
{
|
||||
return i.rid < j.rid;
|
||||
}
|
||||
|
||||
protected:
|
||||
void CheckTargetMode()
|
||||
{
|
||||
if (0 == target.find(L"http") || 0 == target.find(L"www") || 0 == target.find(L"ftp"))
|
||||
target_mode = L"External";
|
||||
else
|
||||
target_mode = L"Internal";
|
||||
}
|
||||
};
|
||||
|
||||
class COOXMLRelationships
|
||||
{
|
||||
public:
|
||||
std::vector<COOXMLRelationship> rels;
|
||||
|
||||
public:
|
||||
|
||||
COOXMLRelationships()
|
||||
{
|
||||
}
|
||||
|
||||
COOXMLRelationships(const std::string& xml, std::map<std::wstring, bool>* check_need = NULL)
|
||||
{
|
||||
XmlUtils::CXmlNode oNode;
|
||||
if (!oNode.FromXmlStringA(xml))
|
||||
return;
|
||||
|
||||
FromXmlNode(oNode, check_need);
|
||||
}
|
||||
|
||||
COOXMLRelationships(const std::wstring& xml, const bool& is_file, std::map<std::wstring, bool>* check_need = NULL)
|
||||
{
|
||||
XmlUtils::CXmlNode oNode;
|
||||
|
||||
if (!is_file)
|
||||
{
|
||||
if (!oNode.FromXmlString(xml))
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!oNode.FromXmlFile(xml))
|
||||
return;
|
||||
}
|
||||
|
||||
FromXmlNode(oNode, check_need);
|
||||
}
|
||||
|
||||
void FromXmlNode(XmlUtils::CXmlNode& oNode, std::map<std::wstring, bool>* check_need = NULL)
|
||||
{
|
||||
XmlUtils::CXmlNodes oNodes;
|
||||
if (!oNode.GetNodes(L"Relationship", oNodes))
|
||||
return;
|
||||
|
||||
int nCount = oNodes.GetCount();
|
||||
for (int i = 0; i < nCount; ++i)
|
||||
{
|
||||
XmlUtils::CXmlNode oRel;
|
||||
oNodes.GetAt(i, oRel);
|
||||
|
||||
if (NULL == check_need)
|
||||
{
|
||||
rels.push_back(COOXMLRelationship(oRel));
|
||||
}
|
||||
else
|
||||
{
|
||||
std::wstring sRid = oRel.GetAttribute("Id");
|
||||
if (check_need->find(sRid) != check_need->end())
|
||||
rels.push_back(COOXMLRelationship(oRel));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::wstring GetXml()
|
||||
{
|
||||
NSStringUtils::CStringBuilder builder;
|
||||
|
||||
builder.WriteString(L"<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">");
|
||||
|
||||
// sort by rId
|
||||
std::sort(rels.begin(), rels.end(), COOXMLRelationship::Compare);
|
||||
|
||||
for (std::vector<COOXMLRelationship>::iterator i = rels.begin(); i != rels.end(); i++)
|
||||
builder.WriteString(i->GetXml());
|
||||
|
||||
builder.WriteString(L"</Relationships>");
|
||||
|
||||
return builder.GetData();
|
||||
}
|
||||
|
||||
std::wstring GetTransforms()
|
||||
{
|
||||
NSStringUtils::CStringBuilder builder;
|
||||
|
||||
builder.WriteString(L"<Transforms><Transform Algorithm=\"http://schemas.openxmlformats.org/package/2006/RelationshipTransform\">");
|
||||
|
||||
for (std::vector<COOXMLRelationship>::iterator i = rels.begin(); i != rels.end(); i++)
|
||||
{
|
||||
builder.WriteString(L"<mdssi:RelationshipReference xmlns:mdssi=\"http://schemas.openxmlformats.org/package/2006/digital-signature\" SourceId=\"");
|
||||
builder.WriteEncodeXmlString(i->rid);
|
||||
builder.WriteString(L"\" />");
|
||||
}
|
||||
|
||||
builder.WriteString(L"</Transform><Transform Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"/></Transforms>");
|
||||
|
||||
return builder.GetData();
|
||||
}
|
||||
|
||||
void CheckOriginSigs(std::wstring& file)
|
||||
{
|
||||
int rId = 0;
|
||||
std::vector<COOXMLRelationship>::iterator i = rels.begin();
|
||||
while (i != rels.end())
|
||||
{
|
||||
if (0 == i->target.find(L"_xmlsignatures/"))
|
||||
return;
|
||||
|
||||
std::wstring rid = i->rid;
|
||||
rid = rid.substr(3);
|
||||
|
||||
int nTemp = std::stoi(rid);
|
||||
|
||||
if (nTemp > rId)
|
||||
rId = nTemp;
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
std::string sXmlA;
|
||||
NSFile::CFileBinary::ReadAllTextUtf8A(file, sXmlA);
|
||||
|
||||
std::string::size_type pos = sXmlA.rfind("</Relationships>");
|
||||
if (pos == std::string::npos)
|
||||
return;
|
||||
|
||||
rId++;
|
||||
std::string sRet = sXmlA.substr(0, pos);
|
||||
sRet += ("<Relationship Id=\"rId" + std::to_string(rId) + "\" \
|
||||
Type=\"http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/origin\" Target=\"_xmlsignatures/origin.sigs\"/>\
|
||||
</Relationships>");
|
||||
|
||||
NSFile::CFileBinary::Remove(file);
|
||||
|
||||
NSFile::CFileBinary oFile;
|
||||
oFile.CreateFileW(file);
|
||||
oFile.WriteFile((BYTE*)sRet.c_str(), (DWORD)sRet.length());
|
||||
oFile.CloseFile();
|
||||
}
|
||||
};
|
||||
|
||||
#endif //_XML_RELS_H_
|
||||
@ -8,6 +8,9 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#define OOXML_HASH_ALG_SHA1 0
|
||||
#define OOXML_HASH_ALG_INVALID 1
|
||||
|
||||
class ICertificate
|
||||
{
|
||||
public:
|
||||
@ -27,14 +30,26 @@ public:
|
||||
virtual std::string GetCertificateHash() = 0;
|
||||
|
||||
public:
|
||||
virtual std::string Sign(std::string sXml) = 0;
|
||||
virtual std::string GetHash(unsigned char* pData, unsigned int nSize) = 0;
|
||||
virtual std::string GetHash(std::string& sXml) = 0;
|
||||
virtual std::string GetHash(std::wstring& sXmlFile) = 0;
|
||||
virtual bool Verify(std::string& sXml, std::string& sXmlSignature) = 0;
|
||||
virtual std::string Sign(std::string sXml) = 0;
|
||||
virtual std::string GetHash(unsigned char* pData, unsigned int nSize, int nAlg) = 0;
|
||||
virtual std::string GetHash(std::string& sXml, int nAlg) = 0;
|
||||
virtual std::string GetHash(std::wstring& sXmlFile, int nAlg) = 0;
|
||||
virtual bool Verify(std::string& sXml, std::string& sXmlSignature, int nAlg) = 0;
|
||||
|
||||
virtual bool LoadFromBase64Data(const std::string& data) = 0;
|
||||
virtual int ShowCertificate() = 0;
|
||||
|
||||
public:
|
||||
virtual bool ShowSelectDialog() = 0;
|
||||
|
||||
static int GetOOXMLHashAlg(const std::string& sAlg)
|
||||
{
|
||||
if ("http://www.w3.org/2000/09/xmldsig#rsa-sha1" == sAlg ||
|
||||
"http://www.w3.org/2000/09/xmldsig#sha1" == sAlg)
|
||||
return OOXML_HASH_ALG_SHA1;
|
||||
|
||||
return OOXML_HASH_ALG_INVALID;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // _XMLSIGNER_BASE_H_
|
||||
|
||||
@ -14,27 +14,40 @@ public:
|
||||
HCERTSTORE m_store;
|
||||
PCCERT_CONTEXT m_context;
|
||||
|
||||
protected:
|
||||
BYTE* m_rawData;
|
||||
int m_rawDataLen;
|
||||
|
||||
public:
|
||||
CCertificate_mscrypto() : ICertificate()
|
||||
{
|
||||
m_store = NULL;
|
||||
m_context = NULL;
|
||||
|
||||
m_rawData = NULL;
|
||||
m_rawDataLen = 0;
|
||||
}
|
||||
CCertificate_mscrypto(PCCERT_CONTEXT ctx) : ICertificate()
|
||||
{
|
||||
m_store = NULL;
|
||||
m_context = ctx;
|
||||
|
||||
m_rawData = NULL;
|
||||
m_rawDataLen = 0;
|
||||
}
|
||||
|
||||
virtual ~CCertificate_mscrypto()
|
||||
{
|
||||
if (m_store != NULL)
|
||||
if (m_store != NULL || m_rawData != NULL)
|
||||
{
|
||||
if (NULL != m_context)
|
||||
CertFreeCertificateContext(m_context);
|
||||
|
||||
CertCloseStore(m_store, 0);
|
||||
RELEASEARRAYOBJECTS(m_rawData);
|
||||
}
|
||||
|
||||
if (m_store != NULL)
|
||||
CertCloseStore(m_store, 0);
|
||||
}
|
||||
|
||||
public:
|
||||
@ -80,7 +93,7 @@ public:
|
||||
|
||||
virtual std::string GetCertificateHash()
|
||||
{
|
||||
return GetHash(m_context->pbCertEncoded, (unsigned int)m_context->cbCertEncoded);
|
||||
return GetHash(m_context->pbCertEncoded, (unsigned int)m_context->cbCertEncoded, OOXML_HASH_ALG_SHA1);
|
||||
}
|
||||
|
||||
public:
|
||||
@ -153,8 +166,11 @@ public:
|
||||
return sReturn;
|
||||
}
|
||||
|
||||
virtual std::string GetHash(unsigned char* pData, unsigned int nSize)
|
||||
virtual std::string GetHash(unsigned char* pData, unsigned int nSize, int nAlg)
|
||||
{
|
||||
if (nAlg == OOXML_HASH_ALG_INVALID)
|
||||
return "";
|
||||
|
||||
BOOL bResult = TRUE;
|
||||
DWORD dwKeySpec = 0;
|
||||
HCRYPTHASH hHash = NULL;
|
||||
@ -165,10 +181,13 @@ public:
|
||||
|
||||
bResult = CryptAcquireCertificatePrivateKey(m_context, 0, NULL, &hCryptProv, &dwKeySpec, NULL);
|
||||
|
||||
if (!bResult)
|
||||
bResult = CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
|
||||
|
||||
if (!bResult)
|
||||
return "";
|
||||
|
||||
bResult = CryptCreateHash(hCryptProv, CALG_SHA1, 0, 0, &hHash);
|
||||
bResult = CryptCreateHash(hCryptProv, GetHashId(nAlg), 0, 0, &hHash);
|
||||
if (!bResult)
|
||||
{
|
||||
CryptReleaseContext(hCryptProv, 0);
|
||||
@ -218,12 +237,12 @@ public:
|
||||
return sReturn;
|
||||
}
|
||||
|
||||
virtual std::string GetHash(std::string& sXml)
|
||||
virtual std::string GetHash(std::string& sXml, int nAlg)
|
||||
{
|
||||
return GetHash((BYTE*)sXml.c_str(), (DWORD)sXml.length());
|
||||
return GetHash((BYTE*)sXml.c_str(), (DWORD)sXml.length(), nAlg);
|
||||
}
|
||||
|
||||
virtual std::string GetHash(std::wstring& sXmlFile)
|
||||
virtual std::string GetHash(std::wstring& sXmlFile, int nAlg)
|
||||
{
|
||||
BYTE* pFileData = NULL;
|
||||
DWORD dwFileDataLen = 0;
|
||||
@ -232,13 +251,13 @@ public:
|
||||
if (0 == dwFileDataLen)
|
||||
return "";
|
||||
|
||||
std::string sReturn = GetHash(pFileData, dwFileDataLen);
|
||||
std::string sReturn = GetHash(pFileData, dwFileDataLen, nAlg);
|
||||
|
||||
RELEASEARRAYOBJECTS(pFileData);
|
||||
return sReturn;
|
||||
}
|
||||
|
||||
virtual bool Verify(std::string& sXml, std::string& sXmlSignature)
|
||||
virtual bool Verify(std::string& sXml, std::string& sXmlSignature, int nAlg)
|
||||
{
|
||||
DWORD dwKeySpec = 0;
|
||||
HCRYPTHASH hHash = NULL;
|
||||
@ -248,14 +267,17 @@ public:
|
||||
BOOL bResult = CryptAcquireCertificatePrivateKey(m_context, 0, NULL, &hCryptProv, &dwKeySpec, NULL);
|
||||
|
||||
if (!bResult)
|
||||
return FALSE;
|
||||
bResult = CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
|
||||
|
||||
bResult = CryptCreateHash(hCryptProv, CALG_SHA1, 0, 0, &hHash);
|
||||
if (!bResult)
|
||||
return false;
|
||||
|
||||
bResult = CryptCreateHash(hCryptProv, GetHashId(nAlg), 0, 0, &hHash);
|
||||
|
||||
if (!bResult)
|
||||
{
|
||||
CryptReleaseContext(hCryptProv, 0);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
BYTE* pDataHash = NULL;
|
||||
@ -286,6 +308,28 @@ public:
|
||||
return bResultRet && bResult;
|
||||
}
|
||||
|
||||
virtual bool LoadFromBase64Data(const std::string& data)
|
||||
{
|
||||
RELEASEARRAYOBJECTS(m_rawData);
|
||||
if (!NSFile::CBase64Converter::Decode(data.c_str(), (int)data.length(), m_rawData, m_rawDataLen))
|
||||
return false;
|
||||
|
||||
m_context = CertCreateCertificateContext(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, m_rawData, m_rawDataLen);
|
||||
if (!m_context)
|
||||
{
|
||||
RELEASEARRAYOBJECTS(m_rawData);
|
||||
m_rawDataLen = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual int ShowCertificate()
|
||||
{
|
||||
return (int)CryptUIDlgViewContext(CERT_STORE_CERTIFICATE_CONTEXT, m_context, NULL, NULL, 0, NULL);
|
||||
}
|
||||
|
||||
public:
|
||||
virtual bool ShowSelectDialog()
|
||||
{
|
||||
@ -309,6 +353,17 @@ private:
|
||||
for(BYTE* p = dst + size - 1; p >= dst; ++src, --p)
|
||||
(*p) = (*src);
|
||||
}
|
||||
|
||||
ALG_ID GetHashId(int nAlg)
|
||||
{
|
||||
switch (nAlg)
|
||||
{
|
||||
case OOXML_HASH_ALG_SHA1:
|
||||
return CALG_SHA1;
|
||||
default:
|
||||
return CALG_SHA1;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif // _XMLSIGNER_MSCRYPTO_H_
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user