x2t - ...

This commit is contained in:
ElenaSubbotina
2019-03-25 13:50:29 +03:00
parent 441aa277e3
commit 498d58e856
28 changed files with 226 additions and 94 deletions

View File

@ -774,7 +774,10 @@ namespace DocFileFormat
{ {
return (std::to_wstring(value)); return (std::to_wstring(value));
} }
static inline std::wstring IntToWideString(size_t value)
{
return (std::to_wstring((unsigned int)value));
}
static inline std::wstring DoubleToWideString(double value) static inline std::wstring DoubleToWideString(double value)
{ {
std::wstringstream src; std::wstringstream src;

View File

@ -87,15 +87,14 @@ namespace DocFileFormat
} }
else else
{ {
m_nDTTM = reader->ReadUInt32(); m_nDTTM = DateAndTime(reader->ReadUInt32());
reader->ReadUInt16(); //padding1 reader->ReadUInt16(); //padding1
m_nDepth = reader->ReadUInt32(); m_nDepth = reader->ReadUInt32();
m_nDiatrdParent = reader->ReadUInt32(); m_nDiatrdParent = reader->ReadUInt32();
unsigned int flag = reader->ReadUInt32(); unsigned int flag = reader->ReadUInt32();
m_fInkAtn = GETBIT(flag, 1); m_fInkAtn = GETBIT(flag, 1);
} }
return static_cast<ByteStructure*>(newObject); return static_cast<ByteStructure*>(newObject);
} }
} }

View File

@ -32,6 +32,7 @@
#pragma once #pragma once
#include "ByteStructure.h" #include "ByteStructure.h"
#include "DateAndTime.h"
namespace DocFileFormat namespace DocFileFormat
{ {
@ -72,7 +73,7 @@ namespace DocFileFormat
return (nWordVersion > 0) ? STRUCTURE_SIZE_OLD : STRUCTURE_SIZE; return (nWordVersion > 0) ? STRUCTURE_SIZE_OLD : STRUCTURE_SIZE;
} }
AnnotationReferenceExDescriptor() : m_nDTTM(0), m_nDepth(0), m_nDiatrdParent(0), m_fInkAtn(false) AnnotationReferenceExDescriptor() : m_nDepth(0), m_nDiatrdParent(0), m_fInkAtn(false)
{ {
} }
@ -82,7 +83,7 @@ namespace DocFileFormat
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length ); virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length );
unsigned int m_nDTTM; DateAndTime m_nDTTM;
unsigned int m_nDepth; unsigned int m_nDepth;
unsigned int m_nDiatrdParent; unsigned int m_nDiatrdParent;
bool m_fInkAtn; bool m_fInkAtn;

View File

@ -85,9 +85,11 @@ namespace DocFileFormat
if (author_str) if (author_str)
{ {
XMLTools::XMLAttribute author( L"w:author", FormatUtils::XmlEncode(*author_str)); XMLTools::XMLAttribute author( L"w:author", FormatUtils::XmlEncode(*author_str));
rPrChange.AppendAttribute( author ); rPrChange.AppendAttribute( author );
} }
XMLTools::XMLAttribute date( L"w:date", _revisionData->Dttm.getString());
rPrChange.AppendAttribute( date );
//convert revision stack //convert revision stack
convertSprms( _revisionData->Changes, &rPrChange ); convertSprms( _revisionData->Changes, &rPrChange );

View File

