mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-11 02:16:02 +08:00
Compare commits
10 Commits
core-windo
...
core/devel
| Author | SHA1 | Date | |
|---|---|---|---|
| a17a04298a | |||
| f7ba686f0c | |||
| c41385e1ae | |||
| f582a9b690 | |||
| b36c2dbaf9 | |||
| 10b9e9e5e8 | |||
| 1beb5440f9 | |||
| 9a9ba4cc62 | |||
| 5b4c6363bb | |||
| 2026d064ef |
@ -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)
|
||||
{
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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 );
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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",";
|
||||
}
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -20,6 +20,8 @@ private:
|
||||
std::string m_sImageValidBase64;
|
||||
std::string m_sImageInvalidBase64;
|
||||
|
||||
std::wstring m_sFolder;
|
||||
|
||||
private:
|
||||
XmlUtils::CXmlNode m_node; // signature file
|
||||
|
||||
@ -50,16 +52,23 @@ private:
|
||||
return *this;
|
||||
}
|
||||
|
||||
CXmlStackNamespaces GetById(const std::string& id)
|
||||
CXmlStackNamespaces GetById(const std::string& id, const bool& isNameUse = false)
|
||||
{
|
||||
return GetByIdRec(*this, id);
|
||||
return GetByIdRec(*this, id, isNameUse);
|
||||
}
|
||||
|
||||
CXmlStackNamespaces GetByIdRec(CXmlStackNamespaces& stack, const std::string& id)
|
||||
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;
|
||||
@ -90,7 +99,7 @@ private:
|
||||
for (int i = 0; i < nCount; i++)
|
||||
{
|
||||
oNodes.GetAt(i, ret.m_node);
|
||||
CXmlStackNamespaces _retRecursion = ret.GetByIdRec(ret, id);
|
||||
CXmlStackNamespaces _retRecursion = ret.GetByIdRec(ret, id, isNameUse);
|
||||
if (_retRecursion.m_node.IsValid())
|
||||
return _retRecursion;
|
||||
}
|
||||
@ -108,7 +117,15 @@ private:
|
||||
|
||||
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);
|
||||
@ -152,7 +169,7 @@ public:
|
||||
public:
|
||||
void Check()
|
||||
{
|
||||
// 1) get cert
|
||||
// 1) Certificate
|
||||
XmlUtils::CXmlNode oNodeCert = m_node.ReadNode(L"KeyInfo").ReadNode(L"X509Data").ReadNode(L"X509Certificate");
|
||||
if (!oNodeCert.IsValid())
|
||||
{
|
||||
@ -166,28 +183,212 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
// 2) Objects
|
||||
// 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);
|
||||
int nCount = nodesReferences.GetCount();
|
||||
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 nodeRef;
|
||||
nodesReferences.GetAt(i, nodeRef);
|
||||
|
||||
std::string sId = nodeRef.GetAttributeA("URI");
|
||||
if (0 == sId.find("#"))
|
||||
sId = sId.substr(1);
|
||||
|
||||
CXmlStackNamespaces _stack = stack.GetById(sId);
|
||||
std::string sTmp = _stack.GetXml();
|
||||
XML_UNUSED(sTmp);
|
||||
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
|
||||
@ -229,6 +430,7 @@ public:
|
||||
|
||||
COOXMLSignature* pSignature = new COOXMLSignature();
|
||||
pSignature->m_node = nodeSig;
|
||||
pSignature->m_sFolder = m_sFolder;
|
||||
pSignature->Check();
|
||||
|
||||
m_arSignatures.push_back(pSignature);
|
||||
|
||||
@ -181,6 +181,9 @@ 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 "";
|
||||
|
||||
@ -264,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);
|
||||
|
||||
if (!bResult)
|
||||
return false;
|
||||
|
||||
bResult = CryptCreateHash(hCryptProv, GetHashId(nAlg), 0, 0, &hHash);
|
||||
|
||||
if (!bResult)
|
||||
{
|
||||
CryptReleaseContext(hCryptProv, 0);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
BYTE* pDataHash = NULL;
|
||||
|
||||
@ -110,8 +110,9 @@ public:
|
||||
|
||||
virtual std::string Transform(const std::string& xml)
|
||||
{
|
||||
// TODO
|
||||
return xml;
|
||||
if (-1 == m_mode)
|
||||
return xml;
|
||||
return CXmlCanonicalizator::Execute(xml, m_mode, m_comments);
|
||||
}
|
||||
|
||||
virtual void LoadFromXml(XmlUtils::CXmlNode& node)
|
||||
@ -148,6 +149,11 @@ protected:
|
||||
bool m_valid;
|
||||
|
||||
public:
|
||||
CXmlTransforms()
|
||||
{
|
||||
m_valid = true;
|
||||
}
|
||||
|
||||
CXmlTransforms(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
m_valid = true;
|
||||
@ -181,6 +187,25 @@ public:
|
||||
m_transforms.clear();
|
||||
}
|
||||
|
||||
bool GetValid()
|
||||
{
|
||||
return m_valid;
|
||||
}
|
||||
|
||||
std::string Transform(const std::string& xml)
|
||||
{
|
||||
std::string sResult = xml;
|
||||
for (std::vector<IXmlTransform*>::iterator i = m_transforms.begin(); i != m_transforms.end(); i++)
|
||||
{
|
||||
sResult = (*i)->Transform(sResult);
|
||||
}
|
||||
return sResult;
|
||||
}
|
||||
|
||||
void AddTransform(IXmlTransform* transform)
|
||||
{
|
||||
m_transforms.push_back(transform);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //_XML_TRANSFORM_H_
|
||||
|
||||
@ -37,7 +37,9 @@ void main(void)
|
||||
for (std::vector<COOXMLSignature*>::iterator i = oVerifier.m_arSignatures.begin(); i != oVerifier.m_arSignatures.end(); i++)
|
||||
{
|
||||
COOXMLSignature* pSign = *i;
|
||||
int nRes = pSign->GetValid();
|
||||
XML_UNUSED(pSign);
|
||||
XML_UNUSED(nRes);
|
||||
}
|
||||
|
||||
XML_UNUSED(nCount);
|
||||
|
||||
@ -45,7 +45,8 @@ namespace TestDocsWithChart
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
getFilesPivot();
|
||||
getFilesConditional();
|
||||
//getFilesPivot();
|
||||
//getFilesAlternateContent();
|
||||
//getFiles();
|
||||
//convertFiles();
|
||||
@ -74,6 +75,45 @@ namespace TestDocsWithChart
|
||||
|
||||
}
|
||||
}
|
||||
static void getFilesConditional()
|
||||
{
|
||||
//string sFindText = "conditionalFormatting";
|
||||
//string sDirInput = @"\\192.168.3.208\allusers\Files\XLSX";
|
||||
//string sDirOutput = @"D:\Files\Conditional";
|
||||
string sFindText = "type=\"expression\"";
|
||||
string sDirInput = @"D:\Files\Conditional";
|
||||
string sDirOutput = @"D:\Files\ConditionalFormulaExpression";
|
||||
String[] allfiles = System.IO.Directory.GetFiles(sDirInput, "*.*", System.IO.SearchOption.AllDirectories);
|
||||
|
||||
for (var i = 0; i < allfiles.Length; ++i)
|
||||
{
|
||||
string file = allfiles[i];
|
||||
try
|
||||
{
|
||||
ZipArchive zip = ZipFile.OpenRead(file);
|
||||
string sOutputPath = Path.Combine(sDirOutput, Path.GetFileName(file));
|
||||
foreach (ZipArchiveEntry entry in zip.Entries)
|
||||
{
|
||||
if (entry.FullName.EndsWith(".xml", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(entry.Open(), Encoding.UTF8))
|
||||
{
|
||||
string sXml = reader.ReadToEnd();
|
||||
if (-1 != sXml.IndexOf(sFindText))
|
||||
{
|
||||
System.IO.File.Copy(file, sOutputPath, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
static void getFilesAlternateContent()
|
||||
{
|
||||
string sAlternateContent = ":Choice ";
|
||||
|
||||
Reference in New Issue
Block a user