@ -92,7 +92,7 @@ namespace DocFileFormat
} }
m_pXmlWriter->WriteNodeBegin( L"w:comment", TRUE ); m_pXmlWriter->WriteNodeBegin( L"w:comment", TRUE );
if (atrdPre10->m_BookmarkId < 0) if (atrdPre10->m_BookmarkId < 0)//-1 - easy ref (not start/end comment ref)
{ {
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 + count + 1024 )); m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 + count + 1024 ));
} }
@ -100,10 +100,10 @@ namespace DocFileFormat
{ {
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 )); m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 ));
} }
//if (atrdPost10) if (atrdPost10)
//{ {
// atrdPost10->Date.Convert(new DateMapping(_writer)); m_pXmlWriter->WriteAttribute( L"w:date", atrdPost10->m_nDTTM.getString());
//} }
if (atrdPre10->m_AuthorIndex < m_document->AnnotationOwners->size()) //conv_253l2H1CehgKwsxCtNk__docx.doc if (atrdPre10->m_AuthorIndex < m_document->AnnotationOwners->size()) //conv_253l2H1CehgKwsxCtNk__docx.doc
{ {
m_pXmlWriter->WriteAttribute( L"w:author", m_pXmlWriter->WriteAttribute( L"w:author",

View File

@ -83,6 +83,14 @@ namespace DocFileFormat
//throw new ByteParseException("Cannot parse the struct DTTM, the length of the struct doesn't match"); //throw new ByteParseException("Cannot parse the struct DTTM, the length of the struct doesn't match");
} }
} }
std::wstring getString()
{
return std::to_wstring(yr) + L"-" + (mon < 9 ? L"0" : L"" ) + std::to_wstring(mon) + L"-" +
(dom < 9 ? L"0" : L"" ) + std::to_wstring(dom) + L"T" +
(hr < 9 ? L"0" : L"" ) + std::to_wstring(hr) + L":" +
(mint < 9 ? L"0" : L"" )+ std::to_wstring(mint) + L"Z";
}
#if defined(_WIN32) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN64)
SYSTEMTIME ToSYSTEMTIME() SYSTEMTIME ToSYSTEMTIME()
{ {

View File

@ -406,8 +406,8 @@ namespace DocFileFormat
//if it's a inserted run //if it's a inserted run
m_pXmlWriter->WriteNodeBegin(L"w:ins", true); m_pXmlWriter->WriteNodeBegin(L"w:ins", true);
m_pXmlWriter->WriteAttribute(L"w:author", FormatUtils::XmlEncode(*author)); m_pXmlWriter->WriteAttribute(L"w:author", FormatUtils::XmlEncode(*author));
m_pXmlWriter->WriteAttribute(L"w:date", FormatUtils::XmlEncode(rev.Dttm.getString()));
m_pXmlWriter->WriteNodeEnd(L"", true, false); m_pXmlWriter->WriteNodeEnd(L"", true, false);
//rev.Dttm.Convert(new DateMapping(m_pXmlWriter));
} }
//start run //start run
@ -1079,7 +1079,15 @@ namespace DocFileFormat
else if ((m_document->AnnotationsReferencePlex) && (_commentNr <= m_document->AnnotationsReferencePlex->Elements.size())) else if ((m_document->AnnotationsReferencePlex) && (_commentNr <= m_document->AnnotationsReferencePlex->Elements.size()))
{ {
m_pXmlWriter->WriteNodeBegin( L"w:commentReference", true ); m_pXmlWriter->WriteNodeBegin( L"w:commentReference", true );
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( _commentNr++ ));
int index = _commentNr++;
AnnotationReferenceDescriptor* atrdPre10 = static_cast<AnnotationReferenceDescriptor*>(m_document->AnnotationsReferencePlex->Elements[index - 1]);
if (atrdPre10->m_BookmarkId < 0)
index += m_document->AnnotationsReferencePlex->Elements.size() + 1024;
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString(index));
m_pXmlWriter->WriteNodeEnd( L"", true ); m_pXmlWriter->WriteNodeEnd( L"", true );
} }
} }
@ -1792,7 +1800,7 @@ namespace DocFileFormat
if (m_document->AnnotStartEndCPs[i].second == cp) if (m_document->AnnotStartEndCPs[i].second == cp)
{ {
result = writeAnnotationEnd(i + 1); result = writeAnnotationEnd(i + 1);
_commentNr = i + 1; //_commentNr = i + 1;
} }
} }

View File

@ -89,7 +89,7 @@ namespace DocFileFormat
GroupContainer* group = static_cast<GroupContainer*>(groupChild); GroupContainer* group = static_cast<GroupContainer*>(groupChild);
if (group) if (group)
{ {
group->Index = i; group->Index = (int)i;
} }
} }
else if (ShapeContainer::TYPE_CODE_0xF004 == groupChild->TypeCode) else if (ShapeContainer::TYPE_CODE_0xF004 == groupChild->TypeCode)

View File

@ -84,7 +84,7 @@ namespace DocFileFormat
Text(NULL), RevisionAuthorTable(NULL), FontTable(NULL), BookmarkNames(NULL), AutoTextNames(NULL), Text(NULL), RevisionAuthorTable(NULL), FontTable(NULL), BookmarkNames(NULL), AutoTextNames(NULL),
IndividualFootnotesPlex(NULL), FootnoteReferenceCharactersPlex(NULL), IndividualEndnotesPlex(NULL), IndividualFootnotesPlex(NULL), FootnoteReferenceCharactersPlex(NULL), IndividualEndnotesPlex(NULL),
EndnoteReferenceCharactersPlex(NULL), FieldsPlex(NULL), FootnoteDocumentFieldsPlex(NULL), EndnoteReferenceCharactersPlex(NULL), FieldsPlex(NULL), FootnoteDocumentFieldsPlex(NULL),
EndnoteDocumentFieldsPlex(NULL), HeadersAndFootersDocumentFieldsPlex(NULL), HeaderStoriesPlex(NULL), EndnoteDocumentFieldsPlex(NULL), HeadersAndFootersDocumentFieldsPlex(NULL), HeaderStoriesPlex(NULL), AnnotationsFieldsPlex(NULL),
AnnotationsReferencePlex(NULL), AnnotationsReferenceExPlex(NULL), IndividualCommentsPlex(NULL), TextboxBreakPlex(NULL), TextboxBreakPlexHeader(NULL), AnnotationsReferencePlex(NULL), AnnotationsReferenceExPlex(NULL), IndividualCommentsPlex(NULL), TextboxBreakPlex(NULL), TextboxBreakPlexHeader(NULL),
TextboxIndividualPlex(NULL),AssocNames(NULL), BookmarkAnnotNames(NULL), Captions(NULL), AutoCaptions(NULL), ListPlex(NULL), TextboxIndividualPlex(NULL),AssocNames(NULL), BookmarkAnnotNames(NULL), Captions(NULL), AutoCaptions(NULL), ListPlex(NULL),
OfficeDrawingPlex(NULL), OfficeDrawingPlexHeader(NULL), SectionPlex(NULL), BookmarkStartPlex(NULL), BookmarkEndPlex(NULL), OfficeDrawingPlex(NULL), OfficeDrawingPlexHeader(NULL), SectionPlex(NULL), BookmarkStartPlex(NULL), BookmarkEndPlex(NULL),
@ -353,7 +353,7 @@ namespace DocFileFormat
TextboxIndividualPlex = new Plex<FTXBXS> (FTXBXS::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcftxbxTxt, FIB->m_FibWord97.lcbPlcftxbxTxt, nWordVersion); TextboxIndividualPlex = new Plex<FTXBXS> (FTXBXS::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcftxbxTxt, FIB->m_FibWord97.lcbPlcftxbxTxt, nWordVersion);
SectionPlex = new Plex<SectionDescriptor> (SectionDescriptor::GetSize(nWordVersion), TableStream, FIB->m_FibWord97.fcPlcfSed, FIB->m_FibWord97.lcbPlcfSed, nWordVersion); SectionPlex = new Plex<SectionDescriptor> (SectionDescriptor::GetSize(nWordVersion), TableStream, FIB->m_FibWord97.fcPlcfSed,FIB->m_FibWord97.lcbPlcfSed, nWordVersion);
BookmarkStartPlex = new Plex<BookmarkFirst> (BookmarkFirst::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBkf, FIB->m_FibWord97.lcbPlcfBkf, nWordVersion); BookmarkStartPlex = new Plex<BookmarkFirst> (BookmarkFirst::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBkf, FIB->m_FibWord97.lcbPlcfBkf, nWordVersion);
BookmarkEndPlex = new Plex<EmptyStructure> (EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBkl, FIB->m_FibWord97.lcbPlcfBkl, nWordVersion); BookmarkEndPlex = new Plex<EmptyStructure> (EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBkl, FIB->m_FibWord97.lcbPlcfBkl, nWordVersion);
@ -387,10 +387,13 @@ namespace DocFileFormat
} }
AutoTextPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfGlsy, FIB->m_FibWord97.lcbPlcfGlsy, nWordVersion); AutoTextPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfGlsy, FIB->m_FibWord97.lcbPlcfGlsy, nWordVersion);
FieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldMom, FIB->m_FibWord97.lcbPlcfFldMom, nWordVersion); FieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldMom, FIB->m_FibWord97.lcbPlcfFldMom, nWordVersion);
FootnoteDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldFtn, FIB->m_FibWord97.lcbPlcfFldFtn, nWordVersion); FootnoteDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldFtn, FIB->m_FibWord97.lcbPlcfFldFtn, nWordVersion);
EndnoteDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldEdn, FIB->m_FibWord97.lcbPlcfFldEdn, nWordVersion); EndnoteDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldEdn, FIB->m_FibWord97.lcbPlcfFldEdn, nWordVersion);
HeadersAndFootersDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldHdr, FIB->m_FibWord97.lcbPlcfFldHdr, nWordVersion); HeadersAndFootersDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldHdr, FIB->m_FibWord97.lcbPlcfFldHdr, nWordVersion);
AnnotationsFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldAtn, FIB->m_FibWord97.lcbPlcfFldAtn, nWordVersion);
ListPlex = new Plex<ListNumCache> (ListNumCache::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBteLvc, FIB->m_FibWord97.lcbPlcfBteLvc, nWordVersion); ListPlex = new Plex<ListNumCache> (ListNumCache::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBteLvc, FIB->m_FibWord97.lcbPlcfBteLvc, nWordVersion);
if (m_pCallFunc) if (m_pCallFunc)
@ -872,6 +875,7 @@ namespace DocFileFormat
RELEASEOBJECT(FootnoteDocumentFieldsPlex); RELEASEOBJECT(FootnoteDocumentFieldsPlex);
RELEASEOBJECT(EndnoteDocumentFieldsPlex); RELEASEOBJECT(EndnoteDocumentFieldsPlex);
RELEASEOBJECT(HeadersAndFootersDocumentFieldsPlex); RELEASEOBJECT(HeadersAndFootersDocumentFieldsPlex);
RELEASEOBJECT(AnnotationsFieldsPlex);
RELEASEOBJECT(HeaderStoriesPlex); RELEASEOBJECT(HeaderStoriesPlex);
RELEASEOBJECT(IndividualCommentsPlex); RELEASEOBJECT(IndividualCommentsPlex);
RELEASEOBJECT(AnnotationsReferencePlex); RELEASEOBJECT(AnnotationsReferencePlex);

View File

@ -224,6 +224,7 @@ namespace DocFileFormat
Plex<FieldCharacter> *FootnoteDocumentFieldsPlex; Plex<FieldCharacter> *FootnoteDocumentFieldsPlex;
Plex<FieldCharacter> *EndnoteDocumentFieldsPlex; Plex<FieldCharacter> *EndnoteDocumentFieldsPlex;
Plex<FieldCharacter> *HeadersAndFootersDocumentFieldsPlex; Plex<FieldCharacter> *HeadersAndFootersDocumentFieldsPlex;
Plex<FieldCharacter> *AnnotationsFieldsPlex;
Plex<AnnotationReferenceDescriptor> *AnnotationsReferencePlex; Plex<AnnotationReferenceDescriptor> *AnnotationsReferencePlex;
Plex<AnnotationReferenceExDescriptor> *AnnotationsReferenceExPlex; Plex<AnnotationReferenceExDescriptor> *AnnotationsReferenceExPlex;
Plex<EmptyStructure> *AutoTextPlex; Plex<EmptyStructure> *AutoTextPlex;

View File

@ -2,20 +2,17 @@
Microsoft Visual Studio Solution File, Format Version 9.00 Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005 # Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocFormatLib", "..\DocFormatLib\Win32\DocFormatLib.vcproj", "{C5371405-338F-4B70-83BD-2A5CDF64F383}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocFormatLib", "..\DocFormatLib\Win32\DocFormatLib.vcproj", "{C5371405-338F-4B70-83BD-2A5CDF64F383}"
ProjectSection(ProjectDependencies) = postProject
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C} = {C27E9A9F-3A17-4482-9C5F-BF15C01E747C}
{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D} = {77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}
EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XlsFormat", "..\..\ASCOfficeXlsFile2\source\win32\XlsFormat.vcproj", "{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XlsFormat", "..\..\ASCOfficeXlsFile2\source\win32\XlsFormat.vcproj", "{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocFormatTest", "DocFormatTest.vcproj", "{0F49D5D1-A8D3-4F97-8BC1-E2F65BB00C10}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocFormatTest", "DocFormatTest.vcproj", "{0F49D5D1-A8D3-4F97-8BC1-E2F65BB00C10}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{C5371405-338F-4B70-83BD-2A5CDF64F383} = {C5371405-338F-4B70-83BD-2A5CDF64F383}
{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D} = {77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}
{36636678-AE25-4BE6-9A34-2561D1BCF302} = {36636678-AE25-4BE6-9A34-2561D1BCF302} {36636678-AE25-4BE6-9A34-2561D1BCF302} = {36636678-AE25-4BE6-9A34-2561D1BCF302}
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0} {A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF} = {3423EC9A-52E4-4A4D-9753-EDEBC38785EF} {3423EC9A-52E4-4A4D-9753-EDEBC38785EF} = {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C} = {C27E9A9F-3A17-4482-9C5F-BF15C01E747C} {C27E9A9F-3A17-4482-9C5F-BF15C01E747C} = {C27E9A9F-3A17-4482-9C5F-BF15C01E747C}
{C5371405-338F-4B70-83BD-2A5CDF64F383} = {C5371405-338F-4B70-83BD-2A5CDF64F383}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocxFormat", "..\..\Common\DocxFormat\Projects\DocxFormat2005.vcproj", "{A100103A-353E-45E8-A9B8-90B87CC5C0B0}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocxFormat", "..\..\Common\DocxFormat\Projects\DocxFormat2005.vcproj", "{A100103A-353E-45E8-A9B8-90B87CC5C0B0}"

View File

@ -36,8 +36,6 @@
namespace XLS namespace XLS
{ {
// Logical representation of Dimensions record in BIFF8
class Dimensions: public BiffRecord class Dimensions: public BiffRecord
{ {
BIFF_RECORD_DEFINE_TYPE_INFO(Dimensions) BIFF_RECORD_DEFINE_TYPE_INFO(Dimensions)
@ -47,11 +45,10 @@ public:
~Dimensions(); ~Dimensions();
BaseObjectPtr clone(); BaseObjectPtr clone();
void readFields(CFRecord& record); void readFields(CFRecord& record);
static const ElementType type = typeDimensions; static const ElementType type = typeDimensions;
int serialize(std::wostream & stream); int serialize(std::wostream & stream);

View File

@ -40,18 +40,15 @@ DropDownObjIds::DropDownObjIds()
{ {
} }
DropDownObjIds::~DropDownObjIds() DropDownObjIds::~DropDownObjIds()
{ {
} }
BaseObjectPtr DropDownObjIds::clone() BaseObjectPtr DropDownObjIds::clone()
{ {
return BaseObjectPtr(new DropDownObjIds(*this)); return BaseObjectPtr(new DropDownObjIds(*this));
} }
void DropDownObjIds::readFields(CFRecord& record) void DropDownObjIds::readFields(CFRecord& record)
{ {
FrtHeader frtHeader(rt_DropDownObjIds); FrtHeader frtHeader(rt_DropDownObjIds);

View File

@ -32,13 +32,10 @@
#pragma once #pragma once
#include "BiffRecord.h" #include "BiffRecord.h"
#include <Logic/Biff_structures/DropDownObjId.h> #include "../Biff_structures/DropDownObjId.h"
namespace XLS namespace XLS
{ {
// Logical representation of DropDownObjIds record in BIFF8
class DropDownObjIds: public BiffRecord class DropDownObjIds: public BiffRecord
{ {
BIFF_RECORD_DEFINE_TYPE_INFO(DropDownObjIds) BIFF_RECORD_DEFINE_TYPE_INFO(DropDownObjIds)
@ -48,7 +45,6 @@ public:
~DropDownObjIds(); ~DropDownObjIds();
BaseObjectPtr clone(); BaseObjectPtr clone();
void readFields(CFRecord& record); void readFields(CFRecord& record);

View File

@ -179,10 +179,7 @@ void Obj::readFields(CFRecord& record)
old_version.anchor->loadFields(record); old_version.anchor->loadFields(record);
record >> nMacrosSize; record >> nMacrosSize;
record.skipNunBytes(2); record.skipNunBytes(6);
record >> nNameLen;
record.skipNunBytes(2);
if(OBJ_Line == cmo.ot) if(OBJ_Line == cmo.ot)
{ {
@ -190,6 +187,26 @@ void Obj::readFields(CFRecord& record)
record >> old_version.flag; record >> old_version.flag;
record >> old_version.flag2; record >> old_version.flag2;
} }
else if(OBJ_DropdownList == cmo.ot)
{
old_version.bFill = true;
record >> old_version.fill;
record >> old_version.line;
record.skipNunBytes(6);
short iVal, iMin, iMax, dInc, dPage, fHoriz, dxScroll, grbit, ifnt;
record >> iVal >> iMin >> iMax >> dInc >> dPage >> fHoriz >> dxScroll >> grbit;
record.skipNunBytes(18);
record >> ifnt;
record.skipNunBytes(14);
short xLeft, yTop, xRight, yBot;
record >> xLeft >> yTop >> xRight >> yBot;
record.skipNunBytes(4);
}
else else
{ {
old_version.bFill = true; old_version.bFill = true;
@ -261,9 +278,38 @@ void Obj::readFields(CFRecord& record)
old_version.name = txO->name; old_version.name = txO->name;
} }
else if(OBJ_DropdownList == cmo.ot)
{
record >> old_version.name;
short cbFmla1, cbFmla2, cbFmla3;
ObjectParsedFormula fmla1, fmla2, fmla3;
record >> cbFmla1;
if (cbFmla1 > 0)
{
fmla1.load(record);
}
record >> cbFmla2;
if (cbFmla2 > 0)
{
fmla2.load(record);
}
record >> cbFmla3;
if (cbFmla3 > 0)
{
fmla3.load(record);
}
short cLines, iSel, flag1, flag2, cLine, dxMin;
record >> cLines >> iSel >> flag1;
record.skipNunBytes(2);
record >> flag2 >> cLine >> dxMin;
//record.skipNunBytes(2);
}
else else
{ {
if (nNameLen > 0) //if (nNameLen > 0)
{ {
record >> old_version.name; record >> old_version.name;
} }

View File

@ -95,8 +95,8 @@ public:
bool bFill = false; bool bFill = false;
ShortXLAnsiString name; ShortXLAnsiString name;
_UINT32 fill = 0; _UINT32 fill = 0;//(icvBack, icvFore, fls, fAuto)
_UINT32 line = 0; _UINT32 line = 0;//(icv, lns, lnw, fAuto)
_UINT16 flag = 0; _UINT16 flag = 0;
_UINT16 flag2 = 0; _UINT16 flag2 = 0;
}old_version; }old_version;

View File

@ -50,7 +50,6 @@ BaseObjectPtr Sort::clone()
return BaseObjectPtr(new Sort(*this)); return BaseObjectPtr(new Sort(*this));
} }
void Sort::readFields(CFRecord& record) void Sort::readFields(CFRecord& record)
{ {
unsigned short flags; unsigned short flags;
@ -68,20 +67,52 @@ void Sort::readFields(CFRecord& record)
unsigned char cchKey2; unsigned char cchKey2;
unsigned char cchKey3; unsigned char cchKey3;
record >> cchKey1 >> cchKey2 >> cchKey3; record >> cchKey1 >> cchKey2 >> cchKey3;
if(cchKey1)
if (record.getGlobalWorkbookInfo()->Version >= 0x0600)
{ {
stKey1.setSize(cchKey1); XLUnicodeStringNoCch stKey1_, stKey2_, stKey3_;
record >> stKey1;
if(cchKey1)
{
stKey1_.setSize(cchKey1);
record >> stKey1_;
stKey1 = stKey1_.value();
}
if(cchKey2)
{
stKey2_.setSize(cchKey2);
record >> stKey2_;
stKey2 = stKey2_.value();
}
if(cchKey3)
{
stKey3_.setSize(cchKey3);
record >> stKey3_;
stKey3 = stKey3_.value();
}
} }
if(cchKey2) else
{ {
stKey2.setSize(cchKey2); LPAnsiStringNoCch stKey1_, stKey2_, stKey3_;
record >> stKey2;
} if(cchKey1)
if(cchKey3) {
{ stKey1_.setSize(cchKey1);
stKey3.setSize(cchKey3); record >> stKey1_;
record >> stKey3; stKey1 = stKey1_.value();
}
if(cchKey2)
{
stKey2_.setSize(cchKey2);
record >> stKey2_;
stKey2 = stKey2_.value();
}
if(cchKey3)
{
stKey3_.setSize(cchKey3);
record >> stKey3_;
stKey3 = stKey3_.value();
}
} }
record.skipNunBytes(1); // reserved record.skipNunBytes(1); // reserved
} }

View File

@ -63,9 +63,9 @@ public:
_INT16 iOrder; _INT16 iOrder;
bool fAltMethod; bool fAltMethod;
XLUnicodeStringNoCch stKey1; std::wstring stKey1;
XLUnicodeStringNoCch stKey2; std::wstring stKey2;
XLUnicodeStringNoCch stKey3; std::wstring stKey3;
}; };
} // namespace XLS } // namespace XLS

View File

@ -36,13 +36,11 @@
namespace XLS namespace XLS
{ {
BiffStructurePtr DropDownObjId::clone() BiffStructurePtr DropDownObjId::clone()
{ {
return BiffStructurePtr(new DropDownObjId(*this)); return BiffStructurePtr(new DropDownObjId(*this));
} }
void DropDownObjId::load(CFRecord& record) void DropDownObjId::load(CFRecord& record)
{ {
record >> id; record >> id;

View File

@ -49,7 +49,6 @@ public:
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
ObjId id; ObjId id;
}; };

View File

@ -74,7 +74,7 @@ public:
unsigned short nElems, nElemsAlloc; unsigned short nElems, nElemsAlloc;
unsigned short cbElem; unsigned short cbElem;
int pos1 = record.getRdPtr(); size_t pos1 = record.getRdPtr();
record >> nElems >> nElemsAlloc >> cbElem; record >> nElems >> nElemsAlloc >> cbElem;

View File

@ -59,7 +59,7 @@ public:
XLS::BiffStructurePtr clone() XLS::BiffStructurePtr clone()
{ {
return XLS::BiffStructurePtr(new OfficeArtBlip(recType)); return XLS::BiffStructurePtr(new OfficeArtBlip((unsigned short)recType));
} }
static const XLS::ElementType type = XLS::typeOfficeArtBlip; static const XLS::ElementType type = XLS::typeOfficeArtBlip;

View File

@ -36,8 +36,6 @@
namespace XLS namespace XLS
{ {
// Logical representation of AUTOFILTER union of records
class AUTOFILTER: public CompositeObject class AUTOFILTER: public CompositeObject
{ {
BASE_OBJECT_DEFINE_CLASS_NAME(AUTOFILTER) BASE_OBJECT_DEFINE_CLASS_NAME(AUTOFILTER)
@ -57,7 +55,7 @@ public:
std::vector<BaseObjectPtr> m_arSORTDATA12; std::vector<BaseObjectPtr> m_arSORTDATA12;
GlobalWorkbookInfoPtr pGlobalWorkbookInfoPtr; GlobalWorkbookInfoPtr global_info_;
}; };

View File

@ -42,7 +42,6 @@
namespace XLS namespace XLS
{ {
AUTOFILTER::AUTOFILTER() AUTOFILTER::AUTOFILTER()
{ {
} }
@ -87,11 +86,11 @@ const bool AUTOFILTER::loadContent(BinProcessor& proc)
return false; return false;
} }
pGlobalWorkbookInfoPtr = proc.getGlobalWorkbookInfo(); global_info_ = proc.getGlobalWorkbookInfo();
m_AutoFilterInfo = elements_.back(); m_AutoFilterInfo = elements_.back();
elements_.pop_back(); elements_.pop_back();
int count = proc.repeated<Parenthesis_AUTOFILTER_1>(0, 0); int count = proc.repeated<Parenthesis_AUTOFILTER_1>(0, 0);
while(count > 0) while(count > 0)
{ {
@ -139,13 +138,13 @@ int AUTOFILTER::serialize(std::wostream & stream)
AutoFilterInfo *info = dynamic_cast<AutoFilterInfo*>(m_AutoFilterInfo.get()); AutoFilterInfo *info = dynamic_cast<AutoFilterInfo*>(m_AutoFilterInfo.get());
std::map<std::wstring, std::vector<std::wstring>>::iterator it = pGlobalWorkbookInfoPtr->mapDefineNames.find(L"_xlnm._FilterDatabase"); std::map<std::wstring, std::vector<std::wstring>>::iterator it = global_info_->mapDefineNames.find(L"_xlnm._FilterDatabase");
if (it == pGlobalWorkbookInfoPtr->mapDefineNames.end()) return 0; if (it == global_info_->mapDefineNames.end()) return 0;
int count_columns = info->cEntries; int count_columns = info->cEntries;
size_t ind = pGlobalWorkbookInfoPtr->current_sheet; size_t ind = global_info_->current_sheet;
std::wstring ref; std::wstring ref;
if (ind < it->second.size() && ind >= 0) if (ind < it->second.size() && ind >= 0)
@ -159,7 +158,7 @@ int AUTOFILTER::serialize(std::wostream & stream)
} }
if (ref.empty()) return 0; if (ref.empty()) return 0;
std::wstring sheet_name = ind <= pGlobalWorkbookInfoPtr->sheets_info.size() ? pGlobalWorkbookInfoPtr->sheets_info[ind-1].name : L""; std::wstring sheet_name = ind <= global_info_->sheets_info.size() ? global_info_->sheets_info[ind-1].name : L"";
if (!sheet_name.empty()) if (!sheet_name.empty())
{ {
int pos = ref.find(sheet_name); int pos = ref.find(sheet_name);

View File

@ -54,6 +54,9 @@
#include "Biff_records/List12.h" #include "Biff_records/List12.h"
#include "Biff_records/PLV.h" #include "Biff_records/PLV.h"
#include "Biff_records/CFEx.h" #include "Biff_records/CFEx.h"
#include "Biff_records/Country.h"
#include "Biff_records/WsBool.h"
#include "Biff_records/ExternSheet.h"
#include "Biff_unions/BACKGROUND.h" #include "Biff_unions/BACKGROUND.h"
#include "Biff_unions/BIGNAME.h" #include "Biff_unions/BIGNAME.h"
@ -490,6 +493,51 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
count--; count--;
} }
}break; }break;
case rt_Window1: //biff5
{
count = proc.repeated<Window1>(0, 0);
while(count > 0)
{
//m_arWindow1.insert(m_arWindow1.begin(), elements_.back());
elements_.pop_back();
count--;
}
}break;
case rt_Country: //biff5
{
if (proc.optional<Country>())
{
Country *Country_ = dynamic_cast<Country*>(elements_.back().get());
if (Country_)
{
int countryDef = Country_->iCountryDef;
int countryWinIni = Country_->iCountryWinIni;
global_info_->CodePage;
}
//m_Country = elements_.back();
elements_.pop_back();
}
}break;
case rt_WsBool: //biff5
{
bool is_dialog;
WsBool wsbool_template(is_dialog);
if (proc.optional(wsbool_template)) // The most interesting
{
//m_WsBool = elements_.back();
elements_.pop_back();
}
}break;
case rt_ExternSheet: //biff5
{
if (proc.optional<ExternSheet>())
{
//m_ExternSheet = elements_.back();
elements_.pop_back();
}
}break;
default://unknown .... skip default://unknown .... skip
{ {
proc.SkipRecord(); proc.SkipRecord();

View File

@ -300,8 +300,8 @@ private:
{ {
std::vector<std::wstring> oArrayParams; std::vector<std::wstring> oArrayParams;
NSStringUtils::ParseString(_T(" "), strFormula, oArrayParams); NSStringUtils::ParseString(_T(" "), strFormula, oArrayParams);
int nCount = oArrayParams.size(); size_t nCount = oArrayParams.size();
if (0 >= nCount) if (nCount == 0)
return; return;
bool bRes = true; bool bRes = true;
@ -387,14 +387,14 @@ private:
} }
void AddFormula(std::wstring strFormula) void AddFormula(std::wstring strFormula)
{ {
CFormula oFormula(m_arFormulas.size()); CFormula oFormula((int)m_arFormulas.size());
oFormula.FromString(strFormula, m_lShapeWidth, m_lShapeHeight); oFormula.FromString(strFormula, m_lShapeWidth, m_lShapeHeight);
m_arFormulas.push_back(oFormula); m_arFormulas.push_back(oFormula);
m_arResults.push_back(0xFFFFFFFF); m_arResults.push_back(0xFFFFFFFF);
} }
void AddFormula(CFormula oFormula) void AddFormula(CFormula oFormula)
{ {
oFormula.m_lIndex = m_arFormulas.size(); oFormula.m_lIndex = (int)m_arFormulas.size();
m_arFormulas.push_back(oFormula); m_arFormulas.push_back(oFormula);
m_arResults.push_back(0xFFFFFFFF); m_arResults.push_back(0xFFFFFFFF);
} }

View File

@ -526,7 +526,7 @@ namespace NSCustomShapesConvert
if (NULL == ppArray) if (NULL == ppArray)
return; return;
int nCount = this->m_arPoints.size(); size_t nCount = this->m_arPoints.size();
nCountOut = 2 * (nCount + 1); nCountOut = 2 * (nCount + 1);
@ -540,7 +540,7 @@ namespace NSCustomShapesConvert
if (bR) if (bR)
{ {
for (int nIndex = 0; nIndex < nCount; ++nIndex) for (size_t nIndex = 0; nIndex < nCount; ++nIndex)
{ {
*pBuffer = (this->m_arPoints[nIndex].dX + pointCur.dX); ++pBuffer; *pBuffer = (this->m_arPoints[nIndex].dX + pointCur.dX); ++pBuffer;
*pBuffer = (this->m_arPoints[nIndex].dY + pointCur.dY); ++pBuffer; *pBuffer = (this->m_arPoints[nIndex].dY + pointCur.dY); ++pBuffer;
@ -554,7 +554,7 @@ namespace NSCustomShapesConvert
} }
else else
{ {
for (int nIndex = 0; nIndex < nCount; ++nIndex) for (size_t nIndex = 0; nIndex < nCount; ++nIndex)
{ {
*pBuffer = this->m_arPoints[nIndex].dX; ++pBuffer; *pBuffer = this->m_arPoints[nIndex].dX; ++pBuffer;
*pBuffer = this->m_arPoints[nIndex].dY; ++pBuffer; *pBuffer = this->m_arPoints[nIndex].dY; ++pBuffer;
@ -592,7 +592,7 @@ namespace NSCustomShapesConvert
if (NULL != pArray) if (NULL != pArray)
{ {
pRenderer->PathCommandLinesTo(pArray, nCount /*this->m_arPoints.size()*/); pRenderer->PathCommandLinesTo(pArray, (int)nCount /*this->m_arPoints.size()*/);
} }
break; break;
@ -605,7 +605,7 @@ namespace NSCustomShapesConvert
if (NULL != pArray) if (NULL != pArray)
{ {
pRenderer->PathCommandCurvesTo (pArray, nCount/*this->m_arPoints.size()*/); pRenderer->PathCommandCurvesTo (pArray, (int)nCount/*this->m_arPoints.size()*/);
} }
break; break;
@ -633,7 +633,7 @@ namespace NSCustomShapesConvert
if (NULL != pArray) if (NULL != pArray)
{ {
pRenderer->PathCommandLinesTo(pArray, nCount/*this->m_arPoints.size()*/); pRenderer->PathCommandLinesTo(pArray, (int)nCount/*this->m_arPoints.size()*/);
} }
break; break;
@ -646,7 +646,7 @@ namespace NSCustomShapesConvert
if (NULL != pArray) if (NULL != pArray)
{ {
pRenderer->PathCommandCurvesTo(pArray, nCount/*this->m_arPoints.size()*/); pRenderer->PathCommandCurvesTo(pArray, (int)nCount/*this->m_arPoints.size()*/);
} }
break; break;
} }
@ -794,8 +794,8 @@ namespace NSCustomShapesConvert
bool bIsX = true; bool bIsX = true;
CheckLastPoint(pRenderer, pointCur); CheckLastPoint(pRenderer, pointCur);
int nCount = this->m_arPoints.size(); size_t nCount = this->m_arPoints.size();
for (int nIndex = 0; nIndex < nCount; ++nIndex) for (size_t nIndex = 0; nIndex < nCount; ++nIndex)
{ {
double x1 = pointCur.dX; double x1 = pointCur.dX;
double y1 = pointCur.dY; double y1 = pointCur.dY;
@ -819,8 +819,8 @@ namespace NSCustomShapesConvert
bool bIsX = false; bool bIsX = false;
CheckLastPoint(pRenderer, pointCur); CheckLastPoint(pRenderer, pointCur);
int nCount = this->m_arPoints.size(); size_t nCount = this->m_arPoints.size();
for (int nIndex = 0; nIndex < nCount; ++nIndex) for (size_t nIndex = 0; nIndex < nCount; ++nIndex)
{ {
double x1 = pointCur.dX; double x1 = pointCur.dX;
double y1 = pointCur.dY; double y1 = pointCur.dY;
@ -847,7 +847,7 @@ namespace NSCustomShapesConvert
if (NULL != pArray) if (NULL != pArray)
{ {
pRenderer->PathCommandLinesTo(pArray, nCount/*this->m_arPoints.size()*/); pRenderer->PathCommandLinesTo(pArray, (int)nCount/*this->m_arPoints.size()*/);
} }
CheckLastPoint(pRenderer, pointCur); CheckLastPoint(pRenderer, pointCur);
@ -887,7 +887,7 @@ namespace NSCustomShapesConvert
void AddRuler(const RulesType& eType) void AddRuler(const RulesType& eType)
{ {
int lCount = m_arParts.size(); size_t lCount = m_arParts.size();
CPart oPart; CPart oPart;
oPart.m_eType = eType; oPart.m_eType = eType;
@ -896,7 +896,7 @@ namespace NSCustomShapesConvert
} }
void AddPoint(const double& x, const double& y) void AddPoint(const double& x, const double& y)
{ {
int lCount = m_arParts.size(); size_t lCount = m_arParts.size();
if (0 != lCount) if (0 != lCount)
{ {
CDoublePoint point; CDoublePoint point;

View File

@ -134,7 +134,7 @@ void ReadMapEntry(POLE::Stream *pStream, ECMACryptFile::_mapEntry & m)
_UINT32 refCount = 0; _UINT32 refCount = 0;
pStream->read((unsigned char*)&refCount, 4); pStream->read((unsigned char*)&refCount, 4);
for (int i = 0 ; i < refCount; i++) for (_UINT32 i = 0 ; i < refCount; i++)
{ {
ECMACryptFile::_refComponent r; ECMACryptFile::_refComponent r;
pStream->read((unsigned char*)&r.type, 4); pStream->read((unsigned char*)&r.type, 4);
@ -151,7 +151,7 @@ std::string DecodeBase64(const std::string & value)
unsigned char *pData = NULL; unsigned char *pData = NULL;
std::string result; std::string result;
NSFile::CBase64Converter::Decode(value.c_str(), value.length(), pData, nLength); NSFile::CBase64Converter::Decode(value.c_str(), (int)value.length(), pData, nLength);
if (pData) if (pData)
{ {
result = std::string((char*)pData, nLength); result = std::string((char*)pData, nLength);
@ -165,7 +165,7 @@ std::string EncodeBase64(const std::string & value)
char *pData = NULL; char *pData = NULL;
std::string result; std::string result;
NSFile::CBase64Converter::Encode((BYTE*)value.c_str(), value.length(), pData, nLength, NSBase64::B64_BASE64_FLAG_NOCRLF); NSFile::CBase64Converter::Encode((BYTE*)value.c_str(), (int)value.length(), pData, nLength, NSBase64::B64_BASE64_FLAG_NOCRLF);
if (pData) if (pData)
{ {
result = std::string(pData, nLength); result = std::string(pData, nLength);
@ -530,7 +530,7 @@ bool WriteStandartEncryptionInfo(unsigned char* data, int &size, _ecmaCryptData
mem_stream.WriteUInt32((_UINT32)cryptData.hashSize); mem_stream.WriteUInt32((_UINT32)cryptData.hashSize);
//int szEncryptedVerifierHash = (ProviderType == 0x0001) ? 0x14 : 0x20; //RC4 | AES(DES) .. md5? //int szEncryptedVerifierHash = (ProviderType == 0x0001) ? 0x14 : 0x20; //RC4 | AES(DES) .. md5?
mem_stream.WriteBytes((unsigned char*)cryptData.encryptedVerifierValue.c_str(), cryptData.encryptedVerifierValue.length()/*szEncryptedVerifierHash*/); mem_stream.WriteBytes((unsigned char*)cryptData.encryptedVerifierValue.c_str(), (int)cryptData.encryptedVerifierValue.length()/*szEncryptedVerifierHash*/);
size = mem_stream.GetPosition(); size = mem_stream.GetPosition();