mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Compare commits
36 Commits
v5.2.0.110
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| 3816162555 | |||
| 3fb166f99a | |||
| d8121d1a12 | |||
| a76bf57051 | |||
| 97b92cf75c | |||
| 506de8e9e1 | |||
| fb34d57ee6 | |||
| da2d997838 | |||
| 76d68fa70f | |||
| 677e3e49e0 | |||
| 02c84d107b | |||
| b59908e4c2 | |||
| 04e6b642f4 | |||
| 49cd76d0f3 | |||
| c9ddd5b7b5 | |||
| 53a75261e3 | |||
| 26f32dd511 | |||
| e1e788b768 | |||
| a74c927e7e | |||
| c94e1e3223 | |||
| 395e54cf76 | |||
| 40476e7555 | |||
| 04f06c23a1 | |||
| a9a635747a | |||
| 4afe985955 | |||
| 4027a0de25 | |||
| a232fcd9e1 | |||
| 5bc537749e | |||
| 6e7f6cf204 | |||
| f4fa754ce4 | |||
| 7d88a91fcc | |||
| 069b12839f | |||
| aa609336ca | |||
| 452917f213 | |||
| 5b5ccdc9be | |||
| adf7ca65ea |
@ -52,6 +52,7 @@
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include "../../Common/DocxFormat/Source/Base/Types_32.h"
|
||||
#include "../../DesktopEditor/common/Types.h"
|
||||
#include "../../Common/DocxFormat/Source/Base/unicode_util.h"
|
||||
#include "../../UnicodeConverter/UnicodeConverter.h"
|
||||
|
||||
@ -58,7 +58,8 @@ namespace DocFileFormat
|
||||
}
|
||||
else
|
||||
{
|
||||
short cch = reader->ReadInt16();
|
||||
short cch = reader->ReadInt16();
|
||||
|
||||
|
||||
unsigned char *chars = reader->ReadBytes(18, true);
|
||||
|
||||
@ -67,13 +68,34 @@ namespace DocFileFormat
|
||||
newObject->m_AuthorIndex = reader->ReadUInt16();
|
||||
|
||||
//skip 4 bytes
|
||||
reader->ReadBytes(4, false);
|
||||
unsigned int skip = reader->ReadUInt32();
|
||||
|
||||
newObject->m_BookmarkId = reader->ReadInt32();
|
||||
newObject->m_BookmarkId = reader->ReadInt32(); //-1 - comment is on a length zero text range in the Main Document
|
||||
RELEASEARRAYOBJECTS(chars);
|
||||
}
|
||||
|
||||
|
||||
return static_cast<ByteStructure*>(newObject);
|
||||
}
|
||||
ByteStructure* AnnotationReferenceExDescriptor::ConstructObject(VirtualStreamReader* reader, int length)
|
||||
{
|
||||
AnnotationReferenceExDescriptor *newObject = new AnnotationReferenceExDescriptor();
|
||||
|
||||
if (reader->nWordVersion > 0)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
m_nDTTM = reader->ReadUInt32();
|
||||
reader->ReadUInt16(); //padding1
|
||||
m_nDepth = reader->ReadUInt32();
|
||||
m_nDiatrdParent = reader->ReadUInt32();
|
||||
unsigned int flag = reader->ReadUInt32();
|
||||
m_fInkAtn = GETBIT(flag, 1);
|
||||
}
|
||||
|
||||
|
||||
return static_cast<ByteStructure*>(newObject);
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,21 +46,6 @@ namespace DocFileFormat
|
||||
return (nWordVersion > 0) ? STRUCTURE_SIZE_OLD : STRUCTURE_SIZE;
|
||||
}
|
||||
|
||||
inline std::wstring GetUserInitials() const
|
||||
{
|
||||
return m_UserInitials;
|
||||
}
|
||||
|
||||
inline unsigned short GetAuthorIndex() const
|
||||
{
|
||||
return m_AuthorIndex;
|
||||
}
|
||||
|
||||
inline int GetBookmarkId() const
|
||||
{
|
||||
return m_BookmarkId;
|
||||
}
|
||||
|
||||
AnnotationReferenceDescriptor() : m_AuthorIndex(0), m_BookmarkId(0)
|
||||
{
|
||||
}
|
||||
@ -71,13 +56,35 @@ namespace DocFileFormat
|
||||
|
||||
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length );
|
||||
|
||||
private:
|
||||
|
||||
/// The initials of the user who left the annotation.
|
||||
std::wstring m_UserInitials;
|
||||
/// An index into the string table of comment author names.
|
||||
unsigned short m_AuthorIndex;
|
||||
/// Identifies a bookmark.
|
||||
int m_BookmarkId;
|
||||
};
|
||||
|
||||
class AnnotationReferenceExDescriptor: public ByteStructure
|
||||
{
|
||||
public:
|
||||
static const int STRUCTURE_SIZE = 18;
|
||||
static const int STRUCTURE_SIZE_OLD = 0;
|
||||
|
||||
static const int GetSize(int nWordVersion)
|
||||
{
|
||||
return (nWordVersion > 0) ? STRUCTURE_SIZE_OLD : STRUCTURE_SIZE;
|
||||
}
|
||||
|
||||
AnnotationReferenceExDescriptor() : m_nDTTM(0), m_nDepth(0), m_nDiatrdParent(0), m_fInkAtn(false)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~AnnotationReferenceExDescriptor()
|
||||
{
|
||||
}
|
||||
|
||||
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length );
|
||||
|
||||
unsigned int m_nDTTM;
|
||||
unsigned int m_nDepth;
|
||||
unsigned int m_nDiatrdParent;
|
||||
bool m_fInkAtn;
|
||||
};
|
||||
}
|
||||
|
||||
@ -39,13 +39,8 @@ namespace DocFileFormat
|
||||
class BookmarkFirst: public ByteStructure
|
||||
{
|
||||
private:
|
||||
/// An unsigned integer that specifies a zero-based index into the PlcfBkl or PlcfBkld
|
||||
/// that is paired with the PlcfBkf or PlcfBkfd containing this FBKF.
|
||||
/// The entry found at said index specifies the location of the end of the bookmark associated with this FBKF.
|
||||
/// Ibkl MUST be unique for all FBKFs inside a given PlcfBkf or PlcfBkfd.
|
||||
short ibkl;
|
||||
/// A BKC that specifies further information about the bookmark associated with this FBKF.
|
||||
short bkc;
|
||||
short ibkl;
|
||||
short bkc;
|
||||
|
||||
public:
|
||||
static const int STRUCTURE_SIZE = 4;
|
||||
@ -78,4 +73,32 @@ namespace DocFileFormat
|
||||
return static_cast<ByteStructure*>( newObject );
|
||||
}
|
||||
};
|
||||
class AtnBookmarkFirst: public ByteStructure
|
||||
{
|
||||
public:
|
||||
unsigned short bmc;
|
||||
unsigned int lTag;
|
||||
|
||||
static const int STRUCTURE_SIZE = 10;
|
||||
|
||||
AtnBookmarkFirst()
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~AtnBookmarkFirst()
|
||||
{
|
||||
}
|
||||
|
||||
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length )
|
||||
{
|
||||
AtnBookmarkFirst *newObject = new AtnBookmarkFirst();
|
||||
|
||||
newObject->bmc = reader->ReadUInt16(); //0x0100
|
||||
newObject->lTag = reader->ReadUInt32();
|
||||
|
||||
unsigned int lTagOld = reader->ReadUInt32();
|
||||
|
||||
return static_cast<ByteStructure*>( newObject );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ namespace DocFileFormat
|
||||
convertSprms( dynamic_cast<CharacterPropertyExceptions*>( chpx )->grpprl, _rPr );
|
||||
|
||||
// apend revision changes
|
||||
if (_revisionData->Type == Changed)
|
||||
if ((_revisionData) && (_revisionData->Type == Changed))
|
||||
{
|
||||
XMLTools::XMLElement rPrChange( L"w:rPrChange");
|
||||
|
||||
|
||||
@ -52,8 +52,6 @@ namespace DocFileFormat
|
||||
{
|
||||
m_context->_docx->RegisterComments();
|
||||
|
||||
int index = 0;
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"?xml version=\"1.0\" encoding=\"UTF-8\"?");
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:comments", TRUE );
|
||||
|
||||
@ -63,33 +61,60 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:o", OpenXmlNamespaces::Office );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:w10", OpenXmlNamespaces::OfficeWord );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:r", OpenXmlNamespaces::Relationships );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wpc", L"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:cx", L"http://schemas.microsoft.com/office/drawing/2014/chartex" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:cx1", L"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:mc", L"http://schemas.openxmlformats.org/markup-compatibility/2006" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:m", L"http://schemas.openxmlformats.org/officeDocument/2006/math" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wp14", L"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:w14", L"http://schemas.microsoft.com/office/word/2010/wordml" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:w15", L"http://schemas.microsoft.com/office/word/2012/wordml" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:w16se", L"http://schemas.microsoft.com/office/word/2015/wordml/symex" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wpg", L"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wpi", L"http://schemas.microsoft.com/office/word/2010/wordprocessingInk" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wne", L"http://schemas.microsoft.com/office/word/2006/wordml" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wps", L"http://schemas.microsoft.com/office/word/2010/wordprocessingShape" );
|
||||
m_pXmlWriter->WriteAttribute( L"mc:Ignorable", L"w14 w15 w16se wp14");
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
int cp = m_document->FIB->m_RgLw97.ccpText + m_document->FIB->m_RgLw97.ccpFtn + m_document->FIB->m_RgLw97.ccpHdr;
|
||||
|
||||
size_t count = m_document->AnnotationsReferencePlex->Elements.size();
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
for (size_t index = 0; index < count; ++index)
|
||||
{
|
||||
AnnotationReferenceDescriptor* atrdPre10 = static_cast<AnnotationReferenceDescriptor*>(m_document->AnnotationsReferencePlex->Elements[index]);
|
||||
AnnotationReferenceExDescriptor* atrdPost10 = m_document->AnnotationsReferenceExPlex ? static_cast<AnnotationReferenceExDescriptor*>(m_document->AnnotationsReferenceExPlex->Elements[index]) : NULL;
|
||||
|
||||
unsigned short index_author = atrdPre10->GetAuthorIndex();
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:comment", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 ));
|
||||
if (index_author < m_document->AnnotationOwners->size()) //conv_253l2H1CehgKwsxCtNk__docx.doc
|
||||
if (atrdPre10->m_BookmarkId < 0)
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 + count + 1024 ));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 ));
|
||||
}
|
||||
if (atrdPost10)
|
||||
{
|
||||
//!!!TODO!!!
|
||||
/*//ATRDpost10 is optional and not saved in all files
|
||||
if (doc.AnnotationReferenceExtraTable != null &&
|
||||
doc.AnnotationReferenceExtraTable.Count > index)
|
||||
{
|
||||
AnnotationReferenceDescriptorExtra atrdPost10 = doc.AnnotationReferenceExtraTable[index];
|
||||
atrdPost10.Date.Convert(new DateMapping(_writer));
|
||||
}*/
|
||||
}
|
||||
if (atrdPre10->m_AuthorIndex < m_document->AnnotationOwners->size()) //conv_253l2H1CehgKwsxCtNk__docx.doc
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:author",
|
||||
FormatUtils::XmlEncode(m_document->AnnotationOwners->at( index_author ) ));
|
||||
FormatUtils::XmlEncode(m_document->AnnotationOwners->at( atrdPre10->m_AuthorIndex ) ));
|
||||
}
|
||||
m_pXmlWriter->WriteAttribute( L"w:initials", atrdPre10->GetUserInitials());
|
||||
m_pXmlWriter->WriteAttribute( L"w:initials", atrdPre10->m_UserInitials);
|
||||
|
||||
|
||||
//!!!TODO!!!
|
||||
/*//ATRDpost10 is optional and not saved in all files
|
||||
if (doc.AnnotationReferenceExtraTable != null &&
|
||||
doc.AnnotationReferenceExtraTable.Count > index)
|
||||
{
|
||||
AnnotationReferenceDescriptorExtra atrdPost10 = doc.AnnotationReferenceExtraTable[index];
|
||||
atrdPost10.Date.Convert(new DateMapping(_writer));
|
||||
}*/
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
@ -116,8 +141,6 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd(L"w:comment" );
|
||||
|
||||
++index;
|
||||
}
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"w:comments" );
|
||||
|
||||
@ -45,7 +45,7 @@ namespace DocFileFormat
|
||||
{
|
||||
DocumentMapping::DocumentMapping(ConversionContext* context, IMapping* caller) : _skipRuns(0), _lastValidPapx(NULL), _lastValidSepx(NULL),
|
||||
AbstractOpenXmlMapping( new XMLTools::CStringXmlWriter() ), _sectionNr(0), _footnoteNr(0),
|
||||
_endnoteNr(0), _commentNr(0), _caller(caller)
|
||||
_endnoteNr(0), _commentNr(1), _caller(caller)
|
||||
{
|
||||
m_document = NULL;
|
||||
m_context = context;
|
||||
@ -506,7 +506,7 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
//write text
|
||||
for (unsigned int i = 0; i < chars->size(); ++i)
|
||||
for (size_t i = 0; i < chars->size(); ++i)
|
||||
{
|
||||
wchar_t c = chars->at(i), code = c;
|
||||
|
||||
@ -526,7 +526,20 @@ namespace DocFileFormat
|
||||
|
||||
text.clear();
|
||||
|
||||
XMLTools::XMLElement elem(L"w:br");
|
||||
if (textType == L"instrText")
|
||||
{
|
||||
m_pXmlWriter->WriteNodeEnd(L"w:r");
|
||||
m_pXmlWriter->WriteNodeBegin(L"w:r");
|
||||
CharacterPropertiesMapping* rPr = new CharacterPropertiesMapping(m_pXmlWriter, m_document, NULL, _lastValidPapx, false);
|
||||
if (rPr)
|
||||
{
|
||||
rPr->_webHidden = _writeWebHidden;
|
||||
|
||||
chpx->Convert(rPr);
|
||||
RELEASEOBJECT(rPr);
|
||||
}
|
||||
}
|
||||
XMLTools::XMLElement elem(L"w:br");
|
||||
elem.AppendAttribute(L"w:type", L"textWrapping");
|
||||
elem.AppendAttribute(L"w:clear", L"all");
|
||||
|
||||
@ -591,6 +604,7 @@ namespace DocFileFormat
|
||||
std::wstring HYPERLINK ( L"HYPERLINK" );
|
||||
std::wstring PAGEREF ( L"PAGEREF" );
|
||||
std::wstring PAGE ( L"PAGE" );
|
||||
std::wstring SHAPE ( L"SHAPE" );
|
||||
|
||||
if (arField.empty() == false)
|
||||
f = arField[0];
|
||||
@ -611,6 +625,7 @@ namespace DocFileFormat
|
||||
bool bEquation = search( f.begin(), f.end(), Equation.begin(), Equation.end()) != f.end();
|
||||
bool bPAGE = search( f.begin(), f.end(), PAGE.begin(), PAGE.end()) != f.end();
|
||||
bool bTOC = search( f.begin(), f.end(), TOC.begin(), TOC.end()) != f.end();
|
||||
bool bSHAPE = search( f.begin(), f.end(), SHAPE.begin(), SHAPE.end()) != f.end();
|
||||
|
||||
bool bPAGEREF = false;
|
||||
if (bHYPERLINK && arField.size() > 1)
|
||||
@ -916,7 +931,7 @@ namespace DocFileFormat
|
||||
PictureDescriptor pictDiscr(chpx, m_document->WordDocumentStream, 0x7fffffff, m_document->nWordVersion);
|
||||
ShapeContainer* pShape = m_document->GetOfficeArt()->GetShapeContainer(pSpa->GetShapeID());
|
||||
|
||||
if (pShape)
|
||||
if ((pShape) /*&& (false == pShape->isLastIdentify())*/)
|
||||
{
|
||||
VMLShapeMapping oVmlWriter (m_context, m_pXmlWriter, pSpa, &pictDiscr, _caller);
|
||||
|
||||
@ -950,55 +965,59 @@ namespace DocFileFormat
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd (L"w:pict");
|
||||
}
|
||||
else if ((oPicture.mfp.mm > 98) && (NULL != oPicture.shapeContainer))
|
||||
else if ((oPicture.mfp.mm > 98) && (NULL != oPicture.shapeContainer)/* && (false == oPicture.shapeContainer->isLastIdentify())*/)
|
||||
{
|
||||
bool bFormula = false;
|
||||
|
||||
XMLTools::CStringXmlWriter pictWriter;
|
||||
pictWriter.WriteNodeBegin (L"w:pict");
|
||||
|
||||
bool picture = true;
|
||||
bool bPicture = true;
|
||||
bool m_bSkip = false;
|
||||
|
||||
if (oPicture.shapeContainer)
|
||||
{
|
||||
int shape_type = oPicture.shapeContainer->getShapeType();
|
||||
if (oPicture.shapeContainer->m_nShapeType != msosptPictureFrame)
|
||||
bPicture = false;//шаблон 1.doc картинка в колонтитуле
|
||||
|
||||
if (shape_type != msosptPictureFrame) picture = false;//шаблон 1.doc картинка в колонтитуле
|
||||
m_bSkip = oPicture.shapeContainer->m_bSkip;
|
||||
}
|
||||
|
||||
if (picture)
|
||||
if (!m_bSkip)
|
||||
{
|
||||
VMLPictureMapping oVmlMapper(m_context, &pictWriter, false, _caller, isInline);
|
||||
oPicture.Convert (&oVmlMapper);
|
||||
|
||||
if (oVmlMapper.m_isEmbedded)
|
||||
bool bFormula = false;
|
||||
XMLTools::CStringXmlWriter pictWriter;
|
||||
pictWriter.WriteNodeBegin (L"w:pict");
|
||||
|
||||
if (bPicture)
|
||||
{
|
||||
OleObject ole ( chpx, m_document);
|
||||
OleObjectMapping oleObjectMapping( &pictWriter, m_context, &oPicture, _caller, oVmlMapper.m_shapeId );
|
||||
VMLPictureMapping oVmlMapper(m_context, &pictWriter, false, _caller, isInline);
|
||||
oPicture.Convert (&oVmlMapper);
|
||||
|
||||
ole.isEquation = oVmlMapper.m_isEquation;
|
||||
ole.isEmbedded = oVmlMapper.m_isEmbedded;
|
||||
ole.emeddedData = oVmlMapper.m_embeddedData;
|
||||
|
||||
ole.Convert( &oleObjectMapping );
|
||||
if (oVmlMapper.m_isEmbedded)
|
||||
{
|
||||
OleObject ole ( chpx, m_document);
|
||||
OleObjectMapping oleObjectMapping( &pictWriter, m_context, &oPicture, _caller, oVmlMapper.m_shapeId );
|
||||
|
||||
ole.isEquation = oVmlMapper.m_isEquation;
|
||||
ole.isEmbedded = oVmlMapper.m_isEmbedded;
|
||||
ole.emeddedData = oVmlMapper.m_embeddedData;
|
||||
|
||||
ole.Convert( &oleObjectMapping );
|
||||
}
|
||||
else if (oVmlMapper.m_isEquation)
|
||||
{
|
||||
//нельзя в Run писать oMath
|
||||
//m_pXmlWriter->WriteString(oVmlMapper.m_equationXml);
|
||||
_writeAfterRun = oVmlMapper.m_equationXml;
|
||||
bFormula = true;
|
||||
}
|
||||
}
|
||||
else if (oVmlMapper.m_isEquation)
|
||||
else
|
||||
{
|
||||
//нельзя в Run писать oMath
|
||||
//m_pXmlWriter->WriteString(oVmlMapper.m_equationXml);
|
||||
_writeAfterRun = oVmlMapper.m_equationXml;
|
||||
bFormula = true;
|
||||
VMLShapeMapping oVmlMapper(m_context, &pictWriter, NULL, &oPicture, _caller, isInline);
|
||||
oPicture.shapeContainer->Convert(&oVmlMapper);
|
||||
}
|
||||
}else
|
||||
{
|
||||
VMLShapeMapping oVmlMapper(m_context, &pictWriter, NULL, &oPicture, _caller, isInline);
|
||||
oPicture.shapeContainer->Convert(&oVmlMapper);
|
||||
}
|
||||
|
||||
pictWriter.WriteNodeEnd (L"w:pict");
|
||||
|
||||
pictWriter.WriteNodeEnd (L"w:pict");
|
||||
|
||||
if (!bFormula)
|
||||
m_pXmlWriter->WriteString(pictWriter.GetXmlString());
|
||||
if (!bFormula)
|
||||
m_pXmlWriter->WriteString(pictWriter.GetXmlString());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -1007,6 +1026,11 @@ namespace DocFileFormat
|
||||
if ((m_document->FootnoteReferenceCharactersPlex != NULL) && (m_document->FootnoteReferenceCharactersPlex->IsCpExists(cp)))
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:footnoteReference", true );
|
||||
FootnoteDescriptor* desc = dynamic_cast<FootnoteDescriptor*>(m_document->FootnoteReferenceCharactersPlex->Elements[_footnoteNr]);
|
||||
if (desc && desc->aFtnIdx == 0)
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:customMarkFollows", L"1");
|
||||
}
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString(_footnoteNr++ ) );
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true );
|
||||
}
|
||||
@ -1018,6 +1042,11 @@ namespace DocFileFormat
|
||||
else if ((m_document->EndnoteReferenceCharactersPlex != NULL) && (m_document->EndnoteReferenceCharactersPlex->IsCpExists(cp)))
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:endnoteReference", true );
|
||||
EndnoteDescriptor* desc = dynamic_cast<EndnoteDescriptor*>(m_document->EndnoteReferenceCharactersPlex->Elements[_footnoteNr]);
|
||||
if (desc && desc->aEndIdx == 0)
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:customMarkFollows", L"1");
|
||||
}
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString(_endnoteNr++ ));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true );
|
||||
}
|
||||
@ -1035,10 +1064,10 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:annotationRef", true );
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true );
|
||||
}
|
||||
else
|
||||
else if ((m_document->AnnotationsReferencePlex) && (_commentNr <= m_document->AnnotationsReferencePlex->Elements.size()))
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:commentReference", true );
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( _commentNr ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( _commentNr++ ));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true );
|
||||
}
|
||||
}
|
||||
@ -1190,7 +1219,7 @@ namespace DocFileFormat
|
||||
|
||||
// add the parts
|
||||
|
||||
for (unsigned int i = 0; i < splitIndices->size(); ++i)
|
||||
for (size_t i = 0; i < splitIndices->size(); ++i)
|
||||
{
|
||||
int cch = splitIndices->at( i ) - startIndex;
|
||||
|
||||
|
||||
@ -37,21 +37,14 @@ namespace DocFileFormat
|
||||
{
|
||||
class EndnoteDescriptor: public ByteStructure
|
||||
{
|
||||
private:
|
||||
short aEndIdx;
|
||||
|
||||
public:
|
||||
static const int STRUCTURE_SIZE = 2;
|
||||
|
||||
EndnoteDescriptor():
|
||||
aEndIdx(0)
|
||||
{
|
||||
}
|
||||
EndnoteDescriptor(): aEndIdx(0) {}
|
||||
|
||||
virtual ~EndnoteDescriptor()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length )
|
||||
{
|
||||
EndnoteDescriptor *newObject = new EndnoteDescriptor();
|
||||
@ -60,5 +53,7 @@ namespace DocFileFormat
|
||||
|
||||
return static_cast<ByteStructure*>( newObject );
|
||||
}
|
||||
|
||||
short aEndIdx;
|
||||
};
|
||||
}
|
||||
|
||||
@ -560,8 +560,7 @@ namespace DocFileFormat
|
||||
m_FibWord97.fcPlcffndRef = reader.ReadInt32();
|
||||
m_FibWord97.lcbPlcffndRef = reader.ReadInt32();
|
||||
|
||||
m_FibWord97.lcbPlcfandTxt = reader.ReadInt32();//112
|
||||
|
||||
m_FibWord97.fcPlcffndTxt = reader.ReadInt32();//112
|
||||
m_FibWord97.lcbPlcffndTxt = reader.ReadInt32();
|
||||
|
||||
m_FibWord97.fcPlcfandRef = reader.ReadInt32();
|
||||
|
||||
@ -37,21 +37,15 @@ namespace DocFileFormat
|
||||
{
|
||||
class FootnoteDescriptor: public ByteStructure
|
||||
{
|
||||
private:
|
||||
short aFtnIdx;
|
||||
|
||||
public:
|
||||
static const int STRUCTURE_SIZE = 2;
|
||||
|
||||
FootnoteDescriptor():
|
||||
aFtnIdx(0)
|
||||
{
|
||||
}
|
||||
FootnoteDescriptor() : aFtnIdx(0) {}
|
||||
|
||||
virtual ~FootnoteDescriptor()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length )
|
||||
{
|
||||
FootnoteDescriptor *newObject = new FootnoteDescriptor();
|
||||
@ -60,5 +54,7 @@ namespace DocFileFormat
|
||||
|
||||
return static_cast<ByteStructure*>( newObject );
|
||||
}
|
||||
|
||||
short aFtnIdx;
|
||||
};
|
||||
}
|
||||
|
||||
@ -63,7 +63,35 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:o", OpenXmlNamespaces::Office );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:w10", OpenXmlNamespaces::OfficeWord );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:r", OpenXmlNamespaces::Relationships );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wpc", L"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:mc", L"http://schemas.openxmlformats.org/markup-compatibility/2006");
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wp14", L"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:w14", L"http://schemas.microsoft.com/office/word/2010/wordml" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wpg", L"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wpi", L"http://schemas.microsoft.com/office/word/2010/wordprocessingInk" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wne", L"http://schemas.microsoft.com/office/word/2006/wordml" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wps", L"http://schemas.microsoft.com/office/word/2010/wordprocessingShape" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:m", L"http://schemas.openxmlformats.org/officeDocument/2006/math" );
|
||||
m_pXmlWriter->WriteAttribute( L"mc:Ignorable", L"w14 wp14" );
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
//m_pXmlWriter->WriteNodeBegin( L"w:footnote", TRUE );
|
||||
//m_pXmlWriter->WriteAttribute( L"w:type", L"separator");
|
||||
//m_pXmlWriter->WriteAttribute( L"w:id", L"-1");
|
||||
//m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
//m_pXmlWriter->WriteString(L"<w:p><w:pPr><w:spacing w:lineRule=\"auto\" w:line=\"240\" w:after=\"0\"/></w:pPr><w:r></w:r><w:r><w:separator/></w:r></w:p>");
|
||||
//m_pXmlWriter->WriteNodeEnd( L"w:footnote");
|
||||
|
||||
//m_pXmlWriter->WriteNodeBegin( L"w:footnote", TRUE );
|
||||
//m_pXmlWriter->WriteAttribute( L"w:type", L"continuationSeparator");
|
||||
//m_pXmlWriter->WriteAttribute( L"w:id", L"0");
|
||||
//m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
//m_pXmlWriter->WriteString(L"<w:p><w:pPr><w:spacing w:lineRule=\"auto\" w:line=\"240\" w:after=\"0\"/></w:pPr><w:r></w:r><w:r><w:continuationSeparator/></w:r></w:p>");
|
||||
//m_pXmlWriter->WriteNodeEnd( L"w:footnote");
|
||||
|
||||
int cp = m_document->FIB->m_RgLw97.ccpText;
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ std::wstring readXstz(VirtualStreamReader *reader)
|
||||
|
||||
std::wstring ret;
|
||||
|
||||
if (cch > 0)
|
||||
if (cch > 0 && cch < 0x0fff)
|
||||
{
|
||||
std::shared_ptr<unsigned char>data = std::shared_ptr<unsigned char>(reader->ReadBytes(cch * 2, true));
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
|
||||
@ -32,6 +32,8 @@
|
||||
|
||||
#include "ListData.h"
|
||||
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <cctype>
|
||||
@ -46,6 +48,11 @@ namespace DocFileFormat
|
||||
RELEASEOBJECT(rglvl);
|
||||
}
|
||||
|
||||
ListDataPtr ListData::create(VirtualStreamReader* reader, int length)
|
||||
{
|
||||
return boost::make_shared<ListData>(reader, length);
|
||||
}
|
||||
|
||||
// Parses the StreamReader to retrieve a ListData
|
||||
|
||||
ListData::ListData(VirtualStreamReader* reader, int length) : rglvl(NULL)
|
||||
@ -80,9 +87,85 @@ namespace DocFileFormat
|
||||
|
||||
grfhic = reader->ReadByte();
|
||||
}
|
||||
NumberingDescriptorPtr NumberingDescriptor::create(unsigned char * data, int length)
|
||||
{
|
||||
return boost::make_shared<NumberingDescriptor>(data, length);
|
||||
}
|
||||
bool NumberingDescriptor::operator == (const NumberingDescriptor & val) const
|
||||
{
|
||||
const bool res =
|
||||
nfc == val.nfc &&
|
||||
cbTextBefore == val.cbTextBefore &&
|
||||
cbTextAfter == val.cbTextAfter &&
|
||||
jc == val.jc &&
|
||||
fPrev == val.fPrev &&
|
||||
fHang == val.fHang &&
|
||||
fSetBold == val.fSetBold &&
|
||||
fSetItalic == val.fSetItalic &&
|
||||
fSetSmallCaps == val.fSetSmallCaps &&
|
||||
fSetCaps == val.fSetCaps &&
|
||||
fSetStrike == val.fSetStrike &&
|
||||
fSetKul == val.fSetKul &&
|
||||
fPrevSpace == val.fPrevSpace &&
|
||||
fBold == val.fBold &&
|
||||
fItalic == val.fItalic &&
|
||||
fSmallCaps == val.fSmallCaps &&
|
||||
fCaps == val.fCaps &&
|
||||
fStrike == val.fStrike &&
|
||||
kul == val.kul &&
|
||||
ico == val.ico &&
|
||||
ftc == val.ftc &&
|
||||
hps == val.hps &&
|
||||
iStartAt == val.iStartAt &&
|
||||
dxaIndent == val.dxaIndent &&
|
||||
dxaSpace == val.dxaSpace &&
|
||||
fNumber1 == val.fNumber1 &&
|
||||
fNumberAcross == val.fNumberAcross &&
|
||||
fRestartHdn == val.fRestartHdn &&
|
||||
fSpareX == val.fSpareX;
|
||||
|
||||
return res;
|
||||
}
|
||||
bool NumberingDescriptor::operator == (const NumberingDescriptorPtr & val) const
|
||||
{
|
||||
if (!val) return false;
|
||||
const bool res =
|
||||
nfc == val->nfc &&
|
||||
cbTextBefore == val->cbTextBefore &&
|
||||
cbTextAfter == val->cbTextAfter &&
|
||||
jc == val->jc &&
|
||||
fPrev == val->fPrev &&
|
||||
fHang == val->fHang &&
|
||||
fSetBold == val->fSetBold &&
|
||||
fSetItalic == val->fSetItalic &&
|
||||
fSetSmallCaps == val->fSetSmallCaps &&
|
||||
fSetCaps == val->fSetCaps &&
|
||||
fSetStrike == val->fSetStrike &&
|
||||
fSetKul == val->fSetKul &&
|
||||
fPrevSpace == val->fPrevSpace &&
|
||||
fBold == val->fBold &&
|
||||
fItalic == val->fItalic &&
|
||||
fSmallCaps == val->fSmallCaps &&
|
||||
fCaps == val->fCaps &&
|
||||
fStrike == val->fStrike &&
|
||||
kul == val->kul &&
|
||||
ico == val->ico &&
|
||||
ftc == val->ftc &&
|
||||
hps == val->hps &&
|
||||
iStartAt == val->iStartAt &&
|
||||
dxaIndent == val->dxaIndent &&
|
||||
dxaSpace == val->dxaSpace &&
|
||||
fNumber1 == val->fNumber1 &&
|
||||
fNumberAcross == val->fNumberAcross &&
|
||||
fRestartHdn == val->fRestartHdn &&
|
||||
fSpareX == val->fSpareX;
|
||||
|
||||
return res;
|
||||
|
||||
}
|
||||
NumberingDescriptor::NumberingDescriptor( unsigned char * data, int length )
|
||||
{
|
||||
id = 0;
|
||||
nfc = FormatUtils::BytesToUChar(data, 0, length);
|
||||
cbTextBefore = FormatUtils::BytesToUChar(data, 1, length);
|
||||
cbTextAfter = FormatUtils::BytesToUChar(data, 2, length);
|
||||
|
||||
@ -36,6 +36,9 @@
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
class ListData;
|
||||
typedef class boost::shared_ptr<ListData> ListDataPtr;
|
||||
|
||||
class ListData
|
||||
{
|
||||
friend class ListTable;
|
||||
@ -74,15 +77,20 @@ namespace DocFileFormat
|
||||
|
||||
virtual ~ListData();
|
||||
ListData( VirtualStreamReader* reader, int length );
|
||||
|
||||
static ListDataPtr create(VirtualStreamReader* reader, int length);
|
||||
};
|
||||
|
||||
class NumberingDescriptor;
|
||||
typedef class boost::shared_ptr<NumberingDescriptor> NumberingDescriptorPtr;
|
||||
|
||||
class NumberingDescriptor : public IVisitable
|
||||
{
|
||||
friend class ListTable;
|
||||
friend class NumberingMapping;
|
||||
|
||||
private:
|
||||
|
||||
size_t id;
|
||||
unsigned char nfc;
|
||||
unsigned char cbTextBefore;
|
||||
unsigned char cbTextAfter;
|
||||
@ -121,9 +129,15 @@ namespace DocFileFormat
|
||||
std::wstring xst; //32 chars ansi
|
||||
|
||||
public:
|
||||
|
||||
bool operator == (const NumberingDescriptor & val) const;
|
||||
bool operator == (const NumberingDescriptorPtr & val) const;
|
||||
|
||||
virtual ~NumberingDescriptor(){}
|
||||
// Parses the given StreamReader to retrieve a ANLD struct
|
||||
NumberingDescriptor( unsigned char * data, int length ); //cbANLD (count of bytes of ANLD) is 52
|
||||
|
||||
static NumberingDescriptorPtr create(unsigned char * data, int length);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -38,7 +38,6 @@ namespace DocFileFormat
|
||||
{
|
||||
ListTable::~ListTable()
|
||||
{
|
||||
for_each( this->listData.begin(), this->listData.end(), DeleteDynamicObject() );
|
||||
}
|
||||
|
||||
ListTable::ListTable( FileInformationBlock* fib, POLE::Stream* tableStream )
|
||||
@ -59,23 +58,32 @@ namespace DocFileFormat
|
||||
//read the LSTF structs
|
||||
for ( int i = 0; i < count; i++ )
|
||||
{
|
||||
listData.push_back( new ListData( &reader, ListData::VARIABLE_LENGTH ) );
|
||||
listData.push_back( ListData::create( &reader, ListData::VARIABLE_LENGTH ) );
|
||||
}
|
||||
|
||||
//read the LVLF structs
|
||||
for ( std::list<ListData*>::iterator iter = listData.begin(); iter != listData.end(); iter++ )
|
||||
for ( size_t i = 0; i < listData.size(); ++i)
|
||||
{
|
||||
for ( unsigned int j = 0; j < (*iter)->rglvl->size(); j++ )
|
||||
for ( size_t j = 0; j < listData[i]->rglvl->size(); j++ )
|
||||
{
|
||||
(*iter)->rglvl->operator []( j ) = new ListLevel( &reader, ListData::VARIABLE_LENGTH );
|
||||
listData[i]->rglvl->operator []( j ) = new ListLevel( &reader, ListData::VARIABLE_LENGTH );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ListTable::appendNumbering( const NumberingDescriptor & desc )
|
||||
size_t ListTable::appendNumbering( NumberingDescriptorPtr &desc )
|
||||
{
|
||||
for (size_t i = 0; i < listNumbering.size(); ++i)
|
||||
{
|
||||
if (listNumbering[i]->operator==(desc))
|
||||
{
|
||||
return listNumbering[i]->id;
|
||||
}
|
||||
}
|
||||
desc->id = listData.size() + listNumbering.size()/* + 1*/;
|
||||
listNumbering.push_back(desc);
|
||||
return desc->id;
|
||||
}
|
||||
|
||||
}
|
||||
@ -41,12 +41,12 @@ namespace DocFileFormat
|
||||
class ListTable: public IVisitable
|
||||
{
|
||||
public:
|
||||
std::list<ListData*> listData;
|
||||
std::list<NumberingDescriptor> listNumbering;
|
||||
std::vector<ListDataPtr> listData;
|
||||
std::vector<NumberingDescriptorPtr> listNumbering;
|
||||
|
||||
virtual ~ListTable();
|
||||
ListTable( FileInformationBlock* fib, POLE::Stream* tableStream );
|
||||
|
||||
void appendNumbering( const NumberingDescriptor & desc );
|
||||
size_t appendNumbering( NumberingDescriptorPtr &desc );
|
||||
};
|
||||
}
|
||||
@ -59,22 +59,27 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:w", OpenXmlNamespaces::WordprocessingML );
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:v", OpenXmlNamespaces::VectorML );
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:o", OpenXmlNamespaces::Office );
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:w10", OpenXmlNamespaces::OfficeWord );
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:r", OpenXmlNamespaces::Relationships );
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:w10", OpenXmlNamespaces::OfficeWord );
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:m", L"http://schemas.openxmlformats.org/officeDocument/2006/math");
|
||||
|
||||
//m_pXmlWriter->WriteAttribute(L"xmlns:wpc", L"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas");
|
||||
//m_pXmlWriter->WriteAttribute(L"xmlns:mc", L"http://schemas.openxmlformats.org/markup-compatibility/2006");
|
||||
//m_pXmlWriter->WriteAttribute(L"xmlns:wp14", L"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
|
||||
//m_pXmlWriter->WriteAttribute(L"xmlns:wp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
|
||||
//m_pXmlWriter->WriteAttribute(L"xmlns:w14", L"http://schemas.microsoft.com/office/word/2010/wordml");
|
||||
//m_pXmlWriter->WriteAttribute(L"xmlns:wpg", L"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
|
||||
//m_pXmlWriter->WriteAttribute(L"xmlns:wpi", L"http://schemas.microsoft.com/office/word/2010/wordprocessingInk");
|
||||
//m_pXmlWriter->WriteAttribute(L"xmlns:wne", L"http://schemas.microsoft.com/office/word/2006/wordml");
|
||||
//m_pXmlWriter->WriteAttribute(L"xmlns:wps", L"http://schemas.microsoft.com/office/word/2010/wordprocessingShape");
|
||||
//m_pXmlWriter->WriteAttribute(L"mc:Ignorable", L"w14 wp14");
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:wpc", L"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas");
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:cx", L"http://schemas.microsoft.com/office/drawing/2014/chartex");
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:cx1", L"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex");
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:mc", L"http://schemas.openxmlformats.org/markup-compatibility/2006");
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:wp14", L"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:wp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:w14", L"http://schemas.microsoft.com/office/word/2010/wordml");
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:w15", L"http://schemas.microsoft.com/office/word/2012/wordml");
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:w16se", L"http://schemas.microsoft.com/office/word/2015/wordml/symex");
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:wpg", L"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:wpi", L"http://schemas.microsoft.com/office/word/2010/wordprocessingInk");
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:wne", L"http://schemas.microsoft.com/office/word/2006/wordml");
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:wps", L"http://schemas.microsoft.com/office/word/2010/wordprocessingShape");
|
||||
m_pXmlWriter->WriteAttribute(L"mc:Ignorable", L"w14 w15 w16se wp14");
|
||||
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
if ((m_document->GetOfficeArt()) && (m_document->GetOfficeArt()->GetShapeBackgound()))
|
||||
{
|
||||
|
||||
@ -78,7 +78,14 @@ public:
|
||||
|
||||
return rdUShort;
|
||||
}
|
||||
|
||||
void WriteUInt16(unsigned short val)
|
||||
{
|
||||
if (m_Data)
|
||||
{
|
||||
((unsigned short *)(m_Data + m_Position))[0] = val;
|
||||
m_Position += sizeof(unsigned short);
|
||||
}
|
||||
}
|
||||
virtual short ReadInt16()
|
||||
{
|
||||
short rdShort = 0;
|
||||
@ -104,7 +111,14 @@ public:
|
||||
|
||||
return rdInt;
|
||||
}
|
||||
|
||||
void WriteInt32(_INT32 val)
|
||||
{
|
||||
if (m_Data)
|
||||
{
|
||||
((_INT32 *)(m_Data + m_Position))[0] = val;
|
||||
m_Position += sizeof(_INT32);
|
||||
}
|
||||
}
|
||||
virtual unsigned int ReadUInt32()
|
||||
{
|
||||
int rdUInt = 0;
|
||||
@ -117,7 +131,22 @@ public:
|
||||
|
||||
return rdUInt;
|
||||
}
|
||||
|
||||
void WriteByte(unsigned char val)
|
||||
{
|
||||
if (m_Data)
|
||||
{
|
||||
m_Data[m_Position] = val;
|
||||
m_Position += 1;
|
||||
}
|
||||
}
|
||||
void WriteUInt32(_UINT32 val)
|
||||
{
|
||||
if (m_Data)
|
||||
{
|
||||
((_UINT32 *)(m_Data + m_Position))[0] = val;
|
||||
m_Position += sizeof(_UINT32);
|
||||
}
|
||||
}
|
||||
virtual unsigned char ReadByte()
|
||||
{
|
||||
unsigned char rdByte = 0;
|
||||
@ -159,6 +188,14 @@ public:
|
||||
|
||||
return pBytes;
|
||||
}
|
||||
void WriteBytes(unsigned char* pData, int size)
|
||||
{
|
||||
if (m_Data)
|
||||
{
|
||||
memcpy(m_Data + m_Position, pData, size);
|
||||
m_Position += size;
|
||||
}
|
||||
}
|
||||
|
||||
virtual unsigned long GetPosition() const
|
||||
{
|
||||
@ -172,7 +209,7 @@ public:
|
||||
|
||||
virtual int Seek (int offset, int origin = 0/*STREAM_SEEK_SET*/)
|
||||
{
|
||||
if ( (m_Data != NULL) && (offset > 0) && ((unsigned int)offset < m_Size) )
|
||||
if ( (m_Data != NULL) && (offset >= 0) && ((unsigned int)offset < m_Size) )
|
||||
return m_Position = offset;
|
||||
|
||||
return 0;
|
||||
@ -180,7 +217,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
unsigned char* m_Data;
|
||||
unsigned char* m_Data;
|
||||
unsigned long m_Size;
|
||||
unsigned long m_Position;
|
||||
bool bMemoryCopy;
|
||||
|
||||
@ -72,33 +72,42 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:o", OpenXmlNamespaces::Office );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:w10", OpenXmlNamespaces::OfficeWord );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:r", OpenXmlNamespaces::Relationships );
|
||||
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wpc", L"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:mc", L"http://schemas.openxmlformats.org/markup-compatibility/2006");
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wp14", L"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:w14", L"http://schemas.microsoft.com/office/word/2010/wordml" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wpg", L"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wpi", L"http://schemas.microsoft.com/office/word/2010/wordprocessingInk" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wne", L"http://schemas.microsoft.com/office/word/2006/wordml" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wps", L"http://schemas.microsoft.com/office/word/2010/wordprocessingShape" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:m", L"http://schemas.openxmlformats.org/officeDocument/2006/math" );
|
||||
m_pXmlWriter->WriteAttribute( L"mc:Ignorable", L"w14 wp14" );
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
PictureBulletsMapping();
|
||||
|
||||
int i = 0;
|
||||
|
||||
for (std::list<ListData*>::iterator iter = rglst->listData.begin(); iter != rglst->listData.end(); ++iter, ++i)
|
||||
for (size_t i = 0; i < rglst->listData.size(); ++i)
|
||||
{
|
||||
//start abstractNum
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:abstractNum", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::IntToWideString( i ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::IntToWideString( i /*+ 1 */));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
//nsid
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:nsid", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToFormattedWideString( (*iter)->lsid, L"%08x" ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToFormattedWideString( rglst->listData[i]->lsid, L"%08x" ));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
|
||||
//multiLevelType
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:multiLevelType", TRUE );
|
||||
|
||||
if ( (*iter)->fHybrid )
|
||||
if ( rglst->listData[i]->fHybrid )
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", L"hybridMultilevel" );
|
||||
}
|
||||
else if ( (*iter)->fSimpleList )
|
||||
else if ( rglst->listData[i]->fSimpleList )
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", L"singleLevel" );
|
||||
}
|
||||
@ -111,32 +120,32 @@ namespace DocFileFormat
|
||||
|
||||
//template
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:tmpl", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToFormattedWideString( (*iter)->tplc, L"%08x"));
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToFormattedWideString( rglst->listData[i]->tplc, L"%08x"));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
|
||||
// writes the levels
|
||||
size_t length = (*iter)->rglvl->size();
|
||||
size_t length = rglst->listData[i]->rglvl->size();
|
||||
|
||||
for (size_t j = 0; j < length; ++j)
|
||||
{
|
||||
ListLevel* lvl = (*iter)->rglvl->at(j);
|
||||
LevelMapping(lvl, j, (*iter)->rgistd[j]);
|
||||
ListLevel* lvl = rglst->listData[i]->rglvl->at(j);
|
||||
LevelMapping(lvl, j, rglst->listData[i]->rgistd[j]);
|
||||
}
|
||||
|
||||
//end abstractNum
|
||||
m_pXmlWriter->WriteNodeEnd( L"w:abstractNum" );
|
||||
}
|
||||
//write old style numbering (сложносоставных не сущестует)
|
||||
for (std::list<NumberingDescriptor>::iterator iter = rglst->listNumbering.begin(); iter != rglst->listNumbering.end(); ++iter, ++i)
|
||||
for (size_t i = 0; i < rglst->listNumbering.size(); ++i)
|
||||
{
|
||||
//start abstractNum
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:abstractNum", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::IntToWideString( i ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::IntToWideString( rglst->listNumbering[i]->id ));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
////nsid
|
||||
//m_pXmlWriter->WriteNodeBegin( L"w:nsid", TRUE );
|
||||
//m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToFormattedWideString( (*iter)->lsid, L"%08x" ) ));
|
||||
//m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToFormattedWideString( rglst->listNumbering[i]->lsid, L"%08x" ) ));
|
||||
//m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
|
||||
//multiLevelType
|
||||
@ -147,14 +156,14 @@ namespace DocFileFormat
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
|
||||
LevelMapping(*iter, 0);
|
||||
LevelMapping(rglst->listNumbering[i], 0);
|
||||
|
||||
//end abstractNum
|
||||
m_pXmlWriter->WriteNodeEnd( L"w:abstractNum" );
|
||||
}
|
||||
|
||||
//write the overrides
|
||||
for (unsigned int i = 0; i < m_document->listFormatOverrideTable->size(); ++i)
|
||||
for (size_t i = 0; i < m_document->listFormatOverrideTable->size(); ++i)
|
||||
{
|
||||
ListFormatOverride* lfo = m_document->listFormatOverrideTable->at(i);
|
||||
|
||||
@ -193,16 +202,15 @@ namespace DocFileFormat
|
||||
|
||||
if (m_document->listFormatOverrideTable->empty() && !rglst->listNumbering.empty())
|
||||
{
|
||||
i = 0;
|
||||
for (std::list<NumberingDescriptor>::iterator iter = rglst->listNumbering.begin(); iter != rglst->listNumbering.end(); ++iter, ++i)
|
||||
for (size_t i = 0; i < rglst->listNumbering.size(); ++i)
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:num", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:numId", FormatUtils::IntToWideString(i+1));
|
||||
m_pXmlWriter->WriteAttribute( L"w:numId", FormatUtils::IntToWideString(rglst->listNumbering[i]->id));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:abstractNumId", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToWideString( i ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToWideString( rglst->listNumbering[i]->id ));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd(L"w:num");
|
||||
@ -215,21 +223,20 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
int NumberingMapping::FindIndexbyId(const std::list<ListData*>& listData, int id)
|
||||
int NumberingMapping::FindIndexbyId(std::vector<ListDataPtr>& listData, int lsid)
|
||||
{
|
||||
int ret = -1;
|
||||
int i = 0;
|
||||
|
||||
for (std::list<ListData*>::const_iterator iter = listData.begin(); iter != listData.end(); ++iter, ++i)
|
||||
for (size_t i = 0; i < listData.size(); ++i)
|
||||
{
|
||||
if ((*iter)->lsid == id)
|
||||
if (listData[i]->lsid == lsid)
|
||||
{
|
||||
ret = i;
|
||||
break;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Converts the number text of the binary format to the number text of OOXML.
|
||||
@ -288,15 +295,17 @@ namespace DocFileFormat
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::wstring NumberingMapping::GetLvlText(const NumberingDescriptor& lvl, bool bIsSymbol, int Before, int After) const
|
||||
std::wstring NumberingMapping::GetLvlText(NumberingDescriptorPtr& lvl, bool bIsSymbol, int Before, int After) const
|
||||
{
|
||||
if (!lvl)return L"";
|
||||
|
||||
std::wstring ret;
|
||||
|
||||
if (lvl.nfc == 0xff)
|
||||
if (lvl->nfc == 0xff)
|
||||
{
|
||||
if (!lvl.xst.empty())
|
||||
if (!lvl->xst.empty())
|
||||
{
|
||||
wchar_t xchBullet = lvl.xst[0];
|
||||
wchar_t xchBullet = lvl->xst[0];
|
||||
|
||||
// В символьном шрифте обрезать надо, в других случаях - нет
|
||||
if (bIsSymbol && (xchBullet & 0xF000) != 0)
|
||||
@ -306,7 +315,7 @@ namespace DocFileFormat
|
||||
|
||||
if (!FormatUtils::IsControlSymbol(xchBullet))
|
||||
{
|
||||
ret.push_back(lvl.xst[0]);
|
||||
ret.push_back(lvl->xst[0]);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -316,8 +325,8 @@ namespace DocFileFormat
|
||||
}
|
||||
else
|
||||
{
|
||||
std::wstring strBefore = lvl.xst.substr(0, Before);
|
||||
std::wstring strAfter = lvl.xst.substr(Before, After);
|
||||
std::wstring strBefore = lvl->xst.substr(0, Before);
|
||||
std::wstring strAfter = lvl->xst.substr(Before, After);
|
||||
|
||||
ret = strBefore + L"%1" + strAfter ;
|
||||
}
|
||||
@ -473,14 +482,16 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
void NumberingMapping::LevelMapping(const NumberingDescriptor& lvl, unsigned int level)
|
||||
void NumberingMapping::LevelMapping(NumberingDescriptorPtr & lvl, unsigned int level)
|
||||
{
|
||||
if (!lvl) return;
|
||||
|
||||
std::wstring fontFamily;
|
||||
bool isSymbol = false;
|
||||
|
||||
if( lvl.ftc < m_document->FontTable->Data.size() )
|
||||
if( lvl->ftc < m_document->FontTable->Data.size() )
|
||||
{
|
||||
FontFamilyName* ffn = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( lvl.ftc ) );
|
||||
FontFamilyName* ffn = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( lvl->ftc ) );
|
||||
isSymbol = (ffn->chs == 2);
|
||||
fontFamily = FormatUtils::XmlEncode(ffn->xszFtn);
|
||||
}
|
||||
@ -491,22 +502,22 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:start", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToWideString(lvl.iStartAt));
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToWideString(lvl->iStartAt));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:numFmt", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", GetNumberFormatWideString(lvl.nfc, true));
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", GetNumberFormatWideString(lvl->nfc, true));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
|
||||
//// suffix
|
||||
// m_pXmlWriter->WriteNodeBegin( L"w:suff", TRUE );
|
||||
// m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::MapValueToWideString(lvl.ixchFollow, &FollowingCharMap[0][0], 3, 8));
|
||||
// m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::MapValueToWideString(lvl->ixchFollow, &FollowingCharMap[0][0], 3, 8));
|
||||
// m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
|
||||
// Number level text
|
||||
std::wstring lvlText = GetLvlText(lvl, isSymbol, lvl.cbTextBefore, lvl.cbTextAfter);
|
||||
std::wstring lvlText = GetLvlText(lvl, isSymbol, lvl->cbTextBefore, lvl->cbTextAfter);
|
||||
|
||||
//if (lvlText.empty() && lvl.ftc == 0)//auto
|
||||
//if (lvlText.empty() && lvl->ftc == 0)//auto
|
||||
//{
|
||||
// lvlText.push_back(L'\xF0B7');
|
||||
// lvlText.push_back(L'\0');
|
||||
@ -522,7 +533,7 @@ namespace DocFileFormat
|
||||
|
||||
// jc
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:lvlJc", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::MapValueToWideString(lvl.jc, &LevelJustificationMap[0][0], 3, 7));
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::MapValueToWideString(lvl->jc, &LevelJustificationMap[0][0], 3, 7));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
// pPr
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:pPr", FALSE );
|
||||
|
||||
@ -63,7 +63,7 @@ namespace DocFileFormat
|
||||
NumberingMapping(ConversionContext* ctx);
|
||||
void Apply(IVisitable* visited);
|
||||
|
||||
static int FindIndexbyId(const std::list<ListData*>& listData, int id);
|
||||
static int FindIndexbyId(std::vector<ListDataPtr>& listData, int id);
|
||||
/// Converts the number format code of the binary format.
|
||||
static std::wstring GetNumberFormatWideString(int nfc, int nWordVersion = 0);
|
||||
|
||||
@ -73,12 +73,12 @@ namespace DocFileFormat
|
||||
// Converts the number text of the binary format to the number text of OOXML.
|
||||
// OOXML uses different placeholders for the numbers.
|
||||
std::wstring GetLvlText(const ListLevel* lvl, bool bIsSymbol) const;
|
||||
std::wstring GetLvlText(const NumberingDescriptor& lvl, bool bIsSymbol, int Before, int After) const;
|
||||
std::wstring GetLvlText(NumberingDescriptorPtr& lvl, bool bIsSymbol, int Before, int After) const;
|
||||
|
||||
static bool IsPlaceholder(wchar_t symbol);
|
||||
|
||||
void LevelMapping(const ListLevel* lvl, unsigned int level, short styleIndex);
|
||||
void LevelMapping(const NumberingDescriptor& lvl, unsigned int level);
|
||||
void LevelMapping(NumberingDescriptorPtr & lvl, unsigned int level);
|
||||
|
||||
void PictureBulletsMapping();
|
||||
void WriteLevelPictureBullet(const CharacterPropertyExceptions* grpprlChpx);
|
||||
|
||||
@ -58,7 +58,7 @@ namespace DocFileFormat
|
||||
|
||||
public:
|
||||
|
||||
OfficeArtContent (const FileInformationBlock* pFIB, POLE::Stream* pStream): m_pDrawingGroupData(NULL), m_pBackgroud(NULL)
|
||||
OfficeArtContent (const FileInformationBlock* pFIB, POLE::Stream* pStream): m_pDrawingGroupData(NULL), m_pBackgroud(NULL), m_uLastShapeId(1024)
|
||||
{
|
||||
VirtualStreamReader oStearmReader(pStream, 0 , pFIB->m_nWordVersion);
|
||||
|
||||
@ -79,14 +79,13 @@ namespace DocFileFormat
|
||||
drawing.dgglbl = (DrawingType)oStearmReader.ReadByte();
|
||||
drawing.container = static_cast<DrawingContainer*>(RecordFactory::ReadRecord (&oStearmReader, 0));
|
||||
|
||||
for (unsigned int i = 0; i < drawing.container->Children.size(); ++i)
|
||||
for (size_t i = 0; i < drawing.container->Children.size(); ++i)
|
||||
{
|
||||
Record* groupChild = drawing.container->Children[i];
|
||||
if (groupChild)
|
||||
{
|
||||
if (GroupContainer::TYPE_CODE_0xF003 == groupChild->TypeCode)
|
||||
{
|
||||
// the child is a subgroup
|
||||
GroupContainer* group = static_cast<GroupContainer*>(groupChild);
|
||||
if (group)
|
||||
{
|
||||
@ -95,17 +94,24 @@ namespace DocFileFormat
|
||||
}
|
||||
else if (ShapeContainer::TYPE_CODE_0xF004 == groupChild->TypeCode)
|
||||
{
|
||||
// the child is a shape
|
||||
ShapeContainer* shape = static_cast<ShapeContainer*>(groupChild);
|
||||
if (shape)
|
||||
{
|
||||
shape->Index = i;
|
||||
if (shape->isBackground())
|
||||
shape->m_nIndex = i;
|
||||
if (shape->m_bBackground)
|
||||
{
|
||||
m_pBackgroud = shape;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (DrawingRecord::TYPE_CODE_0xF008 == groupChild->TypeCode)
|
||||
{
|
||||
DrawingRecord* dr = static_cast<DrawingRecord*>(groupChild);
|
||||
if (dr)
|
||||
{
|
||||
m_uLastShapeId = dr->spidCur;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,7 +140,7 @@ namespace DocFileFormat
|
||||
GroupContainer* group = iter->container->FirstChildWithType<GroupContainer>();
|
||||
if (group)
|
||||
{
|
||||
for (unsigned int i = 1; i < group->Children.size(); ++i)
|
||||
for (size_t i = 1; i < group->Children.size(); ++i)
|
||||
{
|
||||
Record* groupChild = group->Children[i];
|
||||
|
||||
@ -183,7 +189,7 @@ namespace DocFileFormat
|
||||
{
|
||||
return m_pDrawingGroupData;
|
||||
}
|
||||
|
||||
unsigned int m_uLastShapeId;
|
||||
private:
|
||||
ShapeContainer* m_pBackgroud;
|
||||
DrawingGroup* m_pDrawingGroupData;
|
||||
|
||||
@ -40,13 +40,13 @@ namespace DocFileFormat
|
||||
public:
|
||||
static const unsigned short TYPE_CODE_0xF010 = 0xF010;
|
||||
|
||||
ClientAnchor() : Record(), clientanchor(0)
|
||||
ClientAnchor() : Record(), value(0)
|
||||
{
|
||||
}
|
||||
|
||||
ClientAnchor (IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance) : Record (_reader, size, typeCode, version, instance), clientanchor(0)
|
||||
ClientAnchor (IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance) : Record (_reader, size, typeCode, version, instance), value(0)
|
||||
{
|
||||
clientanchor = Reader->ReadInt32();
|
||||
value = Reader->ReadInt32(); //index PlcfSpa
|
||||
}
|
||||
|
||||
virtual ~ClientAnchor()
|
||||
@ -58,8 +58,6 @@ namespace DocFileFormat
|
||||
return new ClientAnchor (_reader, bodySize, typeCode, version, instance);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
int clientanchor;
|
||||
unsigned int value;
|
||||
};
|
||||
}
|
||||
@ -38,30 +38,30 @@ namespace DocFileFormat
|
||||
class DrawingRecord: public Record
|
||||
{
|
||||
public:
|
||||
static const unsigned short TYPE_CODE_0xF008 = 0xF008;
|
||||
static const unsigned short TYPE_CODE_0xF008 = 0xF008;
|
||||
|
||||
unsigned int csp; // The number of shapes in this drawing
|
||||
int spidCur; // The last MSOSPID given to an SP in this DG
|
||||
unsigned int csp; // The number of shapes in this drawing
|
||||
unsigned int spidCur; // The last MSOSPID given to an SP in this DG
|
||||
|
||||
DrawingRecord():
|
||||
Record(), csp(0), spidCur(0)
|
||||
{
|
||||
}
|
||||
DrawingRecord():
|
||||
Record(), csp(0), spidCur(0)
|
||||
{
|
||||
}
|
||||
|
||||
DrawingRecord( IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance ):
|
||||
Record( _reader, size, typeCode, version, instance )
|
||||
{
|
||||
DrawingRecord( IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance ):
|
||||
Record( _reader, size, typeCode, version, instance )
|
||||
{
|
||||
csp = Reader->ReadUInt32();
|
||||
spidCur = Reader->ReadInt32();
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~DrawingRecord()
|
||||
{
|
||||
}
|
||||
virtual ~DrawingRecord()
|
||||
{
|
||||
}
|
||||
|
||||
virtual Record* NewObject( IBinaryReader* _reader, unsigned int bodySize, unsigned int typeCode, unsigned int version, unsigned int instance )
|
||||
{
|
||||
return new DrawingRecord( _reader, bodySize, typeCode, version, instance );
|
||||
}
|
||||
virtual Record* NewObject( IBinaryReader* _reader, unsigned int bodySize, unsigned int typeCode, unsigned int version, unsigned int instance )
|
||||
{
|
||||
return new DrawingRecord( _reader, bodySize, typeCode, version, instance );
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -65,7 +65,7 @@ namespace DocFileFormat
|
||||
{
|
||||
// the child is a shape
|
||||
ShapeContainer* shape = static_cast<ShapeContainer*>(groupChild);
|
||||
shape->Index = i;
|
||||
shape->m_nIndex = i;
|
||||
this->Children[i] = shape;
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,13 +50,9 @@ namespace DocFileFormat
|
||||
/*========================================================================================================*/
|
||||
|
||||
Record::Record( IBinaryReader* _reader, unsigned int bodySize, unsigned int typeCode, unsigned int version, unsigned int instance ):
|
||||
HeaderSize(0), BodySize(0), RawData(NULL), SiblingIdx(0), TypeCode(0), Version(0), Instance(0), Reader(NULL),
|
||||
HeaderSize(Record::HEADER_SIZE_IN_BYTES), BodySize(bodySize), RawData(NULL), SiblingIdx(0), TypeCode(typeCode), Version(version), Instance(instance), Reader(NULL),
|
||||
_ParentRecord(NULL)
|
||||
{
|
||||
BodySize = bodySize;
|
||||
TypeCode = typeCode;
|
||||
Version = version;
|
||||
Instance = instance;
|
||||
HeaderSize = Record::HEADER_SIZE_IN_BYTES;
|
||||
|
||||
int real_size = _reader->GetSize() - _reader->GetPosition();
|
||||
|
||||
@ -76,7 +76,7 @@ namespace DocFileFormat
|
||||
{
|
||||
result = pRecord->NewObject (reader, size, typeCode, version, instance);
|
||||
if (result)
|
||||
result->SiblingIdx = siblingIdx;
|
||||
result->SiblingIdx = siblingIdx;
|
||||
RELEASEOBJECT(pRecord);
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,11 +84,11 @@ namespace DocFileFormat
|
||||
{
|
||||
T* firstChildWithType = NULL;
|
||||
|
||||
for ( std::vector<Record*>::const_iterator iter = this->Children.begin(); iter != this->Children.end(); iter++ )
|
||||
for ( size_t i = 0; i < this->Children.size(); ++i )
|
||||
{
|
||||
if ( (*iter != NULL) && (typeid(T) == typeid(**iter)) )
|
||||
if ( (this->Children[i] != NULL) && (typeid(T) == typeid(*(this->Children[i]))) )
|
||||
{
|
||||
firstChildWithType = static_cast<T*>(*iter);
|
||||
firstChildWithType = static_cast<T*>(this->Children[i]);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
#include "RegularContainer.h"
|
||||
#include "ShapeOptions.h"
|
||||
#include "Shape.h"
|
||||
#include "ClientAnchor.h"
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
@ -42,30 +43,35 @@ namespace DocFileFormat
|
||||
public:
|
||||
static const unsigned short TYPE_CODE_0xF004 = 0xF004;
|
||||
|
||||
int Index;
|
||||
int m_nIndex;
|
||||
unsigned int m_nShapeType;
|
||||
bool m_bBackground;
|
||||
bool m_bOLE;
|
||||
bool m_bSkip;
|
||||
|
||||
ShapeContainer():
|
||||
RegularContainer(), Index(0)
|
||||
RegularContainer(), m_nIndex(0), m_nShapeType(0), m_bSkip(false), m_bBackground(false), m_bOLE(false)
|
||||
{
|
||||
}
|
||||
|
||||
ShapeContainer( IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance ):
|
||||
RegularContainer( _reader, size, typeCode, version, instance ), Index(0)
|
||||
ShapeContainer( IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance ) :
|
||||
m_bSkip(false), m_bBackground(false), m_bOLE(false), m_nIndex(0), m_nShapeType(0), RegularContainer( _reader, size, typeCode, version, instance )
|
||||
{
|
||||
}
|
||||
|
||||
int getShapeType()
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
for ( std::vector<Record*>::const_iterator iter = this->Children.begin(); iter != this->Children.end(); iter++ )
|
||||
for ( size_t i = 0; i < this->Children.size(); ++i )
|
||||
{
|
||||
Shape* sh = dynamic_cast<Shape*>( *iter );
|
||||
ClientAnchor *clientAnchor = dynamic_cast<ClientAnchor*>( this->Children[i] );
|
||||
if ( (clientAnchor) && (clientAnchor->value == 0x80000000))
|
||||
m_bSkip = true;
|
||||
|
||||
Shape* sh = dynamic_cast<Shape*>( this->Children[i] );
|
||||
if (sh)
|
||||
{
|
||||
m_bBackground = sh->fBackground;
|
||||
m_bOLE = sh->fOleShape;
|
||||
|
||||
if (sh->shapeType)
|
||||
{
|
||||
return sh->shapeType->GetTypeCode();
|
||||
m_nShapeType = sh->shapeType->GetTypeCode();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -76,44 +82,16 @@ namespace DocFileFormat
|
||||
{
|
||||
if (sh_options->OptionsByID.end() != sh_options->OptionsByID.find(Pib))
|
||||
{
|
||||
return msosptPictureFrame;
|
||||
m_nShapeType = msosptPictureFrame;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
bool isBackground()
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
for ( std::vector<Record*>::const_iterator iter = this->Children.begin(); iter != this->Children.end(); iter++ )
|
||||
{
|
||||
Shape* sh = dynamic_cast<Shape*>( *iter );
|
||||
if (sh)
|
||||
{
|
||||
return sh->fBackground;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool isOLE()
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
for ( std::vector<Record*>::const_iterator iter = this->Children.begin(); iter != this->Children.end(); iter++ )
|
||||
{
|
||||
Shape* sh = dynamic_cast<Shape*>( *iter );
|
||||
if (sh)
|
||||
{
|
||||
return sh->fOleShape;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
virtual ~ShapeContainer()
|
||||
{
|
||||
}
|
||||
@ -128,9 +106,9 @@ namespace DocFileFormat
|
||||
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++ )
|
||||
for ( size_t i = 0; i < this->Children.size(); ++i )
|
||||
{
|
||||
ShapeOptions* opt = dynamic_cast<ShapeOptions*>( *iter );
|
||||
ShapeOptions* opt = dynamic_cast<ShapeOptions*>( this->Children[i] );
|
||||
|
||||
if ( opt == NULL ) continue;
|
||||
|
||||
|
||||
@ -422,12 +422,11 @@ namespace DocFileFormat
|
||||
//numbering
|
||||
case sprmOldPAnld:
|
||||
{
|
||||
NumberingDescriptor desc( iter->Arguments, iter->argumentsSize );
|
||||
NumberingDescriptorPtr desc = NumberingDescriptor::create( iter->Arguments, iter->argumentsSize );
|
||||
|
||||
if (m_document->listTable)
|
||||
{
|
||||
m_document->listTable->appendNumbering( desc );
|
||||
short numId = static_cast<short>(m_document->listTable->listNumbering.size());
|
||||
unsigned short numId = m_document->listTable->appendNumbering( desc );
|
||||
appendValueElement( &numPr, L"numId", numId, true );
|
||||
}
|
||||
}break;
|
||||
@ -460,7 +459,8 @@ namespace DocFileFormat
|
||||
//Todo разобраться с закоментированным кодом
|
||||
if (NULL != m_document->listTable && false == m_document->listTable->listData.empty())
|
||||
{
|
||||
appendValueElement( &numPr, L"numId", FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize ), true );
|
||||
unsigned short numId = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
appendValueElement( &numPr, L"numId", numId, true );
|
||||
}
|
||||
|
||||
//check if there is a ilvl reference, if not, check the count of LVLs.
|
||||
@ -566,14 +566,35 @@ namespace DocFileFormat
|
||||
|
||||
case sprmOldPDxaAbs:
|
||||
case sprmPDxaAbs:
|
||||
appendValueAttribute( _framePr, L"w:x", FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
break;
|
||||
|
||||
{
|
||||
unsigned short val = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
switch (val)
|
||||
{
|
||||
case 0x0000: break; //left
|
||||
case 0xfffc: appendValueAttribute( _framePr, L"w:xAlign", L"center"); break;
|
||||
case 0xfff8: appendValueAttribute( _framePr, L"w:xAlign", L"right"); break;
|
||||
case 0xfff4: appendValueAttribute( _framePr, L"w:xAlign", L"inside"); break;
|
||||
case 0xfff0: appendValueAttribute( _framePr, L"w:xAlign", L"outside"); break;
|
||||
default:
|
||||
appendValueAttribute( _framePr, L"w:x", (short)val);
|
||||
}
|
||||
}break;
|
||||
case sprmOldPDyaAbs:
|
||||
case sprmPDyaAbs:
|
||||
appendValueAttribute( _framePr, L"w:y", FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
break;
|
||||
|
||||
{
|
||||
unsigned short val = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
switch (val)
|
||||
{
|
||||
case 0x0000: break; //inline
|
||||
case 0xfffc: appendValueAttribute( _framePr, L"w:yAlign", L"top"); break;
|
||||
case 0xfff8: appendValueAttribute( _framePr, L"w:yAlign", L"center"); break;
|
||||
case 0xfff4: appendValueAttribute( _framePr, L"w:yAlign", L"bottom"); break;
|
||||
case 0xfff0: appendValueAttribute( _framePr, L"w:yAlign", L"inside"); break;
|
||||
case 0xffec: appendValueAttribute( _framePr, L"w:yAlign", L"outside"); break;
|
||||
default:
|
||||
appendValueAttribute( _framePr, L"w:y", (short)val );
|
||||
}
|
||||
}break;
|
||||
case sprmPWHeightAbs:
|
||||
appendValueAttribute( _framePr, L"w:h", FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
break;
|
||||
|
||||
@ -48,6 +48,7 @@ namespace DocFileFormat
|
||||
std::vector<ByteStructure*> Elements;
|
||||
bool m_bIsValid;
|
||||
|
||||
std::map<int, int> mapCP;
|
||||
public:
|
||||
Plex(int structureLength, POLE::Stream* stream, unsigned int fc, unsigned int lcb, int nWordVersion)
|
||||
: m_bIsValid(false), CP_LENGTH(/*nWordVersion == 2 ? 2 :*/ 4)
|
||||
@ -77,7 +78,10 @@ namespace DocFileFormat
|
||||
|
||||
for (int i = 0; i < (n + 1); ++i)
|
||||
{
|
||||
CharacterPositions.push_back(reader.ReadInt32());
|
||||
int val = reader.ReadInt32();
|
||||
|
||||
mapCP.insert(std::make_pair(val, (int)CharacterPositions.size()));
|
||||
CharacterPositions.push_back(val);
|
||||
}
|
||||
|
||||
// read the n structs
|
||||
@ -96,9 +100,9 @@ namespace DocFileFormat
|
||||
|
||||
~Plex()
|
||||
{
|
||||
for (std::vector<ByteStructure*>::iterator iter = Elements.begin(); iter != Elements.end(); ++iter)
|
||||
for (size_t i = 0; i < Elements.size(); ++i)
|
||||
{
|
||||
RELEASEOBJECT(*iter);
|
||||
RELEASEOBJECT(Elements[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,15 +113,14 @@ namespace DocFileFormat
|
||||
{
|
||||
int index = -1;
|
||||
|
||||
for (int i = 0; i < (int)CharacterPositions.size(); ++i)
|
||||
std::map<int, int>::iterator pFind = mapCP.find(cp);
|
||||
|
||||
if (pFind != mapCP.end())
|
||||
{
|
||||
if (CharacterPositions[i] == cp)
|
||||
{
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
index = pFind->second;
|
||||
}
|
||||
|
||||
|
||||
if ((index >= 0) && (index < (int)Elements.size()))
|
||||
return this->Elements[index];
|
||||
|
||||
@ -128,13 +131,11 @@ namespace DocFileFormat
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
for (int i = 0; i < (int)CharacterPositions.size(); ++i)
|
||||
std::map<int, int>::const_iterator pFind = mapCP.find(cp);
|
||||
|
||||
if (pFind != mapCP.end())
|
||||
{
|
||||
if (CharacterPositions[i] == cp)
|
||||
{
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -142,7 +143,7 @@ namespace DocFileFormat
|
||||
|
||||
inline int operator [] (unsigned int index) const
|
||||
{
|
||||
if (index < CharacterPositions.size())
|
||||
if (index < (unsigned int)CharacterPositions.size())
|
||||
return CharacterPositions[index];
|
||||
|
||||
return -1;
|
||||
|
||||
@ -345,22 +345,23 @@ namespace DocFileFormat
|
||||
_tcPr->AppendChild( tcW );
|
||||
|
||||
|
||||
//if ( ( _gridIndex < (int)_grid->size() ) && ( nComputedCellWidth > _grid->at( _gridIndex ) ) )
|
||||
//{
|
||||
// //check the number of merged cells
|
||||
// int w = _grid->at( _gridIndex );
|
||||
if ( _gridSpan == 1 && ( _gridIndex < (int)_grid->size() ) && ( nComputedCellWidth > _grid->at( _gridIndex ) ) )
|
||||
{
|
||||
//check the number of merged cells
|
||||
int w = _grid->at( _gridIndex );
|
||||
|
||||
// for ( size_t i = _gridIndex + 1; i < _grid->size(); i++ )
|
||||
// {
|
||||
// _gridSpan++;
|
||||
for ( size_t i = _gridIndex + 1; i < _grid->size(); i++ )
|
||||
{
|
||||
_gridSpan++;
|
||||
|
||||
// w += _grid->at( i );
|
||||
w += _grid->at( i );
|
||||
|
||||
// if ( w >= nComputedCellWidth )
|
||||
// {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
if ( w >= nComputedCellWidth )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_gridSpan > 1)
|
||||
{
|
||||
appendValueElement( _tcPr, L"gridSpan", FormatUtils::IntToWideString( _gridSpan ), true );
|
||||
|
||||
@ -156,9 +156,8 @@ namespace DocFileFormat
|
||||
}break;
|
||||
|
||||
//div id
|
||||
case sprmTIpgp:
|
||||
case sprmTIpgp:// = PGPInfo.ipgpSelf (PGPInfo structure describes the border and margin properties)
|
||||
{
|
||||
appendValueElement( _trPr, L"divId", FormatUtils::IntToWideString( FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize ) ), true );
|
||||
}break;
|
||||
|
||||
//borders 80 exceptions
|
||||
|
||||
@ -142,7 +142,7 @@ namespace DocFileFormat
|
||||
{
|
||||
newXmlString.clear();
|
||||
|
||||
std::wstring sTempFolder = m_ctx->_doc->m_sTempFolder;
|
||||
std::wstring sTempFolder = m_context->_doc->m_sTempFolder;
|
||||
if (sTempFolder.empty())
|
||||
{
|
||||
sTempFolder = NSFile::CFileBinary::GetTempPath();
|
||||
@ -211,7 +211,7 @@ namespace DocFileFormat
|
||||
|
||||
VMLPictureMapping::VMLPictureMapping(ConversionContext* ctx, XMLTools::CStringXmlWriter* writer, bool olePreview, IMapping* caller, bool isInlinePicture) : PropertiesMapping(writer)
|
||||
{
|
||||
m_ctx = ctx;
|
||||
m_context = ctx;
|
||||
m_isOlePreview = olePreview;
|
||||
m_imageData = NULL;
|
||||
m_nImageId = 0;
|
||||
@ -229,7 +229,18 @@ namespace DocFileFormat
|
||||
{
|
||||
RELEASEOBJECT(m_imageData);
|
||||
}
|
||||
std::wstring VMLPictureMapping::GetShapeID(const Shape* pShape) const
|
||||
{
|
||||
std::wstring strXmlAttr;
|
||||
|
||||
if (NULL != pShape)
|
||||
{
|
||||
strXmlAttr += std::wstring(L"_x0000_i");
|
||||
strXmlAttr += FormatUtils::IntToWideString(pShape->GetShapeID());
|
||||
}
|
||||
|
||||
return strXmlAttr;
|
||||
}
|
||||
void VMLPictureMapping::Apply( IVisitable* visited )
|
||||
{
|
||||
PictureDescriptor* pict = dynamic_cast<PictureDescriptor*>(visited);
|
||||
@ -248,13 +259,14 @@ namespace DocFileFormat
|
||||
std::vector<OptionEntryPtr> options;
|
||||
|
||||
PictureFrameType type;
|
||||
Shape* pShape = NULL;
|
||||
if ((pict->shapeContainer || pict->blipStoreEntry) && pict->shapeContainer->Children.size() > 0)
|
||||
{
|
||||
Shape* shape = static_cast<Shape*>(*(pict->shapeContainer->Children.begin()));
|
||||
options = pict->shapeContainer->ExtractOptions();
|
||||
pShape = static_cast<Shape*>(*(pict->shapeContainer->Children.begin()));
|
||||
options = pict->shapeContainer->ExtractOptions();
|
||||
|
||||
//v:shapetype
|
||||
type.SetType(shape->Instance);
|
||||
type.SetType(pShape->Instance);
|
||||
|
||||
VMLShapeTypeMapping* vmlShapeTypeMapping = new VMLShapeTypeMapping( m_pXmlWriter, m_isInlinePicture );
|
||||
|
||||
@ -265,13 +277,16 @@ namespace DocFileFormat
|
||||
{
|
||||
type.SetType(msosptPictureFrame);
|
||||
}
|
||||
m_pXmlWriter->WriteNodeBegin( L"v:shape", true );
|
||||
m_pXmlWriter->WriteNodeBegin( L"v:shape", true );
|
||||
|
||||
//m_shapeId = GetShapeID(pShape); - todooo одинаковые картинки (одинаковый spid) - Anexo№3.doc
|
||||
|
||||
|
||||
count_vml_objects++;
|
||||
|
||||
if (m_shapeId.empty())
|
||||
m_shapeId = L"_x0000_s" + FormatUtils::IntToWideString(1024 + count_vml_objects);
|
||||
{
|
||||
m_context->_doc->GetOfficeArt()->m_uLastShapeId++;
|
||||
m_shapeId = L"_x0000_i" + FormatUtils::IntToWideString(m_context->_doc->GetOfficeArt()->m_uLastShapeId);
|
||||
}
|
||||
|
||||
m_pXmlWriter->WriteAttribute( L"id", m_shapeId);
|
||||
|
||||
@ -309,24 +324,28 @@ namespace DocFileFormat
|
||||
}break;
|
||||
//BORDERS
|
||||
case borderBottomColor:
|
||||
if (!pict->brcBottom)
|
||||
{
|
||||
RGBColor bottomColor( (int)iter->op, RedFirst );
|
||||
m_pXmlWriter->WriteAttribute( L"o:borderbottomcolor", L"#" + bottomColor.SixDigitHexCode);
|
||||
}
|
||||
break;
|
||||
case borderLeftColor:
|
||||
if (!pict->brcLeft)
|
||||
{
|
||||
RGBColor leftColor( (int)iter->op, RedFirst );
|
||||
m_pXmlWriter->WriteAttribute( L"o:borderleftcolor", L"#" + leftColor.SixDigitHexCode);
|
||||
}
|
||||
break;
|
||||
case borderRightColor:
|
||||
if (!pict->brcRight)
|
||||
{
|
||||
RGBColor rightColor( (int)iter->op, RedFirst );
|
||||
m_pXmlWriter->WriteAttribute( L"o:borderrightcolor", L"#" + rightColor.SixDigitHexCode);
|
||||
}
|
||||
break;
|
||||
case borderTopColor:
|
||||
if (!pict->brcTop)
|
||||
{
|
||||
RGBColor topColor( (int)iter->op, RedFirst );
|
||||
m_pXmlWriter->WriteAttribute( L"o:bordertopcolor", L"#" + topColor.SixDigitHexCode);
|
||||
@ -443,14 +462,15 @@ namespace DocFileFormat
|
||||
}
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
//v:imageData
|
||||
if (CopyPicture(pict))
|
||||
{
|
||||
//v:imageData
|
||||
appendValueAttribute(m_imageData, L"r:id", L"rId" + FormatUtils::IntToWideString(m_nImageId));
|
||||
appendValueAttribute(m_imageData, L"o:title", L"" );
|
||||
m_pXmlWriter->WriteString(m_imageData->GetXMLString());
|
||||
}
|
||||
|
||||
|
||||
{//borders
|
||||
writePictureBorder( L"bordertop", pict->brcTop );
|
||||
writePictureBorder( L"borderleft", pict->brcLeft );
|
||||
@ -510,10 +530,10 @@ namespace DocFileFormat
|
||||
pict->embeddedData = newData;
|
||||
|
||||
}
|
||||
m_ctx->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(Global::msoblipDIB),
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(Global::msoblipDIB),
|
||||
std::vector<unsigned char>(pict->embeddedData, (pict->embeddedData + pict->embeddedDataSize)), Global::msoblipDIB));
|
||||
|
||||
m_nImageId = m_ctx->_docx->RegisterImage(m_caller, btWin32);
|
||||
m_nImageId = m_context->_docx->RegisterImage(m_caller, btWin32);
|
||||
result = true;
|
||||
}
|
||||
else if ((oBlipEntry != NULL) && (oBlipEntry->Blip != NULL))
|
||||
@ -530,7 +550,7 @@ namespace DocFileFormat
|
||||
unsigned char *newData = NULL;
|
||||
int newDataSize = metaBlip->oMetaFile.ToBuffer(newData);
|
||||
|
||||
m_ctx->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlipEntry->btWin32), std::vector<unsigned char>(newData, (newData + newDataSize))));
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlipEntry->btWin32), std::vector<unsigned char>(newData, (newData + newDataSize))));
|
||||
|
||||
RELEASEARRAYOBJECTS(newData);
|
||||
}
|
||||
@ -546,7 +566,7 @@ namespace DocFileFormat
|
||||
BitmapBlip* bitBlip = static_cast<BitmapBlip*>(oBlipEntry->Blip);
|
||||
if (bitBlip)
|
||||
{
|
||||
m_ctx->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlipEntry->btWin32),
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlipEntry->btWin32),
|
||||
std::vector<unsigned char>(bitBlip->m_pvBits, (bitBlip->m_pvBits + bitBlip->pvBitsSize)), oBlipEntry->btWin32));
|
||||
}
|
||||
}break;
|
||||
@ -557,7 +577,7 @@ namespace DocFileFormat
|
||||
}break;
|
||||
}
|
||||
|
||||
m_nImageId = m_ctx->_docx->RegisterImage(m_caller, oBlipEntry->btWin32);
|
||||
m_nImageId = m_context->_docx->RegisterImage(m_caller, oBlipEntry->btWin32);
|
||||
result = true;
|
||||
}
|
||||
|
||||
|
||||
@ -58,6 +58,7 @@ namespace DocFileFormat
|
||||
void writePictureBorder (const std::wstring & name, const BorderCode* brc);
|
||||
void appendStyleProperty( std::wstring* b, const std::wstring& propName, const std::wstring& propValue ) const;
|
||||
bool ParseEmbeddedEquation( const std::string & xmlString, std::wstring & newXmlString );
|
||||
std::wstring GetShapeID(const Shape* pShape) const;
|
||||
protected:
|
||||
/// Copies the picture from the binary stream to the zip archive
|
||||
/// and creates the relationships for the image.
|
||||
@ -77,7 +78,7 @@ namespace DocFileFormat
|
||||
std::wstring m_shapeId;
|
||||
private:
|
||||
|
||||
ConversionContext* m_ctx;
|
||||
ConversionContext* m_context;
|
||||
IMapping* m_caller;
|
||||
int m_nImageId;
|
||||
|
||||
|
||||
@ -235,10 +235,11 @@ namespace DocFileFormat
|
||||
|
||||
m_shapeId = GetShapeID(pShape);
|
||||
|
||||
count_vml_objects++;
|
||||
|
||||
if (m_shapeId.empty())
|
||||
m_shapeId = std::wstring(L"_x0000_s") + FormatUtils::IntToWideString(1024 + count_vml_objects);
|
||||
{
|
||||
m_context->_doc->GetOfficeArt()->m_uLastShapeId++;
|
||||
m_shapeId = std::wstring(L"_x0000_s") + FormatUtils::IntToWideString(m_context->_doc->GetOfficeArt()->m_uLastShapeId);
|
||||
}
|
||||
|
||||
m_pXmlWriter->WriteAttribute ( L"id", m_shapeId );
|
||||
|
||||
@ -249,7 +250,7 @@ namespace DocFileFormat
|
||||
freeform = false;
|
||||
m_pXmlWriter->WriteAttribute( L"type", (std::wstring(L"#") + VMLShapeTypeMapping::GenerateTypeId(pShape->GetShapeType())));
|
||||
}
|
||||
m_pXmlWriter->WriteAttribute( L"style", FormatUtils::XmlEncode(buildStyle(pShape, pAnchor, options, pContainer->Index)));
|
||||
m_pXmlWriter->WriteAttribute( L"style", FormatUtils::XmlEncode(buildStyle(pShape, pAnchor, options, pContainer->m_nIndex)));
|
||||
|
||||
if (pShape->is<LineType>())
|
||||
{
|
||||
@ -2265,9 +2266,10 @@ namespace DocFileFormat
|
||||
TwipsValue w( primitive->dxa );
|
||||
TwipsValue h( primitive->dya );
|
||||
|
||||
std::wstring strId = std::wstring(L"_x0000_s") + FormatUtils::IntToWideString(1024 + count_vml_objects);
|
||||
m_context->_doc->GetOfficeArt()->m_uLastShapeId++;
|
||||
|
||||
std::wstring strId = std::wstring(L"_x0000_s") + FormatUtils::IntToWideString(m_context->_doc->GetOfficeArt()->m_uLastShapeId);
|
||||
|
||||
count_vml_objects++;
|
||||
//m_pXmlWriter->WriteAttribute ( L"id") , strId);
|
||||
m_pXmlWriter->WriteAttribute ( L"o:spid", strId);
|
||||
|
||||
|
||||
@ -124,12 +124,12 @@ namespace DocFileFormat
|
||||
else if (_isInlineShape)
|
||||
{
|
||||
m_pXmlWriter->WriteString(L"<v:formulas><v:f eqn=\"if lineDrawn pixelLineWidth 0\"/>\
|
||||
<v:f eqn=\"sum @0 1 0\"/><v:f eqn=\"sum 0 0 @1\"/>\
|
||||
<v:f eqn=\"prod @2 1 2\"/><v:f eqn=\"prod @3 21600 pixelWidth\"/>\
|
||||
<v:f eqn=\"prod @3 21600 pixelHeight\"/><v:f eqn=\"sum @0 0 1\"/>\
|
||||
<v:f eqn=\"prod @6 1 2\"/><v:f eqn=\"prod @7 21600 pixelWidth\"/>\
|
||||
<v:f eqn=\"sum @8 21600 0\"/><v:f eqn=\"prod @7 21600 pixelHeight\"/>\
|
||||
<v:f eqn=\"sum @10 21600 0\"/></v:formulas>");
|
||||
<v:f eqn=\"sum @0 1 0\"/><v:f eqn=\"sum 0 0 @1\"/>\
|
||||
<v:f eqn=\"prod @2 1 2\"/><v:f eqn=\"prod @3 21600 pixelWidth\"/>\
|
||||
<v:f eqn=\"prod @3 21600 pixelHeight\"/><v:f eqn=\"sum @0 0 1\"/>\
|
||||
<v:f eqn=\"prod @6 1 2\"/><v:f eqn=\"prod @7 21600 pixelWidth\"/>\
|
||||
<v:f eqn=\"sum @8 21600 0\"/><v:f eqn=\"prod @7 21600 pixelHeight\"/>\
|
||||
<v:f eqn=\"sum @10 21600 0\"/></v:formulas>");
|
||||
}
|
||||
|
||||
// Path
|
||||
|
||||
@ -37,8 +37,6 @@
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
static int count_vml_objects = 0;
|
||||
|
||||
class VMLShapeTypeMapping: public PropertiesMapping, public IMapping
|
||||
{
|
||||
private:
|
||||
|
||||
@ -85,7 +85,7 @@ namespace DocFileFormat
|
||||
IndividualFootnotesPlex(NULL), FootnoteReferenceCharactersPlex(NULL), IndividualEndnotesPlex(NULL),
|
||||
EndnoteReferenceCharactersPlex(NULL), FieldsPlex(NULL), FootnoteDocumentFieldsPlex(NULL),
|
||||
EndnoteDocumentFieldsPlex(NULL), HeadersAndFootersDocumentFieldsPlex(NULL), HeaderStoriesPlex(NULL),
|
||||
AnnotationsReferencePlex(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),
|
||||
OfficeDrawingPlex(NULL), OfficeDrawingPlexHeader(NULL), SectionPlex(NULL), BookmarkStartPlex(NULL), BookmarkEndPlex(NULL),
|
||||
AutoTextPlex(NULL), AllPapxFkps(NULL), AllChpxFkps(NULL), AllPapx(NULL), AllPapxVector(NULL), AllSepx(NULL), Styles(NULL), listTable(NULL),
|
||||
@ -318,8 +318,8 @@ namespace DocFileFormat
|
||||
// Read all needed PLCFs
|
||||
if (FIB->m_RgLw97.ccpFtn > 0)
|
||||
{
|
||||
IndividualFootnotesPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcffndTxt, FIB->m_FibWord97.lcbPlcffndTxt, nWordVersion);
|
||||
FootnoteReferenceCharactersPlex = new Plex<FootnoteDescriptor>(FootnoteDescriptor::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcffndRef, FIB->m_FibWord97.lcbPlcffndRef, nWordVersion);
|
||||
IndividualFootnotesPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcffndTxt, FIB->m_FibWord97.lcbPlcffndTxt, nWordVersion);
|
||||
}
|
||||
|
||||
if (nWordVersion > 0 && FIB->m_FibWord97.lcbPlcPad > 0)
|
||||
@ -329,8 +329,8 @@ namespace DocFileFormat
|
||||
|
||||
if (FIB->m_RgLw97.ccpEdn > 0)
|
||||
{
|
||||
IndividualEndnotesPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfendTxt, FIB->m_FibWord97.lcbPlcfendTxt, nWordVersion);
|
||||
EndnoteReferenceCharactersPlex = new Plex<EndnoteDescriptor>(EndnoteDescriptor::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfendRef, FIB->m_FibWord97.lcbPlcfendRef, nWordVersion);
|
||||
IndividualEndnotesPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfendTxt, FIB->m_FibWord97.lcbPlcfendTxt, nWordVersion);
|
||||
}
|
||||
|
||||
if (FIB->m_RgLw97.ccpHdr > 0)
|
||||
@ -343,6 +343,11 @@ namespace DocFileFormat
|
||||
AnnotationsReferencePlex = new Plex<AnnotationReferenceDescriptor>(AnnotationReferenceDescriptor::GetSize(nWordVersion), TableStream, FIB->m_FibWord97.fcPlcfandRef, FIB->m_FibWord97.lcbPlcfandRef, nWordVersion);
|
||||
IndividualCommentsPlex = new Plex<EmptyStructure> (EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfandTxt, FIB->m_FibWord97.lcbPlcfandTxt, nWordVersion);
|
||||
}
|
||||
|
||||
if (FIB->m_FibWord2002.lcbAtrdExtra > 0)
|
||||
{
|
||||
AnnotationsReferenceExPlex = new Plex<AnnotationReferenceExDescriptor>(AnnotationReferenceExDescriptor::GetSize(nWordVersion), TableStream, FIB->m_FibWord2002.fcAtrdExtra, FIB->m_FibWord2002.lcbAtrdExtra, nWordVersion);
|
||||
}
|
||||
OfficeDrawingPlex = new Plex<Spa> (Spa::GetSize(nWordVersion), TableStream, FIB->m_FibWord97.fcPlcSpaMom, FIB->m_FibWord97.lcbPlcSpaMom, nWordVersion);
|
||||
OfficeDrawingPlexHeader = new Plex<Spa> (Spa::GetSize(nWordVersion), TableStream, FIB->m_FibWord97.fcPlcSpaHdr, FIB->m_FibWord97.lcbPlcSpaHdr, nWordVersion);
|
||||
|
||||
@ -356,7 +361,7 @@ namespace DocFileFormat
|
||||
TextboxBreakPlex = new Plex<Tbkd> (Tbkd::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfTxbxBkd, FIB->m_FibWord97.lcbPlcfTxbxBkd, nWordVersion);
|
||||
TextboxBreakPlexHeader = new Plex<Tbkd> (Tbkd::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfTxbxHdrBkd, FIB->m_FibWord97.lcbPlcfTxbxHdrBkd, nWordVersion);
|
||||
|
||||
AnnotStartPlex = new Plex<BookmarkFirst> (BookmarkFirst::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfAtnBkf, FIB->m_FibWord97.lcbPlcfAtnBkf, nWordVersion);
|
||||
AnnotStartPlex = new Plex<BookmarkFirst> (BookmarkFirst::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfAtnBkf, FIB->m_FibWord97.lcbPlcfAtnBkf, nWordVersion);
|
||||
AnnotEndPlex = new Plex<EmptyStructure> (EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfAtnBkl, FIB->m_FibWord97.lcbPlcfAtnBkl, nWordVersion);
|
||||
|
||||
|
||||
@ -368,18 +373,19 @@ namespace DocFileFormat
|
||||
BookmarkStartEndCPs.push_back(std::make_pair(BookmarkStartPlex->CharacterPositions[i], BookmarkEndPlex->CharacterPositions[pBookmark->GetIndex()]));
|
||||
}
|
||||
}
|
||||
for (size_t i = 0; i < AnnotStartPlex->Elements.size(); ++i)
|
||||
for (size_t i = 0; AnnotStartPlex && i < AnnotStartPlex->Elements.size(); ++i)
|
||||
{
|
||||
BookmarkFirst* pBookmark = static_cast<BookmarkFirst*>(AnnotStartPlex->Elements[i]);
|
||||
BookmarkFirst* pBookmark = static_cast<BookmarkFirst*>(AnnotStartPlex->Elements[i]);
|
||||
if (pBookmark)
|
||||
{
|
||||
short end = pBookmark->GetIndex();
|
||||
if (i < AnnotStartPlex->CharacterPositions.size() && end < AnnotEndPlex->CharacterPositions.size())
|
||||
short ind = pBookmark->GetIndex();
|
||||
if (i < AnnotStartPlex->CharacterPositions.size() -1 )
|
||||
{
|
||||
AnnotStartEndCPs.push_back(std::make_pair(AnnotStartPlex->CharacterPositions[i], AnnotEndPlex->CharacterPositions[end]));
|
||||
AnnotStartEndCPs.push_back(std::make_pair(AnnotStartPlex->CharacterPositions[i], AnnotEndPlex->CharacterPositions[i + 1]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
FootnoteDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldFtn, FIB->m_FibWord97.lcbPlcfFldFtn, nWordVersion);
|
||||
@ -435,7 +441,7 @@ namespace DocFileFormat
|
||||
std::unordered_map<int, int> fonts_charsets;
|
||||
bool bFontsCodePage = false;
|
||||
|
||||
for ( size_t i = 0; !bFontsCodePage && i < FontTable->Data.size(); ++i)
|
||||
for ( size_t i = 0; FIB->m_FibWord97.lcbClx > 0 && !bFontsCodePage && i < FontTable->Data.size(); ++i)
|
||||
{
|
||||
FontFamilyName* font = dynamic_cast<FontFamilyName*>( FontTable->Data[i]);
|
||||
if (!font) continue;
|
||||
@ -446,7 +452,7 @@ namespace DocFileFormat
|
||||
|
||||
for (size_t j = 0 ; j < 32; j++)
|
||||
{
|
||||
if (aCodePages[j][0] == font->chs && font->chs != 0)
|
||||
if (aCodePages[j][0] == font->chs && font->chs > 2)
|
||||
{
|
||||
nFontsCodePage = aCodePages[j][1];
|
||||
bFontsCodePage = true;
|
||||
@ -488,13 +494,13 @@ namespace DocFileFormat
|
||||
|
||||
if (BookmarkNames)
|
||||
{
|
||||
for (unsigned int i = 0; i < BookmarkStartEndCPs.size(); ++i)
|
||||
for (size_t i = 0; i < BookmarkStartEndCPs.size(); ++i)
|
||||
{
|
||||
WideString* bookmarkName = static_cast<WideString*>(BookmarkNames->operator[]( i ));
|
||||
|
||||
if ( ( bookmarkName != NULL ) && ( *bookmarkName == L"_PictureBullets" ) )
|
||||
{
|
||||
for (unsigned int j = BookmarkStartEndCPs[i].first, k = 0; j < Text->size(); ++j, ++k )
|
||||
for (size_t j = BookmarkStartEndCPs[i].first, k = 0; j < Text->size(); ++j, ++k )
|
||||
{
|
||||
if ( Text->at( j ) == 1 )
|
||||
{
|
||||
@ -540,7 +546,7 @@ namespace DocFileFormat
|
||||
{
|
||||
AllSepx = new std::map<int, SectionPropertyExceptions*>();
|
||||
|
||||
for (unsigned int i = 0; i < SectionPlex->Elements.size(); ++i)
|
||||
for (size_t i = 0; i < SectionPlex->Elements.size(); ++i)
|
||||
{
|
||||
//Read the SED
|
||||
SectionDescriptor* sed = static_cast<SectionDescriptor*>(SectionPlex->Elements.at(i));
|
||||
@ -869,6 +875,7 @@ namespace DocFileFormat
|
||||
RELEASEOBJECT(HeaderStoriesPlex);
|
||||
RELEASEOBJECT(IndividualCommentsPlex);
|
||||
RELEASEOBJECT(AnnotationsReferencePlex);
|
||||
RELEASEOBJECT(AnnotationsReferenceExPlex);
|
||||
RELEASEOBJECT(TextboxBreakPlex);
|
||||
RELEASEOBJECT(TextboxBreakPlexHeader);
|
||||
RELEASEOBJECT(OfficeDrawingPlex);
|
||||
|
||||
@ -224,6 +224,7 @@ namespace DocFileFormat
|
||||
Plex<FieldCharacter> *EndnoteDocumentFieldsPlex;
|
||||
Plex<FieldCharacter> *HeadersAndFootersDocumentFieldsPlex;
|
||||
Plex<AnnotationReferenceDescriptor> *AnnotationsReferencePlex;
|
||||
Plex<AnnotationReferenceExDescriptor> *AnnotationsReferenceExPlex;
|
||||
Plex<EmptyStructure> *AutoTextPlex;
|
||||
// Each character position specifies the beginning of a range of text that constitutes the contents of an AutoText item
|
||||
|
||||
|
||||
@ -373,6 +373,10 @@
|
||||
RelativePath="..\..\XlsxSerializerCom\Writer\CSVWriter.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ASCOfficeDocxFile2\BinReader\CustormXmlWriter.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\DocxSerializer.cpp"
|
||||
>
|
||||
|
||||
@ -335,10 +335,48 @@ public:
|
||||
sShd += L"<w:shd";
|
||||
if(bValue)
|
||||
{
|
||||
if(shd_Nil == Value)
|
||||
sShd += L" w:val=\"nil\"";
|
||||
else
|
||||
sShd += L" w:val=\"clear\"";
|
||||
switch(Value)
|
||||
{
|
||||
case SimpleTypes::shdClear : sShd += L" w:val=\"clear\""; break;
|
||||
case SimpleTypes::shdDiagCross : sShd += L" w:val=\"diagCross\""; break;
|
||||
case SimpleTypes::shdDiagStripe : sShd += L" w:val=\"diagStripe\""; break;
|
||||
case SimpleTypes::shdHorzCross : sShd += L" w:val=\"horzCross\""; break;
|
||||
case SimpleTypes::shdHorzStripe : sShd += L" w:val=\"horzStripe\""; break;
|
||||
case SimpleTypes::shdNil : sShd += L" w:val=\"nil\""; break;
|
||||
case SimpleTypes::shdPct10 : sShd += L" w:val=\"pct10\""; break;
|
||||
case SimpleTypes::shdPct12 : sShd += L" w:val=\"pct12\""; break;
|
||||
case SimpleTypes::shdPct15 : sShd += L" w:val=\"pct15\""; break;
|
||||
case SimpleTypes::shdPct20 : sShd += L" w:val=\"pct20\""; break;
|
||||
case SimpleTypes::shdPct25 : sShd += L" w:val=\"pct25\""; break;
|
||||
case SimpleTypes::shdPct30 : sShd += L" w:val=\"pct30\""; break;
|
||||
case SimpleTypes::shdPct35 : sShd += L" w:val=\"pct35\""; break;
|
||||
case SimpleTypes::shdPct37 : sShd += L" w:val=\"pct37\""; break;
|
||||
case SimpleTypes::shdPct40 : sShd += L" w:val=\"pct40\""; break;
|
||||
case SimpleTypes::shdPct45 : sShd += L" w:val=\"pct45\""; break;
|
||||
case SimpleTypes::shdPct5 : sShd += L" w:val=\"pct5\""; break;
|
||||
case SimpleTypes::shdPct50 : sShd += L" w:val=\"pct50\""; break;
|
||||
case SimpleTypes::shdPct55 : sShd += L" w:val=\"pct55\""; break;
|
||||
case SimpleTypes::shdPct60 : sShd += L" w:val=\"pct60\""; break;
|
||||
case SimpleTypes::shdPct62 : sShd += L" w:val=\"pct62\""; break;
|
||||
case SimpleTypes::shdPct65 : sShd += L" w:val=\"pct65\""; break;
|
||||
case SimpleTypes::shdPct70 : sShd += L" w:val=\"pct70\""; break;
|
||||
case SimpleTypes::shdPct75 : sShd += L" w:val=\"pct75\""; break;
|
||||
case SimpleTypes::shdPct80 : sShd += L" w:val=\"pct80\""; break;
|
||||
case SimpleTypes::shdPct85 : sShd += L" w:val=\"pct85\""; break;
|
||||
case SimpleTypes::shdPct87 : sShd += L" w:val=\"pct87\""; break;
|
||||
case SimpleTypes::shdPct90 : sShd += L" w:val=\"pct90\""; break;
|
||||
case SimpleTypes::shdPct95 : sShd += L" w:val=\"pct95\""; break;
|
||||
case SimpleTypes::shdReverseDiagStripe : sShd += L" w:val=\"reverseDiagStripe\""; break;
|
||||
case SimpleTypes::shdSolid : sShd += L" w:val=\"solid\""; break;
|
||||
case SimpleTypes::shdThinDiagCross : sShd += L" w:val=\"thinDiagCross\""; break;
|
||||
case SimpleTypes::shdThinDiagStripe : sShd += L" w:val=\"thinDiagStripe\""; break;
|
||||
case SimpleTypes::shdThinHorzCross : sShd += L" w:val=\"thinHorzCross\""; break;
|
||||
case SimpleTypes::shdThinHorzStripe : sShd += L" w:val=\"thinHorzStripe\""; break;
|
||||
case SimpleTypes::shdThinReverseDiagStripe : sShd += L" w:val=\"thinReverseDiagStripe\""; break;
|
||||
case SimpleTypes::shdThinVertStripe : sShd += L" w:val=\"thinVertStripe\""; break;
|
||||
case SimpleTypes::shdVertStripe : sShd += L" w:val=\"vertStripe\""; break;
|
||||
default : sShd += L" w:val=\"solid\""; break;
|
||||
}
|
||||
}
|
||||
sShd += L" w:color=\"auto\"";
|
||||
if(bColor)
|
||||
|
||||
@ -764,7 +764,8 @@ extern int g_nCurFormatVersion;
|
||||
FootnotePr = 4,
|
||||
EndnotePr = 5,
|
||||
SdtGlobalColor = 6,
|
||||
SdtGlobalShowHighlight = 7
|
||||
SdtGlobalShowHighlight = 7,
|
||||
Compat = 8
|
||||
};}
|
||||
namespace c_oSer_MathPrType{enum c_oSer_SettingsType
|
||||
{
|
||||
@ -1150,6 +1151,13 @@ extern int g_nCurFormatVersion;
|
||||
ColFirst = 3,
|
||||
ColLast = 4
|
||||
};}
|
||||
namespace c_oSerCompat{enum c_oSerCompat
|
||||
{
|
||||
CompatSetting = 0,
|
||||
CompatName = 1,
|
||||
CompatUri = 2,
|
||||
CompatValue = 3
|
||||
};}
|
||||
}
|
||||
|
||||
#endif // #ifndef DOCX_BIN_READER_WRITER_DEFINES
|
||||
|
||||
@ -315,19 +315,19 @@ namespace BinDocxRW
|
||||
void WriteShd(const ComplexTypes::Word::CShading& Shd)
|
||||
{
|
||||
//Type
|
||||
if(false != Shd.m_oVal.IsInit())
|
||||
if (false != Shd.m_oVal.IsInit())
|
||||
{
|
||||
m_oStream.WriteBYTE(c_oSerShdType::Value);
|
||||
m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
switch(Shd.m_oVal.get().GetValue())
|
||||
{
|
||||
case SimpleTypes::shdNil: m_oStream.WriteBYTE(shd_Nil);break;
|
||||
default: m_oStream.WriteBYTE(shd_Clear);break;
|
||||
}
|
||||
m_oStream.WriteBYTE(Shd.m_oVal.get().GetValue()); //Misalignment-footer.doc
|
||||
|
||||
}
|
||||
//Value
|
||||
if(false != Shd.m_oFill.IsInit())
|
||||
if (false != Shd.m_oFill.IsInit())
|
||||
WriteColor(c_oSerShdType::Color, Shd.m_oFill.get());
|
||||
else if (false != Shd.m_oColor.IsInit())
|
||||
WriteColor(c_oSerShdType::Color, Shd.m_oColor.get());
|
||||
|
||||
WriteThemeColor(c_oSerShdType::ColorTheme, Shd.m_oFill, Shd.m_oThemeFill, Shd.m_oThemeFillTint, Shd.m_oThemeFillShade);
|
||||
}
|
||||
void WriteDistance(const NSCommon::nullable<SimpleTypes::CWrapDistance<>>& m_oDistL,
|
||||
@ -7563,6 +7563,12 @@ namespace BinDocxRW
|
||||
NULL, &oSettings.m_oEndnotePr->m_oPos, &oSettings.m_oEndnotePr->m_arrEndnote);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oSettings.m_oCompat.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_SettingsType::Compat);
|
||||
WriteCompat(oSettings.m_oCompat.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oSettingsCustom.m_oSdtGlobalColor.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_SettingsType::SdtGlobalColor);
|
||||
@ -7892,6 +7898,38 @@ namespace BinDocxRW
|
||||
m_oBcw.m_oStream.WriteBYTE(re_index[pFind->second.GetBYTECode()]);
|
||||
}
|
||||
};
|
||||
void WriteCompat(const OOX::Settings::CCompat& oCompat)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
for(size_t i = 0; i < oCompat.m_arrCompatSettings.size(); ++i)
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerCompat::CompatSetting);
|
||||
WriteCompatSetting(*oCompat.m_arrCompatSettings[i]);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteCompatSetting(const OOX::Settings::CCompatSetting& oCompatSetting)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oCompatSetting.m_sName.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart (c_oSerCompat::CompatName);
|
||||
m_oBcw.m_oStream.WriteStringW3(oCompatSetting.m_sName.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oCompatSetting.m_sUri.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart (c_oSerCompat::CompatUri);
|
||||
m_oBcw.m_oStream.WriteStringW3(oCompatSetting.m_sUri.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oCompatSetting.m_sVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart (c_oSerCompat::CompatValue);
|
||||
m_oBcw.m_oStream.WriteStringW3(oCompatSetting.m_sVal.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
};
|
||||
class BinaryNotesTableWriter
|
||||
{
|
||||
|
||||
@ -53,6 +53,12 @@
|
||||
69F181AF1C77274E00B2952B /* FileDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = 69F181AD1C77274E00B2952B /* FileDownloader.h */; };
|
||||
8A404FD3208A01AF00F2D5CF /* FileDownloader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A404FD2208A01AF00F2D5CF /* FileDownloader.cpp */; };
|
||||
8A404FD5208A01CE00F2D5CF /* FileDownloader_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A404FD4208A01CE00F2D5CF /* FileDownloader_private.h */; };
|
||||
8AB24BFD213004E400E80DDD /* CustormXmlWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AB24BFB213004E300E80DDD /* CustormXmlWriter.cpp */; };
|
||||
8AB24BFE213004E400E80DDD /* CustormXmlWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 8AB24BFC213004E300E80DDD /* CustormXmlWriter.h */; };
|
||||
8AC6D2052130146000D9C0F1 /* xmlutils.h in Headers */ = {isa = PBXBuildFile; fileRef = 8AC6D2042130146000D9C0F1 /* xmlutils.h */; };
|
||||
8AC6D2092130146800D9C0F1 /* xmllight_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 8AC6D2062130146800D9C0F1 /* xmllight_private.h */; };
|
||||
8AC6D20A2130146800D9C0F1 /* xmldom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AC6D2072130146800D9C0F1 /* xmldom.cpp */; };
|
||||
8AC6D20B2130146800D9C0F1 /* xmllight.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AC6D2082130146800D9C0F1 /* xmllight.cpp */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
@ -103,6 +109,12 @@
|
||||
69F181AD1C77274E00B2952B /* FileDownloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileDownloader.h; path = ../../../Common/FileDownloader/FileDownloader.h; sourceTree = "<group>"; };
|
||||
8A404FD2208A01AF00F2D5CF /* FileDownloader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FileDownloader.cpp; path = ../../../Common/FileDownloader/FileDownloader.cpp; sourceTree = "<group>"; };
|
||||
8A404FD4208A01CE00F2D5CF /* FileDownloader_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileDownloader_private.h; path = ../../../Common/FileDownloader/FileDownloader_private.h; sourceTree = "<group>"; };
|
||||
8AB24BFB213004E300E80DDD /* CustormXmlWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CustormXmlWriter.cpp; sourceTree = "<group>"; };
|
||||
8AB24BFC213004E300E80DDD /* CustormXmlWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustormXmlWriter.h; sourceTree = "<group>"; };
|
||||
8AC6D2042130146000D9C0F1 /* xmlutils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = xmlutils.h; path = ../../../DesktopEditor/xml/include/xmlutils.h; sourceTree = "<group>"; };
|
||||
8AC6D2062130146800D9C0F1 /* xmllight_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = xmllight_private.h; path = ../../../DesktopEditor/xml/src/xmllight_private.h; sourceTree = "<group>"; };
|
||||
8AC6D2072130146800D9C0F1 /* xmldom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = xmldom.cpp; path = ../../../DesktopEditor/xml/src/xmldom.cpp; sourceTree = "<group>"; };
|
||||
8AC6D2082130146800D9C0F1 /* xmllight.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = xmllight.cpp; path = ../../../DesktopEditor/xml/src/xmllight.cpp; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -135,6 +147,7 @@
|
||||
17E17EDE1AC453F800BEA2EA /* ASCOfficeDocxFile2Lib */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8AC6D2032130145600D9C0F1 /* XmlUtils */,
|
||||
17E17F4D1AC454E200BEA2EA /* Common */,
|
||||
17E17F1A1AC4549B00BEA2EA /* XlsxSerializerCom */,
|
||||
17E17F0D1AC4546100BEA2EA /* DocWrapper */,
|
||||
@ -149,6 +162,8 @@
|
||||
children = (
|
||||
17E17EEB1AC4544900BEA2EA /* ChartWriter.h */,
|
||||
17E17EEC1AC4544900BEA2EA /* CommentsWriter.h */,
|
||||
8AB24BFB213004E300E80DDD /* CustormXmlWriter.cpp */,
|
||||
8AB24BFC213004E300E80DDD /* CustormXmlWriter.h */,
|
||||
17A765271B0F3DC30046BC0B /* DefaultThemeWriter.h */,
|
||||
17E17EF01AC4544900BEA2EA /* DocumentRelsWriter.h */,
|
||||
17E17EF11AC4544900BEA2EA /* DocumentWriter.h */,
|
||||
@ -252,6 +267,17 @@
|
||||
name = BinWriter;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8AC6D2032130145600D9C0F1 /* XmlUtils */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8AC6D2072130146800D9C0F1 /* xmldom.cpp */,
|
||||
8AC6D2062130146800D9C0F1 /* xmllight_private.h */,
|
||||
8AC6D2082130146800D9C0F1 /* xmllight.cpp */,
|
||||
8AC6D2042130146000D9C0F1 /* xmlutils.h */,
|
||||
);
|
||||
name = XmlUtils;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
@ -276,7 +302,9 @@
|
||||
17C1FEAD1ACC42C4006B99B3 /* ChartWriter.h in Headers */,
|
||||
17C1FEAE1ACC42C4006B99B3 /* DocumentRelsWriter.h in Headers */,
|
||||
17C1FEAF1ACC42C4006B99B3 /* CommentsWriter.h in Headers */,
|
||||
8AC6D2052130146000D9C0F1 /* xmlutils.h in Headers */,
|
||||
69F181AF1C77274E00B2952B /* FileDownloader.h in Headers */,
|
||||
8AC6D2092130146800D9C0F1 /* xmllight_private.h in Headers */,
|
||||
17C1FEB01ACC42C4006B99B3 /* BinaryCommonReader.h in Headers */,
|
||||
17C1FEB11ACC42C4006B99B3 /* Common.h in Headers */,
|
||||
8A404FD5208A01CE00F2D5CF /* FileDownloader_private.h in Headers */,
|
||||
@ -292,6 +320,7 @@
|
||||
17C1FEBC1ACC42C4006B99B3 /* DocxSerializer.h in Headers */,
|
||||
17C1FEBD1ACC42C4006B99B3 /* FileWriter.h in Headers */,
|
||||
17C1FEBE1ACC42C4006B99B3 /* CSVWriter.h in Headers */,
|
||||
8AB24BFE213004E400E80DDD /* CustormXmlWriter.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -346,17 +375,20 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8AB24BFD213004E400E80DDD /* CustormXmlWriter.cpp in Sources */,
|
||||
17C1FE961ACC42C4006B99B3 /* Common.cpp in Sources */,
|
||||
17C1FE971ACC42C4006B99B3 /* ChartFromToBinary.cpp in Sources */,
|
||||
17C1FE981ACC42C4006B99B3 /* CSVReader.cpp in Sources */,
|
||||
17C1FE991ACC42C4006B99B3 /* DocxSerializer.cpp in Sources */,
|
||||
17C1FE9A1ACC42C4006B99B3 /* CommonWriter.cpp in Sources */,
|
||||
8AC6D20B2130146800D9C0F1 /* xmllight.cpp in Sources */,
|
||||
17C1FE9B1ACC42C4006B99B3 /* CSVWriter.cpp in Sources */,
|
||||
69414A301CB51666003E771B /* ChartWriter.cpp in Sources */,
|
||||
6967917E1D9E8AEE002CA4BA /* BinWriters.cpp in Sources */,
|
||||
69BBDF251F0B8AAC00EB1BF7 /* FileDownloader_mac.mm in Sources */,
|
||||
17C1FE9C1ACC42C4006B99B3 /* XlsxSerializer.cpp in Sources */,
|
||||
690FE0851E9BBD68004B26D0 /* Readers.cpp in Sources */,
|
||||
8AC6D20A2130146800D9C0F1 /* xmldom.cpp in Sources */,
|
||||
17C1FE9D1ACC42C4006B99B3 /* FontProcessor.cpp in Sources */,
|
||||
8A404FD3208A01AF00F2D5CF /* FileDownloader.cpp in Sources */,
|
||||
);
|
||||
|
||||
@ -70,7 +70,7 @@ static const _sh_typ Shape_Types_Mapping[] = // index === OOX::Drawing::EShapeTy
|
||||
{ L"mso-spt50" , 7}, // shapetypeBorderCallout2,
|
||||
{ L"mso-spt51" , 7}, // shapetypeBorderCallout3,
|
||||
{ L"brace-pair" , 7}, // shapetypeBracePair,
|
||||
{ L"bracket-pair" , 7}, // shapetypeBracketPair,
|
||||
{ L"" , 7}, // shapetypeBracketPair,
|
||||
{ L"mso-spt41" , 7}, // shapetypeCallout1,
|
||||
{ L"mso-spt42" , 7}, // shapetypeCallout2,
|
||||
{ L"mso-spt43" , 7}, // shapetypeCallout3,
|
||||
@ -156,7 +156,7 @@ static const _sh_typ Shape_Types_Mapping[] = // index === OOX::Drawing::EShapeTy
|
||||
{ L"left-right-arrow-callout" , 7}, // shapetypeLeftRightArrowCallout,
|
||||
{ L"" , 7}, // shapetypeLeftRightCircularArrow,
|
||||
{ L"" , 7}, // shapetypeLeftRightRibbon,
|
||||
{ L"mso-spt182" , 7}, // shapetypeLeftRightUpArrow,
|
||||
{ L"" , 7}, // shapetypeLeftRightUpArrow,
|
||||
{ L"" , 7}, // shapetypeLeftUpArrow,
|
||||
{ L"lightning" , 7}, // shapetypeLightningBolt,
|
||||
{ L"" , 5}, // shapetypeLine,
|
||||
|
||||
@ -893,6 +893,61 @@ public:
|
||||
handles.push_back(h2);
|
||||
}
|
||||
};
|
||||
class oox_shape_leftRightUpArrow : public oox_shape
|
||||
{
|
||||
public:
|
||||
oox_shape_leftRightUpArrow()
|
||||
{
|
||||
odf_type_name = L"ooxml-leftRightUpArrow";
|
||||
|
||||
enhanced_path = L"M 0 ?f18 L ?f7 ?f17 ?f7 ?f19 ?f13 ?f19 ?f13 ?f7 ?f10 ?f7 ?f9 0 ?f11 ?f7 ?f14 ?f7 ?f14 ?f19 ?f15 ?f19 ?f15 ?f17 ?f23 ?f18 ?f15 ?f24 ?f15 ?f20 ?f7 ?f20 ?f7 ?f24 Z N";
|
||||
text_areas = L"?f21 ?f19 ?f22 ?f20";
|
||||
modifiers = L"9928 10359 14667";
|
||||
view_box = L"0 0 0 0";
|
||||
|
||||
add(L"f0", L"if(0-$1 ,0,if(50000-$1 ,$1 ,50000))");
|
||||
add(L"f1", L"?f0 *2/1");
|
||||
add(L"f2", L"if(0-$0 ,0,if(?f1 -$0 ,$0 ,?f1 ))");
|
||||
add(L"f3", L"100000+0-?f1 ");
|
||||
add(L"f4", L"?f3 *1/2");
|
||||
add(L"f5", L"if(0-$2 ,0,if(?f4 -$2 ,$2 ,?f4 ))");
|
||||
add(L"f6", L"min(logwidth,logheight)");
|
||||
add(L"f7", L"?f6 *?f5 /100000");
|
||||
add(L"f8", L"?f6 *?f0 /100000");
|
||||
add(L"f9", L"logwidth/2");
|
||||
add(L"f10", L"?f9 +0-?f8 ");
|
||||
add(L"f11", L"?f9 +?f8 -0");
|
||||
add(L"f12", L"?f6 *?f2 /200000");
|
||||
add(L"f13", L"?f9 +0-?f12 ");
|
||||
add(L"f14", L"?f9 +?f12 -0");
|
||||
add(L"f15", L"logwidth+0-?f7 ");
|
||||
add(L"f16", L"?f6 *?f0 /50000");
|
||||
add(L"f17", L"logheight+0-?f16 ");
|
||||
add(L"f18", L"logheight+0-?f8 ");
|
||||
add(L"f19", L"?f18 +0-?f12 ");
|
||||
add(L"f20", L"?f18 +?f12 -0");
|
||||
add(L"f21", L"?f12 *?f7 /?f8 ");
|
||||
add(L"f22", L"logwidth+0-?f21 ");
|
||||
add(L"f23", L"logwidth");
|
||||
add(L"f24", L"logheight");
|
||||
/////////////////////////////////////////////////////////
|
||||
_handle h1, h2, h3;
|
||||
h1.position = L"?f13 ?f7";
|
||||
h1.x_minimum = L"0";
|
||||
h1.x_maximum = L"?f1";
|
||||
handles.push_back(h1);
|
||||
|
||||
h2.position = L"?f10 0";
|
||||
h2.x_minimum = L"0";
|
||||
h2.x_maximum = L"50000";
|
||||
handles.push_back(h2);
|
||||
|
||||
h3.position = L"?f23 ?f7";
|
||||
h3.y_minimum = L"0";
|
||||
h3.y_maximum = L"?f4";
|
||||
handles.push_back(h3);
|
||||
}
|
||||
};
|
||||
class oox_shape_NotchedRightArrow : public oox_shape
|
||||
{
|
||||
public:
|
||||
|
||||
@ -273,6 +273,65 @@ public:
|
||||
/////////////////////////////////////////////////////////
|
||||
}
|
||||
};
|
||||
class oox_shape_Wave : public oox_shape
|
||||
{
|
||||
public:
|
||||
oox_shape_Wave()
|
||||
{
|
||||
odf_type_name =L"ooxml-wave";
|
||||
|
||||
modifiers = L"12500 0";
|
||||
enhanced_path = L"M ?f13 ?f2 C ?f17 ?f4 ?f18 ?f5 ?f15 ?f2 L ?f20 ?f6 C ?f22 ?f8 ?f21 ?f7 ?f19 ?f6 Z N";
|
||||
text_areas = L"?f27 ?f29 ?f28 ?f30";
|
||||
glue_points = L"?f35 ?f10 ?f19 ?f6 ?f28 ?f14 ?f38 ?f6";
|
||||
view_box = L"0 0 0 0";
|
||||
|
||||
add(L"f0", L"if(0-$0 ,0,if(20000-$0 ,$0 ,20000))");
|
||||
add(L"f1", L"if(-10000-$1 ,-10000,if(10000-$1 ,$1 ,10000))");
|
||||
add(L"f2", L"logheight*?f0 /100000");
|
||||
add(L"f3", L"?f2 *10/3");
|
||||
add(L"f4", L"?f2 +0-?f3 ");
|
||||
add(L"f5", L"?f2 +?f3 -0");
|
||||
add(L"f6", L"logheight+0-?f2 ");
|
||||
add(L"f7", L"?f6 +0-?f3 ");
|
||||
add(L"f8", L"?f6 +?f3 -0");
|
||||
add(L"f9", L"logwidth*?f1 /100000");
|
||||
add(L"f10", L"logwidth*?f1 /50000");
|
||||
add(L"f11", L"abs(?f9 )");
|
||||
add(L"f12", L"if(?f10 ,0,?f10 )");
|
||||
add(L"f13", L"0+0-?f12 ");
|
||||
add(L"f14", L"if(?f10 ,?f10 ,0)");
|
||||
add(L"f15", L"logwidth+0-?f14 ");
|
||||
add(L"f16", L"(?f12 +?f15 )/3");
|
||||
add(L"f17", L"?f13 +?f16 -0");
|
||||
add(L"f18", L"(?f17 +?f15 )/2");
|
||||
add(L"f19", L"0+?f14 -0");
|
||||
add(L"f20", L"logwidth+?f12 -0");
|
||||
add(L"f21", L"?f19 +?f16 -0");
|
||||
add(L"f22", L"(?f21 +?f20 )/2");
|
||||
add(L"f23", L"logwidth+0-?f11");
|
||||
add(L"f24", L"logwidth/2");
|
||||
add(L"f25", L"?f24 +?f9 -0");
|
||||
add(L"f26", L"?f24 +0-?f9 ");
|
||||
add(L"f27", L"max(?f13 ,?f19 )");
|
||||
add(L"f28", L"min(?f15 ,?f20 )");
|
||||
add(L"f29", L"logheight*?f0 /50000");
|
||||
add(L"f30", L"logheight+0-?f29 ");
|
||||
add(L"f31", L"logheight");
|
||||
add(L"f32", L"logheight/2");
|
||||
/////////////////////////////////////////////////////////
|
||||
_handle h1, h2;
|
||||
h1.position = L"0 ?f2";
|
||||
h1.y_maximum= L"20000";
|
||||
h1.y_minimum= L"0";
|
||||
handles.push_back(h1);
|
||||
|
||||
h2.position = L"?f25 ?f31";
|
||||
h2.x_maximum= L"10000";
|
||||
h2.x_minimum= L"-10000";
|
||||
handles.push_back(h2);
|
||||
}
|
||||
};
|
||||
class oox_shape_DoubleWave : public oox_shape
|
||||
{
|
||||
public:
|
||||
@ -995,8 +1054,6 @@ public:
|
||||
handles.push_back(h2);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class oox_shape_Chord : public oox_shape
|
||||
{
|
||||
public:
|
||||
@ -1482,4 +1539,55 @@ public:
|
||||
h.x_maximum = L"50000";
|
||||
handles.push_back(h);
|
||||
}
|
||||
};}
|
||||
};
|
||||
class oox_shape_bracketPair : public oox_shape
|
||||
{
|
||||
public:
|
||||
oox_shape_bracketPair()
|
||||
{
|
||||
odf_type_name =L"ooxml-bracketPair";
|
||||
|
||||
//enhanced_path = L"M 0 ?f2 L ?f3 0 L ?f11 ?f4 L ?f2 ?f10 Z S N M ?f2 ?f10 L 0 ?f2 M ?f3 0 L ?f11 ?f4 F N";
|
||||
enhanced_path = L"M 0 ?f2 G ?f2 ?f2 ?f12 ?f13 L ?f3 0 G ?f2 ?f2 ?f14 ?f15 L ?f11 ?f4 G ?f2 ?f2 ?f16 ?f17 L ?f2 ?f10 G ?f2 ?f2 ?f18 ?f19 Z S N M ?f2 ?f10 G ?f2 ?f2 ?f20 ?f21 L 0 ?f2 G ?f2 ?f2 ?f22 ?f23 M ?f3 0 G ?f2 ?f2 ?f24 ?f25 L ?f11 ?f4 G ?f2 ?f2 ?f26 ?f27 F N";
|
||||
text_areas = L"?f5 ?f5 ?f6 ?f7";
|
||||
view_box = L"0 0 0 0";
|
||||
modifiers = L"23051";
|
||||
|
||||
add(L"f0", L"if(0-$0 ,0,if(50000-$0 ,$0 ,50000))");
|
||||
add(L"f1", L"min(logwidth,logheight)");
|
||||
add(L"f2", L"?f1 *?f0 /100000");
|
||||
add(L"f3", L"logwidth+0-?f2 ");
|
||||
add(L"f4", L"logheight+0-?f2 ");
|
||||
add(L"f5", L"?f2 *29289/100000");
|
||||
add(L"f6", L"logwidth+0-?f5 ");
|
||||
add(L"f7", L"logheight+0-?f5 ");
|
||||
add(L"f8", L"logwidth/2");
|
||||
add(L"f9", L"logheight/2");
|
||||
add(L"f10", L"logheight");
|
||||
add(L"f11", L"logwidth");
|
||||
add(L"f12", L"(10800000)/60000.0");
|
||||
add(L"f13", L"(5400000)/60000.0");
|
||||
add(L"f14", L"(16200000)/60000.0");
|
||||
add(L"f15", L"(5400000)/60000.0");
|
||||
add(L"f16", L"(0)/60000.0");
|
||||
add(L"f17", L"(5400000)/60000.0");
|
||||
add(L"f18", L"(5400000)/60000.0");
|
||||
add(L"f19", L"(5400000)/60000.0");
|
||||
add(L"f20", L"(5400000)/60000.0");
|
||||
add(L"f21", L"(5400000)/60000.0");
|
||||
add(L"f22", L"(10800000)/60000.0");
|
||||
add(L"f23", L"(5400000)/60000.0");
|
||||
add(L"f24", L"(16200000)/60000.0");
|
||||
add(L"f25", L"(5400000)/60000.0");
|
||||
add(L"f26", L"(0)/60000.0");
|
||||
add(L"f27", L"(5400000)/60000.0");
|
||||
/////////////////////////////////////////////////////////
|
||||
_handle h1;
|
||||
|
||||
h1.position = L"0 ?f2";
|
||||
h1.y_minimum = L"0";
|
||||
h1.y_maximum = L"50000";
|
||||
handles.push_back(h1);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -1100,6 +1100,7 @@ bool odf_drawing_context::isLineShape()
|
||||
case 48: //SimpleTypes::shapetypeCurvedConnector3:
|
||||
case 49: //SimpleTypes::shapetypeCurvedConnector4:
|
||||
case 50: //SimpleTypes::shapetypeCurvedConnector5:
|
||||
case 31: //SimpleTypes::shapetypeBracketPair
|
||||
return true;
|
||||
case 1000:
|
||||
if (impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_.get_value_or(draw_fill(draw_fill::solid)).get_type() == draw_fill::none)
|
||||
|
||||
@ -621,10 +621,15 @@ std::map<std::wstring, std::wstring> odt_conversion_context::parse_instr_options
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void odt_conversion_context::set_field_instr(std::wstring instr)
|
||||
void odt_conversion_context::add_field_instr(const std::wstring &instr)
|
||||
{
|
||||
current_fields.back().instrText += instr;
|
||||
}
|
||||
void odt_conversion_context::set_field_instr()
|
||||
{
|
||||
if (current_fields.empty()) return;
|
||||
|
||||
std::wstring instr = current_fields.back().instrText;
|
||||
|
||||
current_fields.back().status = 1; //prepare
|
||||
|
||||
@ -641,7 +646,6 @@ void odt_conversion_context::set_field_instr(std::wstring instr)
|
||||
{
|
||||
ref = res[1].str();
|
||||
current_fields.back().value = ref.substr(1, ref.length() - 2);
|
||||
|
||||
}
|
||||
}
|
||||
res1 = instr.find(L"NUMPAGES");
|
||||
@ -795,6 +799,7 @@ void odt_conversion_context::separate_field()
|
||||
{
|
||||
if (current_fields.empty()) return;
|
||||
|
||||
set_field_instr();
|
||||
current_fields.back().result = true;
|
||||
}
|
||||
void odt_conversion_context::set_master_page_name(std::wstring master_name)
|
||||
@ -934,6 +939,11 @@ void odt_conversion_context::end_field()
|
||||
{
|
||||
if (current_fields.empty()) return;
|
||||
|
||||
if (current_fields.back().status == 0 && current_fields.back().instrText.empty() == false)
|
||||
{
|
||||
set_field_instr();
|
||||
}
|
||||
|
||||
if (current_fields.back().status == 2)
|
||||
{
|
||||
current_fields.back().status = 3;//prepare for delete
|
||||
|
||||
@ -114,7 +114,8 @@ public:
|
||||
void start_field (bool in_span);
|
||||
void end_field ();
|
||||
void separate_field ();
|
||||
void set_field_instr (std::wstring instr);
|
||||
void add_field_instr (const std::wstring &instr);
|
||||
void set_field_instr ();
|
||||
std::map<std::wstring, std::wstring> parse_instr_options(const std::wstring& value);
|
||||
|
||||
void start_run (bool styled = false);
|
||||
@ -213,6 +214,8 @@ private:
|
||||
std::wstring value;
|
||||
|
||||
std::wstring format;
|
||||
std::wstring instrText;
|
||||
|
||||
short status = 0;//0, 1, 2, 3 - init, prapare, start, finish
|
||||
bool in_span = false;
|
||||
bool result = false; //after separate
|
||||
|
||||
@ -123,15 +123,18 @@ oox_shape_ptr oox_shape::create(int ooxPrstGeomType)
|
||||
case SimpleTypes::shapetypePie: return boost::make_shared<oox_shape_Pie>();
|
||||
case SimpleTypes::shapetypeDonut: return boost::make_shared<oox_shape_Donut>();
|
||||
case SimpleTypes::shapetypeLeftRightRibbon: return boost::make_shared<oox_shape_LeftRightRibbon>();
|
||||
case SimpleTypes::shapetypeWave: return boost::make_shared<oox_shape_Wave>();
|
||||
case SimpleTypes::shapetypeBracketPair: return boost::make_shared<oox_shape_bracketPair>();
|
||||
|
||||
case SimpleTypes::shapetypeFlowChartExtract: return boost::make_shared<oox_shape_FlowChartExtract>();
|
||||
|
||||
case SimpleTypes::shapetypeLeftArrowCallout: return boost::make_shared<oox_shape_LeftArrowCallout>();
|
||||
case SimpleTypes::shapetypeRightArrowCallout: return boost::make_shared<oox_shape_RightArrowCallout>();
|
||||
case SimpleTypes::shapetypeUpArrowCallout: return boost::make_shared<oox_shape_UpArrowCallout>();
|
||||
case SimpleTypes::shapetypeDownArrowCallout: return boost::make_shared<oox_shape_DownArrowCallout>();
|
||||
case SimpleTypes::shapetypeDownArrowCallout: return boost::make_shared<oox_shape_DownArrowCallout>();
|
||||
|
||||
case SimpleTypes::shapetypeBentUpArrow: return boost::make_shared<oox_shape_BentUpArrow>();
|
||||
case SimpleTypes::shapetypeLeftRightUpArrow: return boost::make_shared<oox_shape_leftRightUpArrow>();
|
||||
|
||||
//case (2001 + SimpleTypes::textshapetypeTextArchDown):
|
||||
//case (2001 + SimpleTypes::textshapetypeTextArchDownPour):
|
||||
|
||||
@ -1301,7 +1301,7 @@ void OoxConverter::convert(PPTX::Logic::BodyPr *oox_bodyPr)
|
||||
}
|
||||
}
|
||||
|
||||
if (oox_bodyPr->fromWordArt.IsInit() && oox_bodyPr->prstTxWarp.IsInit())
|
||||
if ((oox_bodyPr->fromWordArt.IsInit() && (*oox_bodyPr->fromWordArt)) && oox_bodyPr->prstTxWarp.IsInit())
|
||||
{
|
||||
for (size_t i = 0; i < oox_bodyPr->prstTxWarp->avLst.size(); i++)
|
||||
{
|
||||
|
||||
@ -890,7 +890,9 @@ void DocxConverter::convert(OOX::Logic::CFldSimple *oox_fld)
|
||||
odt_context->start_field(true);
|
||||
{
|
||||
if (oox_fld->m_sInstr.IsInit())
|
||||
odt_context->set_field_instr(oox_fld->m_sInstr.get2());
|
||||
odt_context->add_field_instr(oox_fld->m_sInstr.get2());
|
||||
|
||||
odt_context->separate_field();
|
||||
|
||||
for (size_t i = 0; i < oox_fld->m_arrItems.size(); ++i)
|
||||
{
|
||||
@ -903,7 +905,7 @@ void DocxConverter::convert(OOX::Logic::CInstrText *oox_instrText)
|
||||
{
|
||||
if (oox_instrText == NULL) return;
|
||||
|
||||
odt_context->set_field_instr(oox_instrText->m_sText);
|
||||
odt_context->add_field_instr(oox_instrText->m_sText);
|
||||
|
||||
}
|
||||
void DocxConverter::convert(OOX::Logic::CDelText *oox_delText)
|
||||
@ -1294,10 +1296,11 @@ void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cp
|
||||
if (oox_paragraph_pr->m_oShd.IsInit())
|
||||
{
|
||||
_CP_OPT(odf_types::color) odf_color;
|
||||
convert(oox_paragraph_pr->m_oShd->m_oFill.GetPointer(), oox_paragraph_pr->m_oShd->m_oThemeFill.GetPointer(),
|
||||
oox_paragraph_pr->m_oShd->m_oThemeFillTint.GetPointer(), oox_paragraph_pr->m_oShd->m_oThemeShade.GetPointer(), odf_color);
|
||||
convert(oox_paragraph_pr->m_oShd.GetPointer(), odf_color);
|
||||
if (odf_color)
|
||||
{
|
||||
paragraph_properties->content_.fo_background_color_ = *odf_color;
|
||||
}
|
||||
}
|
||||
if (oox_paragraph_pr->m_oTextDirection.IsInit() && oox_paragraph_pr->m_oTextDirection->m_oVal.IsInit())
|
||||
{
|
||||
@ -1396,6 +1399,65 @@ void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cp
|
||||
}
|
||||
}
|
||||
|
||||
void DocxConverter::convert( ComplexTypes::Word::CShading* shading, _CP_OPT(odf_types::color)& odf_color)
|
||||
{
|
||||
if (!shading) return;
|
||||
|
||||
convert(shading->m_oFill.GetPointer(), shading->m_oThemeFill.GetPointer(),
|
||||
shading->m_oThemeFillTint.GetPointer(), shading->m_oThemeShade.GetPointer(), odf_color);
|
||||
|
||||
if (odf_color) return;
|
||||
|
||||
if (shading->m_oColor.IsInit())
|
||||
{
|
||||
BYTE ucR = 0xff, ucB = 0xff, ucG = 0xff; //auto fill
|
||||
if (shading->m_oColor->GetValue() == SimpleTypes::hexcolorRGB)
|
||||
{
|
||||
ucR = shading->m_oColor->Get_R();
|
||||
ucB = shading->m_oColor->Get_B();
|
||||
ucG = shading->m_oColor->Get_G();
|
||||
}
|
||||
if (shading->m_oVal.IsInit())
|
||||
{
|
||||
double kf = 0;
|
||||
switch(shading->m_oVal->GetValue())
|
||||
{
|
||||
case SimpleTypes::shdPct10: kf = 0.10; break;
|
||||
case SimpleTypes::shdPct12: kf = 0.12; break;
|
||||
case SimpleTypes::shdPct15: kf = 0.15; break;
|
||||
case SimpleTypes::shdPct20: kf = 0.20; break;
|
||||
case SimpleTypes::shdPct25: kf = 0.25; break;
|
||||
case SimpleTypes::shdPct30: kf = 0.30; break;
|
||||
case SimpleTypes::shdPct35: kf = 0.35; break;
|
||||
case SimpleTypes::shdPct37: kf = 0.37; break;
|
||||
case SimpleTypes::shdPct40: kf = 0.40; break;
|
||||
case SimpleTypes::shdPct45: kf = 0.45; break;
|
||||
case SimpleTypes::shdPct5 : kf = 0.05; break;
|
||||
case SimpleTypes::shdPct50: kf = 0.50; break;
|
||||
case SimpleTypes::shdPct55: kf = 0.55; break;
|
||||
case SimpleTypes::shdPct60: kf = 0.60; break;
|
||||
case SimpleTypes::shdPct62: kf = 0.62; break;
|
||||
case SimpleTypes::shdPct65: kf = 0.65; break;
|
||||
case SimpleTypes::shdPct70: kf = 0.70; break;
|
||||
case SimpleTypes::shdPct75: kf = 0.75; break;
|
||||
case SimpleTypes::shdPct80: kf = 0.80; break;
|
||||
case SimpleTypes::shdPct85: kf = 0.85; break;
|
||||
case SimpleTypes::shdPct87: kf = 0.87; break;
|
||||
case SimpleTypes::shdPct90: kf = 0.90; break;
|
||||
case SimpleTypes::shdPct95: kf = 0.95; break;
|
||||
}
|
||||
ucR = (BYTE)(ucR * (1 - kf)); ucB = (BYTE)(ucB * (1 - kf)); ucG = (BYTE)(ucG * (1 - kf));
|
||||
}
|
||||
SimpleTypes::CHexColor<> *oRgbColor = new SimpleTypes::CHexColor<>(ucR,ucG,ucB);
|
||||
|
||||
if (oRgbColor)
|
||||
{
|
||||
std::wstring strColor = L"#" + oRgbColor->ToString().substr(2);//.Right(6);
|
||||
odf_color = odf_types::color(strColor);
|
||||
delete oRgbColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
void DocxConverter::apply_HF_from(OOX::Logic::CSectionProperty *props, OOX::Logic::CSectionProperty *other)
|
||||
{
|
||||
if (props == NULL || other== NULL)return;
|
||||
|
||||
@ -117,6 +117,7 @@ namespace ComplexTypes
|
||||
class CTblWidth;
|
||||
class CPageBorder;
|
||||
class CTrackChange;
|
||||
class CShading;
|
||||
}
|
||||
}
|
||||
namespace cpdoccore
|
||||
@ -219,6 +220,7 @@ namespace Oox2Odf
|
||||
void convert(OOX::Drawing::CInline *oox_inline);
|
||||
|
||||
void convert(SimpleTypes::CTheme<> *oox_font_theme,_CP_OPT(std::wstring) & odf_font_name);
|
||||
void convert(ComplexTypes::Word::CShading *shading, _CP_OPT(odf_types::color) & odf_color);
|
||||
void convert(ComplexTypes::Word::CColor *color, _CP_OPT(odf_types::color) & odf_color);
|
||||
void convert(SimpleTypes::CUniversalMeasure *oox_size, _CP_OPT(odf_types::length) & odf_size);
|
||||
void convert(SimpleTypes::CUniversalMeasure *oox_size, _CP_OPT(odf_types::length_or_percent) & odf_size);
|
||||
|
||||
@ -301,7 +301,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
|
||||
ods_context->start_rows();
|
||||
for (size_t row = 0 ; row < oox_sheet->m_oSheetData->m_arrItems.size(); row++)
|
||||
{
|
||||
convert(oox_sheet->m_oSheetData->m_arrItems[row]);
|
||||
convert(oox_sheet->m_oSheetData->m_arrItems[row], row > 0 ? oox_sheet->m_oSheetData->m_arrItems[row - 1] : NULL);
|
||||
|
||||
if ( oox_sheet->m_oSheetData->m_arrItems[row] )
|
||||
delete oox_sheet->m_oSheetData->m_arrItems[row];
|
||||
|
||||
@ -170,7 +170,7 @@ namespace NS_DWC_Common
|
||||
alpha = (BYTE)(XmlUtils::GetDouble(str) * 256);
|
||||
}
|
||||
else
|
||||
alpha = (BYTE)XmlUtils::GetDouble(opacityStr) * 256;
|
||||
alpha = (BYTE)(XmlUtils::GetDouble(opacityStr) * 256);
|
||||
}
|
||||
return alpha;
|
||||
}
|
||||
@ -1410,7 +1410,31 @@ std::wstring CDrawingConverter::ObjectToVML (const std::wstring& sXml)
|
||||
|
||||
HRESULT CDrawingConverter::AddObject(const std::wstring& bsXml, std::wstring** pMainProps)
|
||||
{
|
||||
std::wstring sBegin(L"<main xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:p=\"urn:schemas-microsoft-com:office:powerpoint\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:ve=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" xmlns:a14=\"http://schemas.microsoft.com/office/drawing/2010/main\" xmlns:pic=\"http://schemas.openxmlformats.org/drawingml/2006/picture\" xmlns:xdr=\"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing\">");
|
||||
std::wstring sBegin(L"<main \
|
||||
xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
|
||||
xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
|
||||
xmlns:p=\"urn:schemas-microsoft-com:office:powerpoint\" \
|
||||
xmlns:v=\"urn:schemas-microsoft-com:vml\" \
|
||||
xmlns:x=\"urn:schemas-microsoft-com:office:excel\" \
|
||||
xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
|
||||
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
|
||||
xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" \
|
||||
xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" \
|
||||
xmlns:ve=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
|
||||
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
|
||||
xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" \
|
||||
xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" \
|
||||
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \
|
||||
xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" \
|
||||
xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" \
|
||||
xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" \
|
||||
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
|
||||
xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" \
|
||||
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
|
||||
xmlns:a14=\"http://schemas.microsoft.com/office/drawing/2010/main\" \
|
||||
xmlns:pic=\"http://schemas.openxmlformats.org/drawingml/2006/picture\" \
|
||||
xmlns:xdr=\"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing\" \
|
||||
mc:Ignorable=\"w14 w15 wp14\">");
|
||||
|
||||
std::wstring sEnd(L"</main>");
|
||||
std::wstring strXml = sBegin + bsXml + sEnd;
|
||||
@ -2164,6 +2188,7 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
|
||||
nullable_string sOpacity;
|
||||
nullable_string sOpacity2;
|
||||
nullable_string sColor2;
|
||||
nullable_string sColor;
|
||||
nullable_string sType;
|
||||
nullable_string sFocus;
|
||||
nullable_string sFocusSize;
|
||||
@ -2171,8 +2196,9 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
|
||||
nullable_string sAngle;
|
||||
nullable_string sColors;
|
||||
|
||||
XmlMacroReadAttributeBase(oNodeP, L"opacity" , sOpacity);
|
||||
XmlMacroReadAttributeBase(oNodeP, L"opacity" , sOpacity);
|
||||
XmlMacroReadAttributeBase(oNodeP, L"opacity2" , sOpacity2);
|
||||
XmlMacroReadAttributeBase(oNodeP, L"color" , sColor);
|
||||
XmlMacroReadAttributeBase(oNodeP, L"color2" , sColor2);
|
||||
XmlMacroReadAttributeBase(oNodeP, L"type" , sType);
|
||||
XmlMacroReadAttributeBase(oNodeP, L"focus" , sFocus);
|
||||
@ -2199,22 +2225,52 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
|
||||
{
|
||||
nFocus = _wtoi(sFocus->c_str())/100.0;
|
||||
}
|
||||
|
||||
if (sOpacity.is_init())
|
||||
{
|
||||
bOpacity = true;
|
||||
lAlpha = NS_DWC_Common::getOpacityFromString(*sOpacity);
|
||||
oMod.name = L"alpha";
|
||||
oMod.val = (int)(lAlpha * 100000.0 / 255.0);
|
||||
oMod.val = (int)((1 - lAlpha/ 255.0) * 100000.0 );
|
||||
|
||||
if (arColors.at(0)->is_init())
|
||||
arColors.at(0)->Color->Modifiers.push_back(oMod);
|
||||
}
|
||||
if (sColor.is_init())
|
||||
{
|
||||
NSPresentationEditor::CColor color;
|
||||
if (sColor->find(L"fill") != -1)
|
||||
{
|
||||
std::wstring sColorEffect = *sColor;
|
||||
if (sColorEffect.length() > 5)
|
||||
sColorEffect = sColorEffect.substr(5);
|
||||
|
||||
int resR, resG, resB;
|
||||
GetColorWithEffect(sColorEffect, R, G, B, resR, resG, resB);
|
||||
|
||||
color.R = resR;
|
||||
color.G = resG;
|
||||
color.B = resB;
|
||||
}
|
||||
else
|
||||
{
|
||||
color = NS_DWC_Common::getColorFromString(*sColor);
|
||||
}
|
||||
PPTX::Logic::UniColor *oColor = new PPTX::Logic::UniColor();
|
||||
oColor->Color = new PPTX::Logic::SrgbClr();
|
||||
oColor->Color->SetRGB(color.R, color.G, color.B);
|
||||
|
||||
if (bOpacity)
|
||||
oColor->Color->Modifiers.push_back(oMod);
|
||||
|
||||
arColors[0] = oColor;
|
||||
}
|
||||
if (sOpacity2.is_init())
|
||||
{
|
||||
bOpacity2 = true;
|
||||
lAlpha = NS_DWC_Common::getOpacityFromString(*sOpacity2);
|
||||
oMod.name = L"alpha";
|
||||
oMod2.val = (int)(lAlpha * 100000.0 / 255.0);
|
||||
oMod2.val = (int)((1 - lAlpha/ 255.) * 100000.);
|
||||
|
||||
if (arColors.at(1)->is_init())
|
||||
arColors.at(1)->Color->Modifiers.push_back(oMod2);
|
||||
@ -2353,6 +2409,25 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
|
||||
XmlMacroReadAttributeBase(oNodeShape, L"strokecolor", sStrokeColor);
|
||||
XmlMacroReadAttributeBase(oNodeShape, L"strokeweight", sStrokeWeight);
|
||||
XmlMacroReadAttributeBase(oNodeShape, L"stroked", sStroked);
|
||||
|
||||
XmlUtils::CXmlNode oNodeStroke = oNodeShape.ReadNode(L"v:stroke");
|
||||
if (oNodeStroke.IsValid())
|
||||
{
|
||||
nullable_string sStrokeOn;
|
||||
XmlMacroReadAttributeBase(oNodeStroke, L"on", sStrokeOn);
|
||||
if (sStrokeOn.is_init())
|
||||
{
|
||||
sStroked.reset();
|
||||
sStroked = sStrokeOn;
|
||||
}
|
||||
nullable_string sStrokeColor1;
|
||||
XmlMacroReadAttributeBase(oNodeStroke, L"strokecolor", sStrokeColor1);
|
||||
if (sStrokeColor1.is_init())
|
||||
{
|
||||
sStrokeColor1.reset();
|
||||
sStrokeColor = sStrokeColor1;
|
||||
}
|
||||
}
|
||||
|
||||
//textFill
|
||||
strRPr += L"<w14:textFill>";
|
||||
@ -2500,8 +2575,7 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
|
||||
strRPr += L"<w14:noFill/>";
|
||||
bStroked = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (sStrokeColor.is_init())
|
||||
{
|
||||
color = NS_DWC_Common::getColorFromString(*sStrokeColor);
|
||||
@ -2863,8 +2937,8 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
|
||||
pShape->signatureLine = pPPTShape->m_oSignatureLine;
|
||||
}
|
||||
|
||||
if (!pPPTShape->IsWordArt())
|
||||
CheckPenShape(elem, oNodeShape, pPPTShape);
|
||||
//if (!pPPTShape->IsWordArt())
|
||||
CheckPenShape(elem, oNodeShape, pPPTShape);
|
||||
|
||||
CheckBrushShape(elem, oNodeShape, pPPTShape);
|
||||
|
||||
@ -4428,9 +4502,21 @@ void CDrawingConverter::CheckPenShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils::
|
||||
pSpPr->ln->w = size;
|
||||
pPPTShape->m_bIsStroked = true;
|
||||
}
|
||||
|
||||
XmlUtils::CXmlNode oNodeStroke = oNode.ReadNode(L"v:stroke");
|
||||
|
||||
nullable_string sStroked;
|
||||
XmlMacroReadAttributeBase(oNode, L"stroked", sStroked);
|
||||
|
||||
if (oNodeStroke.IsValid())
|
||||
{
|
||||
nullable_string sStrokeOn;
|
||||
XmlMacroReadAttributeBase(oNodeStroke, L"on", sStrokeOn);
|
||||
if (sStrokeOn.is_init())
|
||||
{
|
||||
sStroked.reset();
|
||||
sStroked = sStrokeOn;
|
||||
}
|
||||
}
|
||||
if (sStroked.is_init())
|
||||
{
|
||||
if (*sStroked == L"false" || *sStroked == L"f")
|
||||
@ -4451,7 +4537,6 @@ void CDrawingConverter::CheckPenShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils::
|
||||
pSpPr->ln->Fill.Fill = new PPTX::Logic::NoFill();
|
||||
}
|
||||
|
||||
XmlUtils::CXmlNode oNodeStroke = oNode.ReadNode(L"v:stroke");
|
||||
if (oNodeStroke.IsValid())
|
||||
{
|
||||
sStrokeColor.reset();
|
||||
|
||||
@ -86,7 +86,6 @@
|
||||
6967B1561E27B4B800A129E2 /* OOXParagraphElementReaders.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OOXParagraphElementReaders.cpp; sourceTree = "<group>"; };
|
||||
6967B1571E27B4B800A129E2 /* OOXParagraphReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOXParagraphReader.h; sourceTree = "<group>"; };
|
||||
6967B1581E27B4B800A129E2 /* OOXPictureAnchorReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOXPictureAnchorReader.h; sourceTree = "<group>"; };
|
||||
6967B1591E27B4B800A129E2 /* OOXPictureGraphicReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOXPictureGraphicReader.h; sourceTree = "<group>"; };
|
||||
6967B15A1E27B4B800A129E2 /* OOXPictureInlineReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOXPictureInlineReader.h; sourceTree = "<group>"; };
|
||||
6967B15B1E27B4B800A129E2 /* OOXPictureReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOXPictureReader.h; sourceTree = "<group>"; };
|
||||
6967B15C1E27B4B800A129E2 /* OOXpPrFrameReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOXpPrFrameReader.h; sourceTree = "<group>"; };
|
||||
@ -241,7 +240,6 @@
|
||||
6967B1561E27B4B800A129E2 /* OOXParagraphElementReaders.cpp */,
|
||||
6967B1571E27B4B800A129E2 /* OOXParagraphReader.h */,
|
||||
6967B1581E27B4B800A129E2 /* OOXPictureAnchorReader.h */,
|
||||
6967B1591E27B4B800A129E2 /* OOXPictureGraphicReader.h */,
|
||||
6967B15A1E27B4B800A129E2 /* OOXPictureInlineReader.h */,
|
||||
6967B15B1E27B4B800A129E2 /* OOXPictureReader.h */,
|
||||
6967B15C1E27B4B800A129E2 /* OOXpPrFrameReader.h */,
|
||||
@ -587,8 +585,7 @@
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||
/usr/include/,
|
||||
/usr/include/libxml2/,
|
||||
/usr/include/libxml2,
|
||||
"$(PROJECT_DIR)/../../../Common/3dParty/boost/boost_1_58_0",
|
||||
"$(PROJECT_DIR)/../../../DesktopEditor",
|
||||
"$(PROJECT_DIR)/../../../DesktopEditor/freetype-2.5.2/include",
|
||||
@ -621,8 +618,7 @@
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||
/usr/include/,
|
||||
/usr/include/libxml2/,
|
||||
/usr/include/libxml2,
|
||||
"$(PROJECT_DIR)/../../../Common/3dParty/boost/boost_1_58_0",
|
||||
"$(PROJECT_DIR)/../../../DesktopEditor",
|
||||
"$(PROJECT_DIR)/../../../DesktopEditor/freetype-2.5.2/include",
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
6967AFE91E279C6F00A129E2 /* ToString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6967AFE51E279C6F00A129E2 /* ToString.cpp */; };
|
||||
6967AFF01E279C7700A129E2 /* File.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6967AFEB1E279C7700A129E2 /* File.cpp */; };
|
||||
6967AFF11E279C7700A129E2 /* TxtFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6967AFED1E279C7700A129E2 /* TxtFile.cpp */; };
|
||||
8AB24C012130055700E80DDD /* SystemUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AB24C002130055700E80DDD /* SystemUtils.cpp */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
@ -49,6 +50,8 @@
|
||||
6967AFED1E279C7700A129E2 /* TxtFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TxtFile.cpp; sourceTree = "<group>"; };
|
||||
6967AFEE1E279C7700A129E2 /* TxtFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TxtFile.h; sourceTree = "<group>"; };
|
||||
6967AFEF1E279C7700A129E2 /* TxtFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TxtFormat.h; sourceTree = "<group>"; };
|
||||
8AB24BFF2130055700E80DDD /* SystemUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SystemUtils.h; path = ../../../../DesktopEditor/common/SystemUtils.h; sourceTree = "<group>"; };
|
||||
8AB24C002130055700E80DDD /* SystemUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SystemUtils.cpp; path = ../../../../DesktopEditor/common/SystemUtils.cpp; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -104,6 +107,8 @@
|
||||
6967AFE51E279C6F00A129E2 /* ToString.cpp */,
|
||||
6967AFE61E279C6F00A129E2 /* ToString.h */,
|
||||
6967AFE71E279C6F00A129E2 /* Utility.h */,
|
||||
8AB24C002130055700E80DDD /* SystemUtils.cpp */,
|
||||
8AB24BFF2130055700E80DDD /* SystemUtils.h */,
|
||||
);
|
||||
name = Common;
|
||||
path = ../../../Source/Common;
|
||||
@ -186,6 +191,7 @@
|
||||
6967AFD61E2798DB00A129E2 /* TxtXmlFile.cpp in Sources */,
|
||||
6967AFF01E279C7700A129E2 /* File.cpp in Sources */,
|
||||
6967AFD51E2798DB00A129E2 /* ConvertTxt2Docx.cpp in Sources */,
|
||||
8AB24C012130055700E80DDD /* SystemUtils.cpp in Sources */,
|
||||
6967AFD41E2798DB00A129E2 /* ConvertDocx2Txt.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -316,8 +322,7 @@
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||
/usr/include/,
|
||||
/usr/include/libxml2/,
|
||||
/usr/include/libxml2,
|
||||
"$(PROJECT_DIR)/../../../../Common/3dParty/boost/boost_1_58_0",
|
||||
"$(PROJECT_DIR)/../../../../DesktopEditor/xml/libxml2/include",
|
||||
"$(PROJECT_DIR)/../../../../DesktopEditor/freetype-2.5.2/include",
|
||||
@ -347,8 +352,7 @@
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||
/usr/include/,
|
||||
/usr/include/libxml2/,
|
||||
/usr/include/libxml2,
|
||||
"$(PROJECT_DIR)/../../../../Common/3dParty/boost/boost_1_58_0",
|
||||
"$(PROJECT_DIR)/../../../../DesktopEditor/xml/libxml2/include",
|
||||
"$(PROJECT_DIR)/../../../../DesktopEditor/freetype-2.5.2/include",
|
||||
|
||||
@ -40,3 +40,18 @@ core_release {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
core_boost_date_time {
|
||||
|
||||
core_windows {
|
||||
core_debug {
|
||||
LIBS += -L$$CORE_BOOST_LIBS -llibboost_date_time-$$MSVC-mt-gd-1_58
|
||||
}
|
||||
core_release {
|
||||
LIBS += -L$$CORE_BOOST_LIBS -llibboost_date_time-$$MSVC-mt-1_58
|
||||
}
|
||||
} else {
|
||||
LIBS += -L$$CORE_BOOST_LIBS -lboost_date_time
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -59,12 +59,11 @@ else
|
||||
svn export http://source.icu-project.org/repos/icu/tags/release-$ICU_MAJOR_VER-$ICU_MINOR_VER/icu4c ./icu
|
||||
fi
|
||||
|
||||
# Workaround for building icu older than 60.0 on Archlinux
|
||||
# Workaround for building icu older than 60.0
|
||||
# on systems without xlocale.h (removed from glibc since 2.26)
|
||||
# See https://sourceware.org/glibc/wiki/Release/2.26#Removal_of_.27xlocale.h.27
|
||||
# See https://bugs.archlinux.org/task/55246
|
||||
if [ -f "/etc/arch-release" ]; then
|
||||
echo "Arch Linux detected. Applying 'xlocale.h' error patch"
|
||||
sed -i 's/xlocale/locale/' ./icu/source/i18n/digitlst.cpp
|
||||
fi
|
||||
sed -i 's/xlocale/locale/' ./icu/source/i18n/digitlst.cpp
|
||||
|
||||
cd ./icu/source/
|
||||
|
||||
|
||||
64
Common/3dParty/v8/v8_xp/build.bat
Normal file
64
Common/3dParty/v8/v8_xp/build.bat
Normal file
@ -0,0 +1,64 @@
|
||||
SET SCRIPTPATH=%~dp0
|
||||
CD /D %~dp0
|
||||
|
||||
SET PATH=%SCRIPTPATH%depot_tools;%SCRIPTPATH%depot_tools\win_tools-2_7_6_bin\python\bin;%PATH%
|
||||
SET DEPOT_TOOLS_WIN_TOOLCHAIN=0
|
||||
SET GYP_MSVS_VERSION=2015
|
||||
|
||||
SET VC64_PATH=%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\Common7\IDE
|
||||
SET VC32_PATH=%ProgramFiles%\Microsoft Visual Studio 14.0\Common7\IDE
|
||||
|
||||
setlocal enabledelayedexpansion
|
||||
if defined ProgramFiles(x86) (
|
||||
SET PATH=!VC64_PATH!;!PATH!
|
||||
) else (
|
||||
SET PATH=!VC32_PATH!;!PATH!
|
||||
)
|
||||
|
||||
if not exist "win_32" (
|
||||
echo "building x86... -------------------------------------------"
|
||||
|
||||
md win_32
|
||||
md win_32\debug
|
||||
md win_32\release
|
||||
|
||||
call python v8\build\gyp_v8
|
||||
call .\change_projects.bat
|
||||
|
||||
cd "%SCRIPTPATH%v8\tools\gyp"
|
||||
|
||||
call devenv v8.sln /Rebuild "Release"
|
||||
call devenv v8.sln /Rebuild "Debug"
|
||||
|
||||
cd "%SCRIPTPATH%"
|
||||
|
||||
XCOPY /Y "v8\build\Release\lib\*" "win_32\release\"
|
||||
XCOPY /Y "v8\build\Release\icudt.dll" "win_32\release\"
|
||||
|
||||
XCOPY /Y "v8\build\Debug\lib\*" "win_32\debug\"
|
||||
XCOPY /Y "v8\build\Debug\icudt.dll" "win_32\debug\"
|
||||
)
|
||||
|
||||
if not exist "win_64" (
|
||||
echo "building x64... -------------------------------------------"
|
||||
|
||||
md win_64
|
||||
md win_64\debug
|
||||
md win_64\release
|
||||
|
||||
call python v8\build\gyp_v8 -Dtarget_arch=x64
|
||||
call .\change_projects.bat
|
||||
|
||||
cd "%SCRIPTPATH%v8\tools\gyp"
|
||||
|
||||
call devenv v8.sln /Rebuild "Release"
|
||||
call devenv v8.sln /Rebuild "Debug"
|
||||
|
||||
cd "%SCRIPTPATH%"
|
||||
|
||||
XCOPY /Y "v8\build\Release\lib\*" "win_64\release\"
|
||||
XCOPY /Y "v8\build\Release\icudt.dll" "win_64\release\"
|
||||
|
||||
XCOPY /Y "v8\build\Debug\lib\*" "win_64\debug\"
|
||||
XCOPY /Y "v8\build\Debug\icudt.dll" "win_64\debug\"
|
||||
)
|
||||
34
Common/3dParty/v8/v8_xp/change_projects.bat
Normal file
34
Common/3dParty/v8/v8_xp/change_projects.bat
Normal file
@ -0,0 +1,34 @@
|
||||
SET SCRIPTPATH=%~dp0
|
||||
CD /D %~dp0
|
||||
|
||||
cd "%SCRIPTPATH%v8\tools\gyp"
|
||||
call powershell -Command "(gc v8_base_0.vcxproj) -replace '<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>', '<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>' | Out-File -Encoding 'UTF8' v8_base_0.vcxproj"
|
||||
call powershell -Command "(gc v8_base_0.vcxproj) -replace '<RuntimeLibrary>MultiThreaded</RuntimeLibrary>', '<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>' | Out-File -Encoding 'UTF8' v8_base_0.vcxproj"
|
||||
|
||||
call powershell -Command "(gc v8_base_1.vcxproj) -replace '<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>', '<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>' | Out-File -Encoding 'UTF8' v8_base_1.vcxproj"
|
||||
call powershell -Command "(gc v8_base_1.vcxproj) -replace '<RuntimeLibrary>MultiThreaded</RuntimeLibrary>', '<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>' | Out-File -Encoding 'UTF8' v8_base_1.vcxproj"
|
||||
|
||||
call powershell -Command "(gc v8_base_2.vcxproj) -replace '<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>', '<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>' | Out-File -Encoding 'UTF8' v8_base_2.vcxproj"
|
||||
call powershell -Command "(gc v8_base_2.vcxproj) -replace '<RuntimeLibrary>MultiThreaded</RuntimeLibrary>', '<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>' | Out-File -Encoding 'UTF8' v8_base_2.vcxproj"
|
||||
|
||||
call powershell -Command "(gc v8_base_3.vcxproj) -replace '<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>', '<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>' | Out-File -Encoding 'UTF8' v8_base_3.vcxproj"
|
||||
call powershell -Command "(gc v8_base_3.vcxproj) -replace '<RuntimeLibrary>MultiThreaded</RuntimeLibrary>', '<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>' | Out-File -Encoding 'UTF8' v8_base_3.vcxproj"
|
||||
|
||||
call powershell -Command "(gc v8_libbase.vcxproj) -replace '<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>', '<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>' | Out-File -Encoding 'UTF8' v8_libbase.vcxproj"
|
||||
call powershell -Command "(gc v8_libbase.vcxproj) -replace '<RuntimeLibrary>MultiThreaded</RuntimeLibrary>', '<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>' | Out-File -Encoding 'UTF8' v8_libbase.vcxproj"
|
||||
|
||||
call powershell -Command "(gc v8_libplatform.vcxproj) -replace '<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>', '<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>' | Out-File -Encoding 'UTF8' v8_libplatform.vcxproj"
|
||||
call powershell -Command "(gc v8_libplatform.vcxproj) -replace '<RuntimeLibrary>MultiThreaded</RuntimeLibrary>', '<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>' | Out-File -Encoding 'UTF8' v8_libplatform.vcxproj"
|
||||
|
||||
call powershell -Command "(gc v8_nosnapshot.vcxproj) -replace '<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>', '<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>' | Out-File -Encoding 'UTF8' v8_nosnapshot.vcxproj"
|
||||
call powershell -Command "(gc v8_nosnapshot.vcxproj) -replace '<RuntimeLibrary>MultiThreaded</RuntimeLibrary>', '<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>' | Out-File -Encoding 'UTF8' v8_nosnapshot.vcxproj"
|
||||
|
||||
call powershell -Command "(gc mksnapshot.vcxproj) -replace '<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>', '<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>' | Out-File -Encoding 'UTF8' mksnapshot.vcxproj"
|
||||
call powershell -Command "(gc mksnapshot.vcxproj) -replace '<RuntimeLibrary>MultiThreaded</RuntimeLibrary>', '<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>' | Out-File -Encoding 'UTF8' mksnapshot.vcxproj"
|
||||
|
||||
cd "%SCRIPTPATH%v8\third_party\icu"
|
||||
call powershell -Command "(gc icui18n.vcxproj) -replace '<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>', '<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>' | Out-File -Encoding 'UTF8' icui18n.vcxproj"
|
||||
call powershell -Command "(gc icui18n.vcxproj) -replace '<RuntimeLibrary>MultiThreaded</RuntimeLibrary>', '<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>' | Out-File -Encoding 'UTF8' icui18n.vcxproj"
|
||||
|
||||
call powershell -Command "(gc icuuc.vcxproj) -replace '<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>', '<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>' | Out-File -Encoding 'UTF8' icuuc.vcxproj"
|
||||
call powershell -Command "(gc icuuc.vcxproj) -replace '<RuntimeLibrary>MultiThreaded</RuntimeLibrary>', '<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>' | Out-File -Encoding 'UTF8' icuuc.vcxproj"
|
||||
19
Common/3dParty/v8/v8_xp/fetch.bat
Normal file
19
Common/3dParty/v8/v8_xp/fetch.bat
Normal file
@ -0,0 +1,19 @@
|
||||
SET SCRIPTPATH=%~dp0
|
||||
CD /D %~dp0
|
||||
|
||||
if exist "depot_tools" (
|
||||
echo "depot_tools already fetched"
|
||||
) else (
|
||||
call git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||
call powershell -File .\fix-depot_tools.ps1
|
||||
)
|
||||
|
||||
SET PATH=%SCRIPTPATH%depot_tools;%SCRIPTPATH%depot_tools\python276_bin;%PATH%
|
||||
SET DEPOT_TOOLS_WIN_TOOLCHAIN=0
|
||||
SET GYP_MSVS_VERSION=2015
|
||||
|
||||
if not exist "%SCRIPTPATH%v8" (
|
||||
call .\depot_tools\fetch v8
|
||||
)
|
||||
|
||||
call depot_tools\gclient sync -r 4.10.253
|
||||
4
Common/3dParty/v8/v8_xp/fix-depot_tools.ps1
Normal file
4
Common/3dParty/v8/v8_xp/fix-depot_tools.ps1
Normal file
@ -0,0 +1,4 @@
|
||||
$gclient_path = "depot_tools\gclient.bat"
|
||||
$fetch_path = "depot_tools\fetch.bat"
|
||||
(Get-Content $gclient_path) | ForEach-Object { $_ -replace "^(`"%~dp0python`")", "call $&" } | Set-Content $gclient_path
|
||||
(Get-Content $fetch_path) | ForEach-Object { $_ -replace "^(%~dp0python)", "call $&" } | Set-Content $fetch_path
|
||||
30
Common/3dParty/v8/v8_xp/v8.pri
Normal file
30
Common/3dParty/v8/v8_xp/v8.pri
Normal file
@ -0,0 +1,30 @@
|
||||
CORE_V8_PATH_INCLUDE = $$PWD/v8
|
||||
CORE_V8_PATH_LIBS = $$PWD/$$CORE_BUILDS_PLATFORM_PREFIX
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$CORE_V8_PATH_INCLUDE \
|
||||
$$CORE_V8_PATH_INCLUDE/include
|
||||
|
||||
core_windows {
|
||||
CORE_V8_PATH_LIBS = $$CORE_V8_PATH_LIBS/$$CORE_BUILDS_CONFIGURATION_PREFIX
|
||||
|
||||
LIBS += -L$$CORE_V8_PATH_LIBS -lv8_base_0 -lv8_base_1 -lv8_base_2 -lv8_base_3 -lv8_libbase -lv8_libplatform -lv8_nosnapshot -lv8_external_snapshot
|
||||
LIBS += -L$$CORE_V8_PATH_LIBS -licui18n -licuuc
|
||||
|
||||
LIBS += -lwinmm
|
||||
LIBS += -ladvapi32
|
||||
LIBS += -lShell32
|
||||
}
|
||||
|
||||
core_linux {
|
||||
LIBS += -L$$CORE_V8_PATH_LIBS -lv8_base -lv8_libplatform -lv8_libbase -lv8_nosnapshot -lv8_external_snapshot
|
||||
LIBS += -L$$CORE_V8_PATH_LIBS -licui18n -licuuc -licudata
|
||||
}
|
||||
|
||||
core_mac {
|
||||
LIBS += -L$$CORE_V8_PATH_LIBS -lv8_base -lv8_libbase -lv8_libplatform -lv8_nosnapshot -lv8_external_snapshot
|
||||
LIBS += -L$$CORE_V8_PATH_LIBS -licui18n -licuuc -lv8_libsampler
|
||||
|
||||
QMAKE_CXXFLAGS += -Wall -Wno-inconsistent-missing-override
|
||||
QMAKE_CFLAGS += -Wall -Wno-inconsistent-missing-override
|
||||
}
|
||||
@ -1245,7 +1245,7 @@
|
||||
"$(inherited)",
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||
/usr/include/,
|
||||
/usr/include/libxml2/,
|
||||
/usr/include/libxml2,
|
||||
"$(PROJECT_DIR)/../../../UnicodeConverter/icubuilds/mac/icu/**",
|
||||
"$(PROJECT_DIR)/../../../UnicodeConverter/icubuilds/mac/icu/icu/common",
|
||||
"$(PROJECT_DIR)/../../../UnicodeConverter/icubuilds/mac/icu/icu/i18n",
|
||||
@ -1287,7 +1287,7 @@
|
||||
"$(inherited)",
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||
/usr/include/,
|
||||
/usr/include/libxml2/,
|
||||
/usr/include/libxml2,
|
||||
"$(PROJECT_DIR)/../../../UnicodeConverter/icubuilds/mac/icu/**",
|
||||
"$(PROJECT_DIR)/../../../UnicodeConverter/icubuilds/mac/icu/icu/common",
|
||||
"$(PROJECT_DIR)/../../../UnicodeConverter/icubuilds/mac/icu/icu/i18n",
|
||||
|
||||
@ -4884,11 +4884,11 @@ namespace SimpleTypes
|
||||
enum EShd
|
||||
{
|
||||
shdClear = 0,
|
||||
shdDiagCross = 1,
|
||||
shdDiagStripe = 2,
|
||||
shdHorzCross = 3,
|
||||
shdHorzStripe = 4,
|
||||
shdNil = 5,
|
||||
shdNil = 1,
|
||||
shdDiagCross = 2,
|
||||
shdDiagStripe = 3,
|
||||
shdHorzCross = 4,
|
||||
shdHorzStripe = 5,
|
||||
shdPct10 = 6,
|
||||
shdPct12 = 7,
|
||||
shdPct15 = 8,
|
||||
|
||||
@ -1 +1 @@
|
||||
2.4.544.0
|
||||
2.4.547.0
|
||||
|
||||
@ -991,10 +991,10 @@ namespace NSEditorApi
|
||||
js_wrapper<int> m_nTransitionType;
|
||||
js_wrapper<int> m_nTransitionOption;
|
||||
js_wrapper<int> m_nTransitionDuration;
|
||||
js_wrapper<int> m_nSlideAdvanceDuration;
|
||||
|
||||
js_wrapper<bool> m_bSlideAdvanceOnMouseClick;
|
||||
js_wrapper<bool> m_bSlideAdvanceAfter;
|
||||
js_wrapper<bool> m_bSlideAdvanceDuration;
|
||||
js_wrapper<bool> m_bShowLoop;
|
||||
|
||||
public:
|
||||
@ -1007,10 +1007,10 @@ namespace NSEditorApi
|
||||
LINK_PROPERTY_INT_JS(TransitionType)
|
||||
LINK_PROPERTY_INT_JS(TransitionOption)
|
||||
LINK_PROPERTY_INT_JS(TransitionDuration)
|
||||
LINK_PROPERTY_INT_JS(SlideAdvanceDuration)
|
||||
|
||||
LINK_PROPERTY_BOOL_JS(SlideAdvanceOnMouseClick)
|
||||
LINK_PROPERTY_BOOL_JS(SlideAdvanceAfter)
|
||||
LINK_PROPERTY_BOOL_JS(SlideAdvanceDuration)
|
||||
LINK_PROPERTY_BOOL_JS(ShowLoop)
|
||||
};
|
||||
|
||||
|
||||
@ -690,6 +690,7 @@
|
||||
#define ASC_MENU_EVENT_TYPE_SECTION 17
|
||||
#define ASC_MENU_EVENT_TYPE_SHAPE 18
|
||||
#define ASC_MENU_EVENT_TYPE_SLIDE 20
|
||||
#define ASC_MENU_EVENT_TYPE_CHART 21
|
||||
|
||||
// insert commands
|
||||
#define ASC_MENU_EVENT_TYPE_INSERT_IMAGE 50
|
||||
@ -748,6 +749,7 @@
|
||||
#define ASC_MENU_EVENT_TYPE_USER_ZOOM 301
|
||||
|
||||
#define ASC_MENU_EVENT_TYPE_INSERT_CHART 400
|
||||
#define ASC_MENU_EVENT_TYPE_ADD_CHART_DATA 440
|
||||
#define ASC_MENU_EVENT_TYPE_GET_CHART_DATA 450
|
||||
#define ASC_MENU_EVENT_TYPE_SET_CHART_DATA 460
|
||||
|
||||
|
||||
@ -937,7 +937,38 @@ namespace NSDoctRenderer
|
||||
CheckFileDir();
|
||||
NSDirectory::CreateDirectory(m_sFileDir + L"/changes");
|
||||
|
||||
std::wstring sFileCopy = m_sFileDir + L"/origin." + NSCommon::GetFileExtention(path);
|
||||
std::wstring sExtCopy = NSCommon::GetFileExtention(path);
|
||||
|
||||
if (true)
|
||||
{
|
||||
// для файлов по ссылке - расширение может быть плохим.
|
||||
const wchar_t* sExtCopyPtr = sExtCopy.c_str();
|
||||
int nExtCopyLen = sExtCopy.length();
|
||||
int nValidIndex = 0;
|
||||
while (nValidIndex < nExtCopyLen)
|
||||
{
|
||||
wchar_t c = sExtCopyPtr[nValidIndex];
|
||||
if ((c >= 'a' && c <= 'z') ||
|
||||
(c >= 'A' && c <= 'Z') ||
|
||||
(c >= '0' && c <= '9'))
|
||||
{
|
||||
++nValidIndex;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if (nValidIndex > 0)
|
||||
{
|
||||
sExtCopy = sExtCopy.substr(0, nValidIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
sExtCopy = L"tmp";
|
||||
}
|
||||
}
|
||||
|
||||
std::wstring sFileCopy = m_sFileDir + L"/origin." + sExtCopy;
|
||||
MoveFileOpen(path, sFileCopy);
|
||||
|
||||
COfficeFileFormatChecker oChecker;
|
||||
|
||||
@ -18,7 +18,15 @@ include(../../Common/base.pri)
|
||||
|
||||
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lUnicodeConverter -lkernel -lgraphics
|
||||
|
||||
include(../../Common/3dParty/v8/v8.pri)
|
||||
#CONFIG += build_xp
|
||||
|
||||
!build_xp {
|
||||
include(../../Common/3dParty/v8/v8.pri)
|
||||
} else {
|
||||
DEFINES += V8_OS_XP
|
||||
DESTDIR=$$DESTDIR/xp
|
||||
include(../../Common/3dParty/v8/v8_xp/v8.pri)
|
||||
}
|
||||
|
||||
SOURCES += \
|
||||
memorystream.cpp \
|
||||
|
||||
@ -1158,6 +1158,29 @@ public:
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_XP
|
||||
|
||||
class ExternalMallocArrayBufferAllocator : public v8::ArrayBuffer::Allocator
|
||||
{
|
||||
public:
|
||||
virtual void* Allocate(size_t length)
|
||||
{
|
||||
void* ret = malloc(length);
|
||||
memset(ret, 0, length);
|
||||
return ret;
|
||||
}
|
||||
virtual void* AllocateUninitialized(size_t length)
|
||||
{
|
||||
return malloc(length);
|
||||
}
|
||||
virtual void Free(void* data, size_t length)
|
||||
{
|
||||
free(data);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
class CV8Initializer
|
||||
{
|
||||
@ -1171,11 +1194,19 @@ public:
|
||||
std::wstring sPrW = NSFile::GetProcessPath();
|
||||
std::string sPrA = U_TO_UTF8(sPrW);
|
||||
|
||||
#ifndef V8_OS_XP
|
||||
v8::V8::InitializeICUDefaultLocation(sPrA.c_str());
|
||||
v8::V8::InitializeExternalStartupData(sPrA.c_str());
|
||||
m_platform = v8::platform::CreateDefaultPlatform();
|
||||
v8::V8::InitializePlatform(m_platform);
|
||||
v8::V8::Initialize();
|
||||
#else
|
||||
m_platform = v8::platform::CreateDefaultPlatform();
|
||||
v8::V8::InitializePlatform(m_platform);
|
||||
|
||||
v8::V8::Initialize();
|
||||
v8::V8::InitializeICU();
|
||||
#endif
|
||||
}
|
||||
~CV8Initializer()
|
||||
{
|
||||
@ -1193,7 +1224,11 @@ public:
|
||||
v8::Isolate* CreateNew()
|
||||
{
|
||||
v8::Isolate::CreateParams create_params;
|
||||
#ifndef V8_OS_XP
|
||||
m_pAllocator = v8::ArrayBuffer::Allocator::NewDefaultAllocator();
|
||||
#else
|
||||
m_pAllocator = new ExternalMallocArrayBufferAllocator();
|
||||
#endif
|
||||
create_params.array_buffer_allocator = m_pAllocator;
|
||||
return v8::Isolate::New(create_params);
|
||||
}
|
||||
|
||||
@ -51,6 +51,7 @@
|
||||
8ABC65A3208A1EFA00E96FFE /* pro_Image.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8ABC65A2208A1EFA00E96FFE /* pro_Image.cpp */; };
|
||||
8ABC65A5208A1F1B00E96FFE /* pro_Fonts.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8ABC65A4208A1F1B00E96FFE /* pro_Fonts.cpp */; };
|
||||
8ABC65A7208A1F3A00E96FFE /* MetafileToRenderer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8ABC65A6208A1F3A00E96FFE /* MetafileToRenderer.cpp */; };
|
||||
8ADE001421302B3600BFAD8C /* SystemUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8ADE001321302B3600BFAD8C /* SystemUtils.cpp */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
@ -129,6 +130,8 @@
|
||||
8ABC65A2208A1EFA00E96FFE /* pro_Image.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = pro_Image.cpp; path = ../../graphics/pro/pro_Image.cpp; sourceTree = "<group>"; };
|
||||
8ABC65A4208A1F1B00E96FFE /* pro_Fonts.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = pro_Fonts.cpp; path = ../../graphics/pro/pro_Fonts.cpp; sourceTree = "<group>"; };
|
||||
8ABC65A6208A1F3A00E96FFE /* MetafileToRenderer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MetafileToRenderer.cpp; path = ../../graphics/MetafileToRenderer.cpp; sourceTree = "<group>"; };
|
||||
8ADE001221302B3600BFAD8C /* SystemUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SystemUtils.h; path = ../../common/SystemUtils.h; sourceTree = "<group>"; };
|
||||
8ADE001321302B3600BFAD8C /* SystemUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SystemUtils.cpp; path = ../../common/SystemUtils.cpp; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -145,11 +148,13 @@
|
||||
1791A2181BAC19C600FC9C28 /* PdfWriter */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
698AF5031C0766200080D889 /* unicode_util.cpp */,
|
||||
698AF5041C0766200080D889 /* unicode_util.h */,
|
||||
698AF5031C0766200080D889 /* unicode_util.cpp */,
|
||||
7C560FF01AA71C5C000E5860 /* AscEditorPDFPrinter.h */,
|
||||
7C560FFB1AA73B7D000E5860 /* AscEditorPDFPrinter.mm */,
|
||||
8A7E89E020E6211000E06CBE /* ICCProfile.h */,
|
||||
8ADE001221302B3600BFAD8C /* SystemUtils.h */,
|
||||
8ADE001321302B3600BFAD8C /* SystemUtils.cpp */,
|
||||
17FFC2C11BAB15CE00D91F59 /* PdfRenderer.h */,
|
||||
17FFC2C01BAB15CE00D91F59 /* PdfRenderer.cpp */,
|
||||
17FFC2C41BAB163500D91F59 /* OnlineOfficeBinToPdf.h */,
|
||||
@ -322,6 +327,7 @@
|
||||
176285F11BAAFC3B00AEDA07 /* Font.cpp in Sources */,
|
||||
176285F21BAAFC3B00AEDA07 /* Font14.cpp in Sources */,
|
||||
176E57401BB0057700276C19 /* ImageFileFormatChecker.cpp in Sources */,
|
||||
8ADE001421302B3600BFAD8C /* SystemUtils.cpp in Sources */,
|
||||
176285FD1BAAFC3B00AEDA07 /* Streams.cpp in Sources */,
|
||||
176285FA1BAAFC3B00AEDA07 /* Pages.cpp in Sources */,
|
||||
17FFC2C21BAB15CE00D91F59 /* PdfRenderer.cpp in Sources */,
|
||||
@ -482,6 +488,7 @@
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||
/usr/include/libxml2,
|
||||
"../../agg-2.4/include",
|
||||
"../../freetype-2.5.2/include",
|
||||
../../cximage/zlib,
|
||||
@ -524,6 +531,7 @@
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||
/usr/include/libxml2,
|
||||
"../../agg-2.4/include",
|
||||
"../../freetype-2.5.2/include",
|
||||
../../cximage/zlib,
|
||||
|
||||
@ -458,12 +458,12 @@ namespace MetaFile
|
||||
{
|
||||
// oOther слева, текущая матрица справа
|
||||
double dM11 = oOther.M11 * M11 + oOther.M12 * M21;
|
||||
double dM12 = oOther.M11 * M21 + oOther.M12 * M22;
|
||||
double dM12 = oOther.M11 * M12 + oOther.M12 * M22;
|
||||
double dM21 = oOther.M21 * M11 + oOther.M22 * M21;
|
||||
double dM22 = oOther.M21 * M21 + oOther.M22 * M22;
|
||||
double dM22 = oOther.M21 * M12 + oOther.M22 * M22;
|
||||
|
||||
double dDx = oOther.Dx * M11 + oOther.Dy * M21 + Dx;
|
||||
double dDy = oOther.Dx * M21 + oOther.Dy * M22 + Dy;
|
||||
double dDy = oOther.Dx * M12 + oOther.Dy * M22 + Dy;
|
||||
|
||||
M11 = dM11;
|
||||
M12 = dM12;
|
||||
@ -476,12 +476,12 @@ namespace MetaFile
|
||||
{
|
||||
// oOther справа, текущая матрица слева
|
||||
double dM11 = M11 * oOther.M11 + M12 * oOther.M21;
|
||||
double dM12 = M11 * oOther.M21 + M12 * oOther.M22;
|
||||
double dM12 = M11 * oOther.M12 + M12 * oOther.M22;
|
||||
double dM21 = M21 * oOther.M11 + M22 * oOther.M21;
|
||||
double dM22 = M21 * oOther.M21 + M22 * oOther.M22;
|
||||
double dM22 = M21 * oOther.M12 + M22 * oOther.M22;
|
||||
|
||||
double dDx = Dx * oOther.M11 + Dy * oOther.M21 + oOther.Dx;
|
||||
double dDy = Dx * oOther.M21 + Dy * oOther.M22 + oOther.Dy;
|
||||
double dDy = Dx * oOther.M12 + Dy * oOther.M22 + oOther.Dy;
|
||||
|
||||
M11 = dM11;
|
||||
M12 = dM12;
|
||||
|
||||
@ -434,6 +434,28 @@ namespace MetaFile
|
||||
|
||||
return *this;
|
||||
}
|
||||
CDataStream& operator>>(TEmfStretchBLT& oBitmap)
|
||||
{
|
||||
*this >> oBitmap.Bounds;
|
||||
*this >> oBitmap.xDest;
|
||||
*this >> oBitmap.yDest;
|
||||
*this >> oBitmap.cxDest;
|
||||
*this >> oBitmap.cyDest;
|
||||
*this >> oBitmap.BitBltRasterOperation;
|
||||
*this >> oBitmap.xSrc;
|
||||
*this >> oBitmap.ySrc;
|
||||
*this >> oBitmap.XformSrc;
|
||||
*this >> oBitmap.BkColorSrc;
|
||||
*this >> oBitmap.UsageSrc;
|
||||
*this >> oBitmap.offBmiSrc;
|
||||
*this >> oBitmap.cbBmiSrc;
|
||||
*this >> oBitmap.offBitsSrc;
|
||||
*this >> oBitmap.cbBitsSrc;
|
||||
*this >> oBitmap.cxSrc;
|
||||
*this >> oBitmap.cySrc;
|
||||
|
||||
return *this;
|
||||
}
|
||||
CDataStream& operator>>(TEmfSetDiBitsToDevice& oBitmap)
|
||||
{
|
||||
*this >> oBitmap.Bounds;
|
||||
|
||||
@ -229,6 +229,7 @@ static const struct ActionNamesEmf
|
||||
case EMR_BITBLT: Read_EMR_BITBLT(); break;
|
||||
case EMR_STRETCHDIBITS: Read_EMR_STRETCHDIBITS(); break;
|
||||
case EMR_SETDIBITSTODEVICE: Read_EMR_SETDIBITSTODEVICE(); break;
|
||||
case EMR_STRETCHBLT: Read_EMR_STRETCHBLT(); break;
|
||||
//-----------------------------------------------------------
|
||||
// 2.3.2 Clipping
|
||||
//-----------------------------------------------------------
|
||||
@ -376,24 +377,8 @@ static const struct ActionNamesEmf
|
||||
}
|
||||
void CEmfFile::TranslatePoint(int nX, int nY, double& dX, double &dY)
|
||||
{
|
||||
TEmfWindow* pWindow = m_pDC->GetWindow();
|
||||
TEmfWindow* pViewport = m_pDC->GetViewport();
|
||||
|
||||
dX = (double)((double)(nX - pWindow->lX) * m_pDC->GetPixelWidth()) + pViewport->lX;
|
||||
dY = (double)((double)(nY - pWindow->lY) * m_pDC->GetPixelHeight()) + pViewport->lY;
|
||||
|
||||
// Координаты приходят уже с примененной матрицей. Поэтому сначала мы умножаем на матрицу преобразования,
|
||||
// вычитаем начальные координаты и умножаем на обратную матрицу преобразования.
|
||||
TRect* pBounds = GetDCBounds();
|
||||
double dT = pBounds->nTop;
|
||||
double dL = pBounds->nLeft;
|
||||
|
||||
TEmfXForm* pInverse = GetInverseTransform();
|
||||
TEmfXForm* pTransform = GetTransform();
|
||||
pTransform->Apply(dX, dY);
|
||||
dX -= dL;
|
||||
dY -= dT;
|
||||
pInverse->Apply(dX, dY);
|
||||
dX = (double)nX;
|
||||
dY = (double)nY;
|
||||
}
|
||||
bool CEmfFile::ReadImage(unsigned int offBmi, unsigned int cbBmi, unsigned int offBits, unsigned int cbBits, unsigned int ulSkip, BYTE** ppBgraBuffer, unsigned int* pulWidth, unsigned int* pulHeight)
|
||||
{
|
||||
@ -943,6 +928,27 @@ static const struct ActionNamesEmf
|
||||
if (pBgraBuffer)
|
||||
delete[] pBgraBuffer;
|
||||
}
|
||||
void CEmfFile::Read_EMR_STRETCHBLT()
|
||||
{
|
||||
TEmfStretchBLT oBitmap;
|
||||
m_oStream >> oBitmap;
|
||||
|
||||
BYTE* pBgraBuffer = NULL;
|
||||
unsigned int ulWidth, ulHeight;
|
||||
|
||||
unsigned int unSkip = 108; // sizeof(TEmfStretchBLT) + 8 неправильно считает, из-з TXForm, там double, а в Emf они по 4 байта
|
||||
if (ReadImage(oBitmap.offBmiSrc, oBitmap.cbBmiSrc, oBitmap.offBitsSrc, oBitmap.cbBitsSrc, unSkip, &pBgraBuffer, &ulWidth, &ulHeight))
|
||||
{
|
||||
if (m_pOutput)
|
||||
{
|
||||
ProcessRasterOperation(oBitmap.BitBltRasterOperation, &pBgraBuffer, ulWidth, ulHeight);
|
||||
DrawImage(oBitmap.xDest, oBitmap.yDest, oBitmap.cxDest, oBitmap.cyDest, pBgraBuffer, ulWidth, ulHeight);
|
||||
}
|
||||
}
|
||||
|
||||
if (pBgraBuffer)
|
||||
delete[] pBgraBuffer;
|
||||
}
|
||||
void CEmfFile::Read_EMR_EOF()
|
||||
{
|
||||
unsigned int ulCount, ulOffset, ulSizeLast;
|
||||
|
||||
@ -142,7 +142,14 @@ namespace MetaFile
|
||||
}
|
||||
TXForm* GetTransform()
|
||||
{
|
||||
return m_pDC->GetTransform();
|
||||
TRect* pBounds = GetDCBounds();
|
||||
double dT = pBounds->nTop;
|
||||
double dL = pBounds->nLeft;
|
||||
|
||||
TXForm oShiftXForm(1, 0, 0, 1, -dL, -dT);
|
||||
m_oTransform.Copy(m_pDC->GetFinalTransform());
|
||||
m_oTransform.Multiply(oShiftXForm, MWT_RIGHTMULTIPLY);
|
||||
return &m_oTransform;
|
||||
}
|
||||
unsigned int GetMiterLimit()
|
||||
{
|
||||
@ -218,6 +225,7 @@ namespace MetaFile
|
||||
void Read_EMR_STRETCHDIBITS();
|
||||
void Read_EMR_BITBLT();
|
||||
void Read_EMR_SETDIBITSTODEVICE();
|
||||
void Read_EMR_STRETCHBLT();
|
||||
void Read_EMR_EOF();
|
||||
void Read_EMR_UNKNOWN();
|
||||
void Read_EMR_SAVEDC();
|
||||
@ -313,6 +321,7 @@ namespace MetaFile
|
||||
CEmfDC* m_pDC;
|
||||
CEmfPlayer m_oPlayer;
|
||||
CEmfPath* m_pPath;
|
||||
TEmfXForm m_oTransform;
|
||||
|
||||
friend class CEmfPlayer;
|
||||
};
|
||||
|
||||
@ -257,6 +257,7 @@ namespace MetaFile
|
||||
m_oTransform.Init();
|
||||
m_oInverseTransform.Init();
|
||||
m_oTextColor.Init();
|
||||
m_oFinalTransform.Init();
|
||||
m_oBgColor.Init();
|
||||
m_ulTextAlign = TA_TOP | TA_LEFT | TA_NOUPDATECP;
|
||||
m_ulBgMode = TRANSPARENT;
|
||||
@ -287,13 +288,14 @@ namespace MetaFile
|
||||
pNewDC->m_pPalette = m_pPalette;
|
||||
pNewDC->m_oTransform.Copy(&m_oTransform);
|
||||
pNewDC->m_oInverseTransform.Copy(&m_oInverseTransform);
|
||||
pNewDC->m_oFinalTransform.Copy(&m_oFinalTransform);
|
||||
pNewDC->m_oTextColor.Copy(&m_oTextColor);
|
||||
pNewDC->m_oBgColor.Copy(&m_oBgColor);
|
||||
pNewDC->m_ulTextAlign = m_ulTextAlign;
|
||||
pNewDC->m_ulBgMode = m_ulBgMode;
|
||||
pNewDC->m_ulMiterLimit = m_ulMiterLimit;
|
||||
pNewDC->m_ulFillMode = m_ulFillMode;
|
||||
pNewDC->m_ulStretchMode = m_ulStretchMode;
|
||||
pNewDC->m_ulStretchMode = m_ulStretchMode;
|
||||
pNewDC->m_ulRop2Mode = m_ulRop2Mode;
|
||||
pNewDC->m_dPixelHeight = m_dPixelHeight;
|
||||
pNewDC->m_dPixelWidth = m_dPixelWidth;
|
||||
@ -358,6 +360,8 @@ namespace MetaFile
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
unsigned int CEmfDC::GetMapMode()
|
||||
{
|
||||
@ -371,6 +375,10 @@ namespace MetaFile
|
||||
{
|
||||
return &m_oInverseTransform;
|
||||
}
|
||||
TEmfXForm* CEmfDC::GetFinalTransform()
|
||||
{
|
||||
return &m_oFinalTransform;
|
||||
}
|
||||
void CEmfDC::MultiplyTransform(TEmfXForm& oForm, unsigned int ulMode)
|
||||
{
|
||||
m_oTransform.Multiply(oForm, ulMode);
|
||||
@ -394,6 +402,8 @@ namespace MetaFile
|
||||
m_oInverseTransform.M22 = pT->M22 / dDet;
|
||||
m_oInverseTransform.Dx = pT->Dy * pT->M21 / dDet - pT->Dx * pT->M22 / dDet;
|
||||
m_oInverseTransform.Dy = pT->Dx * pT->M12 / dDet - pT->Dy * pT->M11 / dDet;
|
||||
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
void CEmfDC::SetTextColor(TEmfColor& oColor)
|
||||
{
|
||||
@ -511,12 +521,15 @@ namespace MetaFile
|
||||
m_oWindow.lX = oPoint.x;
|
||||
m_oWindow.lY = oPoint.y;
|
||||
UpdatePixelMetrics();
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
void CEmfDC::SetWindowExtents(TEmfSizeL& oPoint)
|
||||
{
|
||||
m_oWindow.ulW = oPoint.cx;
|
||||
m_oWindow.ulH = oPoint.cy;
|
||||
|
||||
UpdatePixelMetrics();
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
TEmfWindow* CEmfDC::GetWindow()
|
||||
{
|
||||
@ -527,12 +540,14 @@ namespace MetaFile
|
||||
m_oViewport.lX = oPoint.x;
|
||||
m_oViewport.lY = oPoint.y;
|
||||
UpdatePixelMetrics();
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
void CEmfDC::SetViewportExtents(TEmfSizeL& oPoint)
|
||||
{
|
||||
m_oViewport.ulW = oPoint.cx;
|
||||
m_oViewport.ulH = oPoint.cy;
|
||||
UpdatePixelMetrics();
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
TEmfWindow* CEmfDC::GetViewport()
|
||||
{
|
||||
@ -561,6 +576,44 @@ namespace MetaFile
|
||||
|
||||
return true;
|
||||
}
|
||||
void CEmfDC::UpdateFinalTransform()
|
||||
{
|
||||
TEmfWindow* pWindow = GetWindow();
|
||||
TEmfWindow* pViewPort = GetViewport();
|
||||
|
||||
int nWindowX = pWindow->lX;
|
||||
int nWindowY = pWindow->lY;
|
||||
|
||||
double dPixelW = GetPixelWidth();
|
||||
double dPixelH = GetPixelHeight();
|
||||
|
||||
// Вообще отрицательных высоты и ширины быть не должно, но если так встречается, то
|
||||
// мы считаем, что это не перевернутая система координат, а просто сдвинутая
|
||||
|
||||
if (pWindow->ulH < 0)
|
||||
{
|
||||
if (dPixelH < 0)
|
||||
dPixelH = -dPixelH;
|
||||
|
||||
nWindowY += pWindow->ulH;
|
||||
}
|
||||
|
||||
if (pWindow->ulW < 0)
|
||||
{
|
||||
if (dPixelW < 0)
|
||||
dPixelW = -dPixelW;
|
||||
|
||||
nWindowY += pWindow->ulW;
|
||||
}
|
||||
|
||||
TEmfXForm oWindowXForm(1, 0, 0, 1, -nWindowX, -nWindowY);
|
||||
TEmfXForm oViewportXForm(dPixelW, 0, 0, dPixelH, pViewPort->lX, pViewPort->lY);
|
||||
|
||||
m_oFinalTransform.Init();
|
||||
m_oFinalTransform.Multiply(oWindowXForm, MWT_RIGHTMULTIPLY);
|
||||
m_oFinalTransform.Multiply(m_oTransform, MWT_RIGHTMULTIPLY);
|
||||
m_oFinalTransform.Multiply(oViewportXForm, MWT_RIGHTMULTIPLY);
|
||||
}
|
||||
void CEmfDC::SetRop2Mode(unsigned int& nMode)
|
||||
{
|
||||
m_ulRop2Mode = nMode;
|
||||
@ -611,4 +664,4 @@ namespace MetaFile
|
||||
{
|
||||
return m_unArcDirection;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,6 +90,7 @@ namespace MetaFile
|
||||
unsigned int GetMapMode();
|
||||
TEmfXForm* GetTransform();
|
||||
TEmfXForm* GetInverseTransform();
|
||||
TEmfXForm* GetFinalTransform();
|
||||
void MultiplyTransform(TEmfXForm& oForm, unsigned int ulMode);
|
||||
void SetTextColor(TEmfColor& oColor);
|
||||
TEmfColor& GetTextColor();
|
||||
@ -140,6 +141,7 @@ namespace MetaFile
|
||||
void SetPixelWidth(double dPixelW);
|
||||
void SetPixelHeight(double dPixelH);
|
||||
bool UpdatePixelMetrics();
|
||||
void UpdateFinalTransform();
|
||||
|
||||
private:
|
||||
|
||||
@ -150,6 +152,7 @@ namespace MetaFile
|
||||
CEmfLogPalette* m_pPalette;
|
||||
TEmfXForm m_oTransform;
|
||||
TEmfXForm m_oInverseTransform;
|
||||
TEmfXForm m_oFinalTransform;
|
||||
TEmfColor m_oTextColor;
|
||||
TEmfColor m_oBgColor;
|
||||
unsigned int m_ulTextAlign;
|
||||
|
||||
@ -402,6 +402,7 @@ namespace MetaFile
|
||||
int cyDest;
|
||||
};
|
||||
|
||||
|
||||
#define TEmfXForm TXForm
|
||||
//struct TEmfXForm
|
||||
//{
|
||||
@ -487,6 +488,27 @@ namespace MetaFile
|
||||
// }
|
||||
//};
|
||||
|
||||
struct TEmfStretchBLT
|
||||
{
|
||||
TEmfRectL Bounds;
|
||||
int xDest;
|
||||
int yDest;
|
||||
int cxDest;
|
||||
int cyDest;
|
||||
unsigned int BitBltRasterOperation;
|
||||
int xSrc;
|
||||
int ySrc;
|
||||
TXForm XformSrc;
|
||||
TEmfColor BkColorSrc;
|
||||
unsigned int UsageSrc;
|
||||
unsigned int offBmiSrc;
|
||||
unsigned int cbBmiSrc;
|
||||
unsigned int offBitsSrc;
|
||||
unsigned int cbBitsSrc;
|
||||
int cxSrc;
|
||||
int cySrc;
|
||||
};
|
||||
|
||||
struct TEmfEmrText
|
||||
{
|
||||
TEmfPointL Reference;
|
||||
|
||||
@ -584,15 +584,20 @@
|
||||
DEVELOPMENT_TEAM = 2WH24U26GJ;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
UNICODE,
|
||||
_UNICODE,
|
||||
USE_LITE_READER,
|
||||
_USE_LIBXML2_READER_,
|
||||
_USE_XMLLITE_READER_,
|
||||
LINUX,
|
||||
MAC,
|
||||
_IOS,
|
||||
LIBXML_READER_ENABLED,
|
||||
_XCODE,
|
||||
LIBXML_PUSH_ENABLED,
|
||||
LIBXML_HTML_ENABLED,
|
||||
LIBXML_XPATH_ENABLED,
|
||||
LIBXML_OUTPUT_ENABLED,
|
||||
LIBXML_C14N_ENABLED,
|
||||
LIBXML_SAX1_ENABLED,
|
||||
LIBXML_TREE_ENABLED,
|
||||
LIBXML_XPTR_ENABLED,
|
||||
IN_LIBXML,
|
||||
LIBXML_STATIC,
|
||||
);
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
@ -612,15 +617,20 @@
|
||||
DEVELOPMENT_TEAM = 2WH24U26GJ;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
UNICODE,
|
||||
_UNICODE,
|
||||
USE_LITE_READER,
|
||||
_USE_LIBXML2_READER_,
|
||||
_USE_XMLLITE_READER_,
|
||||
LINUX,
|
||||
MAC,
|
||||
_IOS,
|
||||
LIBXML_READER_ENABLED,
|
||||
_XCODE,
|
||||
LIBXML_PUSH_ENABLED,
|
||||
LIBXML_HTML_ENABLED,
|
||||
LIBXML_XPATH_ENABLED,
|
||||
LIBXML_OUTPUT_ENABLED,
|
||||
LIBXML_C14N_ENABLED,
|
||||
LIBXML_SAX1_ENABLED,
|
||||
LIBXML_TREE_ENABLED,
|
||||
LIBXML_XPTR_ENABLED,
|
||||
IN_LIBXML,
|
||||
LIBXML_STATIC,
|
||||
);
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
@ -34,9 +34,15 @@
|
||||
|
||||
#include "../../../DesktopEditor/common/File.h"
|
||||
|
||||
#include "../libxml2/libxml.h"
|
||||
#include "../libxml2/include/libxml/xmlreader.h"
|
||||
#include "../libxml2/include/libxml/c14n.h"
|
||||
#ifdef _IOS
|
||||
#include <libxml2/libxml/xmlreader.h>
|
||||
#include <libxml2/libxml/c14n.h>
|
||||
#else
|
||||
#include "../libxml2/libxml.h"
|
||||
#include "../libxml2/include/libxml/xmlreader.h"
|
||||
#include "../libxml2/include/libxml/c14n.h"
|
||||
#endif
|
||||
|
||||
#include "../include/xmlutils.h"
|
||||
|
||||
namespace XmlUtils
|
||||
|
||||
@ -262,8 +262,7 @@
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||
/usr/include/,
|
||||
/usr/include/libxml2/,
|
||||
/usr/include/libxml2,
|
||||
);
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
@ -293,8 +292,7 @@
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||
/usr/include/,
|
||||
/usr/include/libxml2/,
|
||||
/usr/include/libxml2,
|
||||
);
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
|
||||
@ -21,6 +21,10 @@
|
||||
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
{
|
||||
std::wstring password = L"password";
|
||||
ECMACryptFile crypt_file;
|
||||
bool result = false, bDataIntegrity = false;
|
||||
|
||||
std::wstring srcFileName = L"D:\\test\\_crypted\\test-111.docx";
|
||||
std::wstring dstFileName = srcFileName + L"-mycrypt.docx";
|
||||
std::wstring dstFileName2 = dstFileName + L".oox";
|
||||
@ -31,14 +35,10 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
//std::wstring srcFileName = L"D:\\test\\_crypted\\test.docx";
|
||||
//std::wstring dstFileName3 = srcFileName + L"-mycrypt1.docx";
|
||||
|
||||
std::wstring password = L"574446f1-6aa0-860a-0296-787a87a214bb";
|
||||
|
||||
ECMACryptFile crypt_file;
|
||||
bool result = false, bDataIntegrity = false;
|
||||
|
||||
//result = crypt_file.DecryptOfficeFile(srcFileName, dstFileName, password, bDataIntegrity);
|
||||
//result = crypt_file.EncryptOfficeFile(dstFileName, dstFileName2, password);
|
||||
|
||||
//std::wstring srcFileName1 = L"D:\\test\\_crypted\\test-111.docx-ms.docx";
|
||||
//std::wstring dstFileName1 = srcFileName1 + L".oox";
|
||||
//result = crypt_file.DecryptOfficeFile(srcFileName1, dstFileName1, password, bDataIntegrity);
|
||||
|
||||
result = crypt_file.EncryptOfficeFile(srcFileName, dstFileName, password, L"123456789");
|
||||
result = crypt_file.DecryptOfficeFile(dstFileName, dstFileName2, password, bDataIntegrity);
|
||||
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
|
||||
#include "../../Common/3dParty/cryptopp/modes.h"
|
||||
#include "../../Common/3dParty/cryptopp/aes.h"
|
||||
#include "../../Common/3dParty/cryptopp/des.h"
|
||||
#include "../../Common/3dParty/cryptopp/sha.h"
|
||||
#include "../../Common/3dParty/cryptopp/md5.h"
|
||||
#include "../../Common/3dParty/cryptopp/rsa.h"
|
||||
@ -62,6 +63,8 @@ static const unsigned char encrKeyValueBlockKey[8] = { 0x14, 0x6e, 0x0b, 0xe
|
||||
static const unsigned char encrDataIntegritySaltBlockKey[8] = { 0x5f, 0xb2, 0xad, 0x01, 0x0c, 0xb9, 0xe1, 0xf6 };
|
||||
static const unsigned char encrDataIntegrityHmacValueBlockKey[8] = { 0xa0, 0x67, 0x7f, 0x02, 0xb2, 0x2c, 0x84, 0x33 };
|
||||
|
||||
#define PADDING_SIZE 16
|
||||
|
||||
using namespace CryptoPP;
|
||||
|
||||
class _buf
|
||||
@ -280,6 +283,9 @@ _buf HashAppend(_buf & hashBuf, _buf & block, CRYPT_METHOD::_hashAlgorithm algo
|
||||
|
||||
_buf GenerateAgileKey(_buf & salt, _buf & password, _buf & blockKey, int hashSize, int spin, CRYPT_METHOD::_hashAlgorithm algorithm)
|
||||
{
|
||||
//if (hashSize < 8)
|
||||
// blockKey = 8;
|
||||
|
||||
_buf pHashBuf = HashAppend(salt, password, algorithm);
|
||||
|
||||
for (int i = 0; i < spin; i++)
|
||||
@ -308,7 +314,7 @@ _buf GenerateOdfKey(_buf & pSalt, _buf & pPassword, int keySize, int spin, CRYPT
|
||||
return _buf(pKey.ptr, pKey.size);
|
||||
}
|
||||
|
||||
_buf GenerateHashKey(_buf & salt, _buf & password, int hashSize, int spin, CRYPT_METHOD::_hashAlgorithm algorithm, int block_index = 0)
|
||||
_buf GenerateHashKey(_buf & salt, _buf & password, int hashSize, int keySize, int spin, CRYPT_METHOD::_hashAlgorithm algorithm, int block_index = 0)
|
||||
{
|
||||
_buf block ((unsigned char*)&block_index, 4, false);
|
||||
|
||||
@ -350,8 +356,15 @@ _buf GenerateHashKey(_buf & salt, _buf & password, int hashSize, int spin, CRYPT
|
||||
memcpy(pHashBuf3.ptr + 0, pHashBuf1.ptr, hashSize);
|
||||
memcpy(pHashBuf3.ptr + hashSize, pHashBuf2.ptr, hashSize);
|
||||
|
||||
CorrectHashSize(pHashBuf3, keySize, 0);
|
||||
|
||||
if (keySize == 5)
|
||||
CorrectHashSize(pHashBuf3, 16, 0); //40-bit crypt key !!!
|
||||
|
||||
return _buf(pHashBuf3.ptr, pHashBuf3.size);
|
||||
}
|
||||
ARC4::Decryption rc4Decryption; // todooo -> in impl
|
||||
ARC4::Encryption rc4Encryption;
|
||||
|
||||
bool EncryptCipher(_buf & key, _buf & iv, _buf & data_inp, _buf & data_out, CRYPT_METHOD::_cipherAlgorithm algorithm,
|
||||
StreamTransformationFilter::BlockPaddingScheme padding = StreamTransformationFilter::PKCS_PADDING)
|
||||
@ -362,10 +375,11 @@ bool EncryptCipher(_buf & key, _buf & iv, _buf & data_inp, _buf & data_out, CRYP
|
||||
}
|
||||
else if (algorithm == CRYPT_METHOD::RC4)
|
||||
{
|
||||
data_out.ptr = new unsigned char[data_inp.size];
|
||||
data_out.size = data_inp.size;
|
||||
if (!data_out.ptr)
|
||||
{
|
||||
data_out = _buf(data_inp.size);
|
||||
}
|
||||
|
||||
ARC4::Encryption rc4Encryption(key.ptr, key.size);
|
||||
rc4Encryption.ProcessData(data_out.ptr, data_inp.ptr, data_inp.size);
|
||||
|
||||
}
|
||||
@ -374,6 +388,36 @@ bool EncryptCipher(_buf & key, _buf & iv, _buf & data_inp, _buf & data_out, CRYP
|
||||
CFB_Mode<Blowfish>::Encryption encryption(key.ptr, key.size, iv.ptr);
|
||||
encryption.ProcessData(data_out.ptr, data_inp.ptr, data_inp.size);
|
||||
}
|
||||
else if (algorithm == CRYPT_METHOD::DES_CBC)
|
||||
{
|
||||
DES::Encryption desEncryption(key.ptr, key.size == 7 ? 8 : key.size);
|
||||
StreamTransformation *modeEncryption = new CipherModeFinalTemplate_ExternalCipher<CBC_Encryption>(desEncryption, iv.ptr );
|
||||
if (!data_out.ptr)
|
||||
{
|
||||
data_out = _buf(data_inp.size);
|
||||
}
|
||||
StreamTransformationFilter stfEncryption(*modeEncryption, new ArraySink( data_out.ptr, data_out.size), padding);
|
||||
|
||||
stfEncryption.Put( data_inp.ptr, data_inp.size );
|
||||
stfEncryption.MessageEnd();
|
||||
|
||||
delete modeEncryption;
|
||||
}
|
||||
else if (algorithm == CRYPT_METHOD::DES_ECB)
|
||||
{
|
||||
DES::Encryption desEncryption(key.ptr, key.size == 7 ? 8 : key.size);
|
||||
StreamTransformation *modeEncryption = new CipherModeFinalTemplate_ExternalCipher<ECB_OneWay>(desEncryption, iv.ptr );
|
||||
if (!data_out.ptr)
|
||||
{
|
||||
data_out = _buf(data_inp.size);
|
||||
}
|
||||
StreamTransformationFilter stfEncryption(*modeEncryption, new ArraySink( data_out.ptr, data_out.size), padding);
|
||||
|
||||
stfEncryption.Put( data_inp.ptr, data_inp.size );
|
||||
stfEncryption.MessageEnd();
|
||||
|
||||
delete modeEncryption;
|
||||
}
|
||||
else //AES
|
||||
{
|
||||
StreamTransformation *modeEncryption = NULL;
|
||||
@ -413,8 +457,6 @@ bool EncryptCipher(_buf & key, _buf & iv, _buf & data_inp, _buf & data_out, CRYP
|
||||
return true;
|
||||
}
|
||||
|
||||
ARC4::Decryption rc4Decryption; // todooo -> in impl
|
||||
|
||||
bool DecryptCipher(_buf & key, _buf & iv, _buf & data_inp, _buf & data_out, CRYPT_METHOD::_cipherAlgorithm algorithm,
|
||||
StreamTransformationFilter::BlockPaddingScheme padding = StreamTransformationFilter::NO_PADDING)
|
||||
{
|
||||
@ -436,6 +478,28 @@ bool DecryptCipher(_buf & key, _buf & iv, _buf & data_inp, _buf & data_out, CRY
|
||||
CFB_Mode<Blowfish>::Decryption decryption(key.ptr, key.size, iv.ptr);
|
||||
decryption.ProcessData(data_out.ptr, data_inp.ptr, data_inp.size);
|
||||
}
|
||||
else if (algorithm == CRYPT_METHOD::DES_CBC)
|
||||
{
|
||||
DES::Decryption desDecryption(key.ptr, key.size == 7 ? 8 : key.size);
|
||||
StreamTransformation *modeDecryption = new CipherModeFinalTemplate_ExternalCipher<CBC_Decryption>(desDecryption, iv.ptr );
|
||||
StreamTransformationFilter stfDecryptor(*modeDecryption, new ArraySink( data_out.ptr, data_out.size), padding);
|
||||
|
||||
stfDecryptor.Put( data_inp.ptr, data_inp.size );
|
||||
stfDecryptor.MessageEnd();
|
||||
|
||||
delete modeDecryption;
|
||||
}
|
||||
else if (algorithm == CRYPT_METHOD::DES_ECB)
|
||||
{
|
||||
DES::Decryption desDecryption(key.ptr, key.size == 7 ? 8 : key.size);
|
||||
StreamTransformation *modeDecryption = new CipherModeFinalTemplate_ExternalCipher<ECB_OneWay>(desDecryption, iv.ptr );
|
||||
StreamTransformationFilter stfDecryptor(*modeDecryption, new ArraySink( data_out.ptr, data_out.size), padding);
|
||||
|
||||
stfDecryptor.Put( data_inp.ptr, data_inp.size );
|
||||
stfDecryptor.MessageEnd();
|
||||
|
||||
delete modeDecryption;
|
||||
}
|
||||
else //AES
|
||||
{
|
||||
StreamTransformation *modeDecryption = NULL;
|
||||
@ -504,13 +568,20 @@ bool ECMADecryptor::SetPassword(std::wstring _password)
|
||||
_buf verifierInputKey = GenerateAgileKey( pSalt, pPassword, pInputBlockKey, cryptData.keySize, cryptData.spinCount, cryptData.hashAlgorithm );
|
||||
_buf verifierHashKey = GenerateAgileKey( pSalt, pPassword, pValueBlockKey, cryptData.keySize, cryptData.spinCount, cryptData.hashAlgorithm );
|
||||
|
||||
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
|
||||
{
|
||||
rc4Decryption.SetKey(verifierInputKey.ptr, verifierInputKey.size);
|
||||
}
|
||||
//--------------------------------------------
|
||||
_buf decryptedVerifierHashInputBytes;
|
||||
DecryptCipher(verifierInputKey, pSalt, pEncVerInput, decryptedVerifierHashInputBytes, cryptData.cipherAlgorithm);
|
||||
//--------------------------------------------
|
||||
_buf hashBuf = HashAppend(decryptedVerifierHashInputBytes, empty, cryptData.hashAlgorithm);
|
||||
//--------------------------------------------
|
||||
|
||||
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
|
||||
{
|
||||
rc4Decryption.SetKey(verifierHashKey.ptr, verifierHashKey.size);
|
||||
}
|
||||
_buf decryptedVerifierHashBytes;
|
||||
DecryptCipher(verifierHashKey, pSalt, pEncVerValue, decryptedVerifierHashBytes, cryptData.cipherAlgorithm);
|
||||
//--------------------------------------------
|
||||
@ -518,10 +589,7 @@ bool ECMADecryptor::SetPassword(std::wstring _password)
|
||||
}
|
||||
else
|
||||
{
|
||||
_buf verifierKey = GenerateHashKey(pSalt, pPassword, cryptData.hashSize, cryptData.spinCount, cryptData.hashAlgorithm);
|
||||
CorrectHashSize(verifierKey, cryptData.keySize, 0);
|
||||
if (cryptData.keySize == 5)
|
||||
CorrectHashSize(verifierKey, 16, 0); //40-bit crypt key !!!
|
||||
_buf verifierKey = GenerateHashKey(pSalt, pPassword, cryptData.hashSize, cryptData.keySize, cryptData.spinCount, cryptData.hashAlgorithm);
|
||||
|
||||
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
|
||||
{
|
||||
@ -538,7 +606,7 @@ bool ECMADecryptor::SetPassword(std::wstring _password)
|
||||
_buf decryptedVerifierHashBytes;
|
||||
DecryptCipher(verifierKey, pSalt, pEncVerValue, decryptedVerifierHashBytes, cryptData.cipherAlgorithm);
|
||||
|
||||
bVerify = (decryptedVerifierHashBytes==hashBuf);
|
||||
bVerify = (decryptedVerifierHashBytes == hashBuf);
|
||||
}
|
||||
return bVerify;
|
||||
}
|
||||
@ -587,11 +655,8 @@ void ECMADecryptor::Decrypt(char* data , const size_t size, const unsigned long
|
||||
_buf pPassword (password);
|
||||
_buf pSalt (cryptData.saltValue);
|
||||
|
||||
_buf hashKey = GenerateHashKey(pSalt, pPassword, cryptData.hashSize, cryptData.spinCount, cryptData.hashAlgorithm, block_index);
|
||||
CorrectHashSize(hashKey, cryptData.keySize, 0);
|
||||
_buf hashKey = GenerateHashKey(pSalt, pPassword, cryptData.hashSize, cryptData.keySize, cryptData.spinCount, cryptData.hashAlgorithm, block_index);
|
||||
|
||||
if (cryptData.keySize == 5) CorrectHashSize(hashKey, 16, 0); //40-bit crypt key !!!
|
||||
|
||||
rc4Decryption.SetKey(hashKey.ptr, hashKey.size);
|
||||
}
|
||||
|
||||
@ -681,6 +746,10 @@ void ECMADecryptor::Decrypt(unsigned char* data_inp, int size, unsigned char*&
|
||||
|
||||
_buf agileKey = GenerateAgileKey( pSalt, pPassword, pBlockKey, cryptData.keySize, cryptData.spinCount, cryptData.hashAlgorithm);
|
||||
|
||||
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
|
||||
{
|
||||
rc4Decryption.SetKey(agileKey.ptr, agileKey.size);
|
||||
}
|
||||
_buf pDecryptedKey;
|
||||
DecryptCipher( agileKey, pSalt, pKeyValue, pDecryptedKey, cryptData.cipherAlgorithm);
|
||||
|
||||
@ -688,6 +757,10 @@ void ECMADecryptor::Decrypt(unsigned char* data_inp, int size, unsigned char*&
|
||||
|
||||
int i = start_iv_block, sz = 4096, pos = 0;//aes block size = 4096
|
||||
|
||||
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
|
||||
{
|
||||
rc4Decryption.SetKey(pDecryptedKey.ptr, pDecryptedKey.size);
|
||||
}
|
||||
while (pos < size)
|
||||
{
|
||||
if (pos + sz > size)
|
||||
@ -708,14 +781,10 @@ void ECMADecryptor::Decrypt(unsigned char* data_inp, int size, unsigned char*&
|
||||
}
|
||||
else
|
||||
{
|
||||
_buf hashKey = GenerateHashKey(pSalt, pPassword, cryptData.hashSize, cryptData.spinCount, cryptData.hashAlgorithm, start_iv_block);
|
||||
CorrectHashSize(hashKey, cryptData.keySize, 0);
|
||||
_buf hashKey = GenerateHashKey(pSalt, pPassword, cryptData.hashSize, cryptData.keySize, cryptData.spinCount, cryptData.hashAlgorithm, start_iv_block);
|
||||
|
||||
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
|
||||
{
|
||||
if (cryptData.keySize == 5)
|
||||
CorrectHashSize(hashKey, 16, 0); //40-bit crypt key !!!
|
||||
|
||||
{
|
||||
rc4Decryption.SetKey(hashKey.ptr, hashKey.size);
|
||||
}
|
||||
|
||||
@ -759,40 +828,85 @@ void ECMAEncryptor::SetPassword(std::wstring _password)
|
||||
//---------
|
||||
_buf pPassword (password);
|
||||
_buf empty (NULL, 0, false);
|
||||
|
||||
_buf pBlockKey ((unsigned char*)encrKeyValueBlockKey, 8);
|
||||
_buf pInputBlockKey ((unsigned char*)encrVerifierHashInputBlockKey, 8);
|
||||
_buf pValueBlockKey ((unsigned char*)encrVerifierHashValueBlockKey, 8);
|
||||
|
||||
|
||||
_buf pSalt (seed_salt.data(), seed_salt.size());
|
||||
_buf pDataSalt (seed_datasalt.data(), seed_datasalt.size());
|
||||
_buf pDecryptedKey (seed_key.data(), seed_key.size());
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
_buf agileKey = GenerateAgileKey( pSalt, pPassword, pBlockKey, cryptData.keySize, cryptData.spinCount, cryptData.hashAlgorithm);
|
||||
if (cryptData.bAgile == true)
|
||||
{
|
||||
_buf pBlockKey ((unsigned char*)encrKeyValueBlockKey, 8);
|
||||
_buf pInputBlockKey ((unsigned char*)encrVerifierHashInputBlockKey, 8);
|
||||
_buf pValueBlockKey ((unsigned char*)encrVerifierHashValueBlockKey, 8);
|
||||
|
||||
_buf agileKey = GenerateAgileKey( pSalt, pPassword, pBlockKey, cryptData.keySize, cryptData.spinCount, cryptData.hashAlgorithm);
|
||||
|
||||
_buf pKeyValue;
|
||||
EncryptCipher( agileKey, pSalt, pDecryptedKey, pKeyValue, cryptData.cipherAlgorithm);
|
||||
|
||||
//--------------------------------------------
|
||||
_buf decryptedVerifierHashInputBytes(seed_verify.data(), seed_verify.size());
|
||||
_buf verifierInputKey = GenerateAgileKey( pSalt, pPassword, pInputBlockKey, cryptData.keySize, cryptData.spinCount, cryptData.hashAlgorithm );
|
||||
|
||||
_buf pEncVerInput;
|
||||
EncryptCipher( verifierInputKey, pSalt, decryptedVerifierHashInputBytes, pEncVerInput, cryptData.cipherAlgorithm);
|
||||
//--------------------------------------------
|
||||
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
|
||||
{
|
||||
rc4Encryption.SetKey(agileKey.ptr, agileKey.size);
|
||||
}
|
||||
_buf pKeyValue;
|
||||
EncryptCipher( agileKey, pSalt, pDecryptedKey, pKeyValue, cryptData.cipherAlgorithm);
|
||||
|
||||
//--------------------------------------------
|
||||
_buf decryptedVerifierHashInputBytes(seed_verify.data(), seed_verify.size());
|
||||
_buf verifierInputKey = GenerateAgileKey( pSalt, pPassword, pInputBlockKey, cryptData.keySize, cryptData.spinCount, cryptData.hashAlgorithm );
|
||||
|
||||
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
|
||||
{
|
||||
rc4Encryption.SetKey(verifierInputKey.ptr, verifierInputKey.size);
|
||||
}
|
||||
_buf pEncVerInput;
|
||||
EncryptCipher( verifierInputKey, pSalt, decryptedVerifierHashInputBytes, pEncVerInput, cryptData.cipherAlgorithm);
|
||||
//--------------------------------------------
|
||||
|
||||
_buf decryptedVerifierHashBytes = HashAppend(decryptedVerifierHashInputBytes, empty, cryptData.hashAlgorithm);
|
||||
_buf verifierHashKey = GenerateAgileKey(pSalt, pPassword, pValueBlockKey, cryptData.keySize, cryptData.spinCount, cryptData.hashAlgorithm);
|
||||
|
||||
_buf pEncVerValue;
|
||||
EncryptCipher( verifierHashKey, pSalt, decryptedVerifierHashBytes, pEncVerValue, cryptData.cipherAlgorithm);
|
||||
_buf decryptedVerifierHashBytes = HashAppend(decryptedVerifierHashInputBytes, empty, cryptData.hashAlgorithm);
|
||||
_buf verifierHashKey = GenerateAgileKey(pSalt, pPassword, pValueBlockKey, cryptData.keySize, cryptData.spinCount, cryptData.hashAlgorithm);
|
||||
|
||||
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
|
||||
{
|
||||
rc4Encryption.SetKey(verifierHashKey.ptr, verifierHashKey.size);
|
||||
}
|
||||
else if (decryptedVerifierHashBytes.size % PADDING_SIZE != 0)
|
||||
{
|
||||
CorrectHashSize(decryptedVerifierHashBytes, (decryptedVerifierHashBytes.size / PADDING_SIZE + 1) * PADDING_SIZE, 0);
|
||||
}
|
||||
_buf pEncVerValue;
|
||||
EncryptCipher( verifierHashKey, pSalt, decryptedVerifierHashBytes, pEncVerValue, cryptData.cipherAlgorithm);
|
||||
|
||||
cryptData.saltValue = std::string((char*)pSalt.ptr, pSalt.size);
|
||||
cryptData.dataSaltValue = std::string((char*)pDataSalt.ptr, pDataSalt.size);
|
||||
cryptData.encryptedKeyValue = std::string((char*)pKeyValue.ptr, pKeyValue.size);
|
||||
cryptData.encryptedVerifierInput = std::string((char*)pEncVerInput.ptr, pEncVerInput.size);
|
||||
cryptData.encryptedVerifierValue = std::string((char*)pEncVerValue.ptr, pEncVerValue.size);
|
||||
cryptData.saltValue = std::string((char*)pSalt.ptr, pSalt.size);
|
||||
cryptData.dataSaltValue = std::string((char*)pDataSalt.ptr, pDataSalt.size);
|
||||
cryptData.encryptedKeyValue = std::string((char*)pKeyValue.ptr, pKeyValue.size);
|
||||
cryptData.encryptedVerifierInput = std::string((char*)pEncVerInput.ptr, pEncVerInput.size);
|
||||
cryptData.encryptedVerifierValue = std::string((char*)pEncVerValue.ptr, pEncVerValue.size);
|
||||
}
|
||||
else
|
||||
{
|
||||
_buf verifierKey = GenerateHashKey(pSalt, pPassword, cryptData.hashSize, cryptData.keySize, cryptData.spinCount, cryptData.hashAlgorithm);
|
||||
|
||||
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
|
||||
{
|
||||
rc4Encryption.SetKey(verifierKey.ptr, verifierKey.size);
|
||||
}
|
||||
_buf decryptedVerInput(seed_verify.data(), seed_verify.size());
|
||||
|
||||
_buf pEncVerInput;
|
||||
EncryptCipher( verifierKey, pSalt, decryptedVerInput, pEncVerInput, cryptData.cipherAlgorithm);
|
||||
|
||||
_buf hashBuf = HashAppend(decryptedVerInput, empty, cryptData.hashAlgorithm);
|
||||
if (cryptData.cipherAlgorithm != CRYPT_METHOD::RC4 && hashBuf.size % PADDING_SIZE != 0)
|
||||
{
|
||||
CorrectHashSize(hashBuf, (hashBuf.size / PADDING_SIZE + 1) * PADDING_SIZE, 0);
|
||||
}
|
||||
|
||||
_buf pEncVerValue;
|
||||
EncryptCipher( verifierKey, pSalt, hashBuf, pEncVerValue, cryptData.cipherAlgorithm);
|
||||
|
||||
cryptData.saltValue = std::string((char*)pSalt.ptr, pSalt.size);
|
||||
cryptData.encryptedVerifierInput = std::string((char*)pEncVerInput.ptr, pEncVerInput.size);
|
||||
cryptData.encryptedVerifierValue = std::string((char*)pEncVerValue.ptr, pEncVerValue.size);
|
||||
}
|
||||
}
|
||||
|
||||
void ECMAEncryptor::SetCryptData(_ecmaCryptData & data)
|
||||
@ -823,6 +937,11 @@ void ECMAEncryptor::UpdateDataIntegrity(unsigned char* data, int size)
|
||||
//----
|
||||
_buf agileKey = GenerateAgileKey( pSalt, pPassword, pBlockKey, cryptData.keySize, cryptData.spinCount, cryptData.hashAlgorithm);
|
||||
|
||||
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
|
||||
{
|
||||
rc4Encryption.SetKey(agileKey.ptr, agileKey.size);
|
||||
}
|
||||
|
||||
_buf secretKey;
|
||||
DecryptCipher( agileKey, pSalt, pKeyValue, secretKey, cryptData.cipherAlgorithm);
|
||||
|
||||
@ -844,16 +963,28 @@ void ECMAEncryptor::UpdateDataIntegrity(unsigned char* data, int size)
|
||||
std::string sData((char*)data, size);
|
||||
_buf hmac = Hmac(pSaltHmac, cryptData.hashAlgorithm, sData);
|
||||
|
||||
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
|
||||
{
|
||||
rc4Encryption.SetKey(secretKey.ptr, secretKey.size);
|
||||
}
|
||||
if (pSaltHmac.size % PADDING_SIZE != 0)
|
||||
{
|
||||
CorrectHashSize(pSaltHmac, (pSaltHmac.size / PADDING_SIZE + 1) * PADDING_SIZE, 0);
|
||||
}
|
||||
_buf pEncHmacKey;
|
||||
EncryptCipher(secretKey, iv1, pSaltHmac, pEncHmacKey, cryptData.cipherAlgorithm);
|
||||
|
||||
if (hmac.size % PADDING_SIZE != 0)
|
||||
{
|
||||
CorrectHashSize(hmac, (hmac.size / PADDING_SIZE + 1) * PADDING_SIZE, 0);
|
||||
}
|
||||
_buf pEncHmacValue;
|
||||
EncryptCipher(secretKey, iv2, hmac, pEncHmacValue, cryptData.cipherAlgorithm);
|
||||
|
||||
cryptData.encryptedHmacKey = std::string((char*)pEncHmacKey.ptr, pEncHmacKey.size);
|
||||
cryptData.encryptedHmacValue = std::string((char*)pEncHmacValue.ptr, pEncHmacValue.size);
|
||||
}
|
||||
#define PADDING_SIZE 16 // 8
|
||||
|
||||
int ECMAEncryptor::Encrypt(unsigned char* data_inp_ptr, int size, unsigned char*& data_out_ptr)
|
||||
{
|
||||
data_out_ptr = NULL;
|
||||
@ -863,7 +994,8 @@ int ECMAEncryptor::Encrypt(unsigned char* data_inp_ptr, int size, unsigned char*
|
||||
_buf empty (NULL, 0, false);
|
||||
|
||||
int size_out = size;
|
||||
if (size_out % PADDING_SIZE != 0)
|
||||
|
||||
if (cryptData.cipherAlgorithm != CRYPT_METHOD::RC4 && size_out % PADDING_SIZE != 0)
|
||||
size_out = (size_out / PADDING_SIZE + 1) * PADDING_SIZE;
|
||||
|
||||
data_out_ptr = new unsigned char[size_out + PADDING_SIZE]; // real size + padding + size for realsize
|
||||
@ -873,63 +1005,90 @@ int ECMAEncryptor::Encrypt(unsigned char* data_inp_ptr, int size, unsigned char*
|
||||
|
||||
unsigned char* data_inp = data_inp_ptr;
|
||||
unsigned char* data_out = data_out_ptr + 8;
|
||||
|
||||
_buf pBlockKey ((unsigned char*)encrKeyValueBlockKey, 8);
|
||||
_buf pDataSalt (cryptData.dataSaltValue);
|
||||
_buf pKeyValue (cryptData.encryptedKeyValue);
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
_buf agileKey = GenerateAgileKey( pSalt, pPassword, pBlockKey, cryptData.keySize, cryptData.spinCount, cryptData.hashAlgorithm);
|
||||
|
||||
_buf pDecryptedKey;
|
||||
DecryptCipher( agileKey, pSalt, pKeyValue, pDecryptedKey, cryptData.cipherAlgorithm);
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
_buf iv(cryptData.blockSize, true);
|
||||
|
||||
int i = 0, sz = 4096, enc_size = 0;
|
||||
|
||||
while (enc_size < size)
|
||||
{
|
||||
if (enc_size + sz > size)
|
||||
{
|
||||
sz = size - enc_size;
|
||||
}
|
||||
if (cryptData.bAgile)
|
||||
{
|
||||
_buf pBlockKey ((unsigned char*)encrKeyValueBlockKey, 8);
|
||||
_buf pDataSalt (cryptData.dataSaltValue);
|
||||
_buf pKeyValue (cryptData.encryptedKeyValue);
|
||||
|
||||
_buf pIndex((unsigned char*)&i, 4);
|
||||
iv = HashAppend(pDataSalt, pIndex, cryptData.hashAlgorithm);
|
||||
//------------------------------------------------------------------------------------------------
|
||||
_buf agileKey = GenerateAgileKey( pSalt, pPassword, pBlockKey, cryptData.keySize, cryptData.spinCount, cryptData.hashAlgorithm);
|
||||
|
||||
CorrectHashSize(iv, cryptData.blockSize, 0x36);
|
||||
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
|
||||
{
|
||||
rc4Decryption.SetKey(agileKey.ptr, agileKey.size);
|
||||
}
|
||||
_buf pDecryptedKey;
|
||||
DecryptCipher( agileKey, pSalt, pKeyValue, pDecryptedKey, cryptData.cipherAlgorithm);
|
||||
|
||||
if (sz < 4096)
|
||||
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
|
||||
{
|
||||
_buf pInp(4096);
|
||||
memcpy(pInp.ptr, data_inp, sz );
|
||||
pInp.size = sz;
|
||||
_buf pOut(4096);
|
||||
|
||||
EncryptCipher(pDecryptedKey, iv, pInp, pOut, cryptData.cipherAlgorithm);
|
||||
|
||||
if (sz % PADDING_SIZE != 0)
|
||||
sz = (sz / PADDING_SIZE + 1) * PADDING_SIZE;
|
||||
|
||||
memcpy(data_out, pOut.ptr, sz);
|
||||
|
||||
rc4Encryption.SetKey(pDecryptedKey.ptr, agileKey.size);
|
||||
}
|
||||
else
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
_buf iv(cryptData.blockSize, true);
|
||||
|
||||
int i = 0, sz = 4096, enc_size = 0;
|
||||
|
||||
while (enc_size < size)
|
||||
{
|
||||
_buf pInp(data_inp, sz, false);
|
||||
_buf pOut(data_out, sz, false);
|
||||
if (enc_size + sz > size)
|
||||
{
|
||||
sz = size - enc_size;
|
||||
}
|
||||
|
||||
EncryptCipher(pDecryptedKey, iv, pInp, pOut, cryptData.cipherAlgorithm);
|
||||
}
|
||||
data_inp += sz;
|
||||
data_out += sz;
|
||||
_buf pIndex((unsigned char*)&i, 4);
|
||||
iv = HashAppend(pDataSalt, pIndex, cryptData.hashAlgorithm);
|
||||
|
||||
enc_size += sz; i++;
|
||||
CorrectHashSize(iv, cryptData.blockSize, 0x36);
|
||||
|
||||
if (sz < 4096)
|
||||
{
|
||||
_buf pInp(4096);
|
||||
memcpy(pInp.ptr, data_inp, sz );
|
||||
pInp.size = sz;
|
||||
_buf pOut(4096);
|
||||
|
||||
EncryptCipher(pDecryptedKey, iv, pInp, pOut, cryptData.cipherAlgorithm);
|
||||
|
||||
if (sz % PADDING_SIZE != 0)
|
||||
sz = (sz / PADDING_SIZE + 1) * PADDING_SIZE;
|
||||
|
||||
memcpy(data_out, pOut.ptr, sz);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
_buf pInp(data_inp, sz, false);
|
||||
_buf pOut(data_out, sz, false);
|
||||
|
||||
EncryptCipher(pDecryptedKey, iv, pInp, pOut, cryptData.cipherAlgorithm);
|
||||
}
|
||||
data_inp += sz;
|
||||
data_out += sz;
|
||||
|
||||
enc_size += sz; i++;
|
||||
}
|
||||
return enc_size + 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
_buf hashKey = GenerateHashKey(pSalt, pPassword, cryptData.hashSize, cryptData.keySize, cryptData.spinCount, cryptData.hashAlgorithm);
|
||||
|
||||
if (cryptData.cipherAlgorithm == CRYPT_METHOD::RC4)
|
||||
{
|
||||
rc4Decryption.SetKey(hashKey.ptr, hashKey.size);
|
||||
rc4Encryption.SetKey(hashKey.ptr, hashKey.size);
|
||||
}
|
||||
|
||||
_buf pInp(data_inp, size, false);
|
||||
_buf pOut(data_out, size_out, false);
|
||||
|
||||
return enc_size + 8;
|
||||
EncryptCipher(hashKey, empty, pInp, pOut, cryptData.cipherAlgorithm/*, StreamTransformationFilter::ZEROS_PADDING*/);
|
||||
|
||||
return size_out + 8;
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
ODFDecryptor::ODFDecryptor()
|
||||
|
||||
@ -55,7 +55,9 @@ namespace CRYPT_METHOD
|
||||
AES_CBC,
|
||||
AES_CFB,
|
||||
AES_ECB,
|
||||
Blowfish_CFB
|
||||
Blowfish_CFB,
|
||||
DES_CBC,
|
||||
DES_ECB
|
||||
};
|
||||
}
|
||||
namespace CRYPT
|
||||
|
||||
@ -46,7 +46,8 @@
|
||||
|
||||
using namespace CRYPT;
|
||||
|
||||
#define GETBIT(from, num) ((from & (1 << num)) != 0)
|
||||
#define GETBIT(from, num) ((from & (1 << num)) != 0)
|
||||
#define SETBIT(to, num, setorclear) {setorclear ? to |= (1 << num) : to &= ~(1 << num);}
|
||||
|
||||
#define WritingElement_ReadAttributes_Start(Reader) \
|
||||
if ( Reader.GetAttributesCount() <= 0 )\
|
||||
@ -291,7 +292,14 @@ bool ReadXmlEncryptionInfo(const std::string & xml_string, _ecmaCryptData & cryp
|
||||
if (keyData.cipherChaining == "ChainingModeCBC") cryptData.cipherAlgorithm = CRYPT_METHOD::AES_CBC;
|
||||
if (keyData.cipherChaining == "ChainingModeCFB") cryptData.cipherAlgorithm = CRYPT_METHOD::AES_CFB;
|
||||
}
|
||||
|
||||
else if (keyData.cipherAlgorithm == "RC4")
|
||||
{
|
||||
cryptData.cipherAlgorithm = CRYPT_METHOD::RC4;
|
||||
}
|
||||
else if (keyData.cipherAlgorithm == "DES")
|
||||
{
|
||||
cryptData.cipherAlgorithm = CRYPT_METHOD::DES_ECB;
|
||||
}
|
||||
if (keyData.hashAlgorithm == "SHA1") cryptData.hashAlgorithm = CRYPT_METHOD::SHA1;
|
||||
if (keyData.hashAlgorithm == "SHA224") cryptData.hashAlgorithm = CRYPT_METHOD::SHA224;
|
||||
if (keyData.hashAlgorithm == "SHA256") cryptData.hashAlgorithm = CRYPT_METHOD::SHA256;
|
||||
@ -315,12 +323,33 @@ bool WriteXmlEncryptionInfo(const _ecmaCryptData & cryptData, std::string & xml_
|
||||
keyData.keyBits = std::to_string(cryptData.keySize * 8);
|
||||
keyData.saltValue = EncodeBase64(cryptData.dataSaltValue);
|
||||
|
||||
keyData.cipherAlgorithm = "AES";
|
||||
|
||||
if (keyData.cipherAlgorithm == "AES")
|
||||
switch(cryptData.cipherAlgorithm)
|
||||
{
|
||||
if (cryptData.cipherAlgorithm == CRYPT_METHOD::AES_CBC) keyData.cipherChaining = "ChainingModeCBC";
|
||||
if (cryptData.cipherAlgorithm == CRYPT_METHOD::AES_CFB) keyData.cipherChaining = "ChainingModeCFB";
|
||||
case CRYPT_METHOD::RC4:
|
||||
keyData.cipherAlgorithm = "RC4";
|
||||
break;
|
||||
case CRYPT_METHOD::AES_CBC:
|
||||
keyData.cipherAlgorithm = "AES";
|
||||
keyData.cipherChaining = "ChainingModeCBC";
|
||||
break;
|
||||
case CRYPT_METHOD::AES_ECB:
|
||||
keyData.cipherAlgorithm = "AES";
|
||||
keyData.cipherChaining = "ChainingModeECB";
|
||||
break;
|
||||
case CRYPT_METHOD::AES_CFB:
|
||||
keyData.cipherAlgorithm = "AES";
|
||||
keyData.cipherChaining = "ChainingModeCFB";
|
||||
break;
|
||||
case CRYPT_METHOD::DES_CBC:
|
||||
keyData.cipherAlgorithm = "DES";
|
||||
keyData.cipherChaining = "ChainingModeCBC";
|
||||
break;
|
||||
case CRYPT_METHOD::DES_ECB:
|
||||
keyData.cipherAlgorithm = "DES";
|
||||
keyData.cipherChaining = "ChainingModeECB";
|
||||
break;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
switch(cryptData.hashAlgorithm)
|
||||
@ -360,7 +389,12 @@ bool WriteXmlEncryptionInfo(const _ecmaCryptData & cryptData, std::string & xml_
|
||||
CP_XML_ATTR("keyBits", keyData.keyBits);
|
||||
CP_XML_ATTR("hashSize", keyData.hashSize);
|
||||
CP_XML_ATTR("cipherAlgorithm", keyData.cipherAlgorithm);
|
||||
CP_XML_ATTR("cipherChaining", keyData.cipherChaining);
|
||||
|
||||
if (false == keyData.cipherChaining.empty())
|
||||
{
|
||||
CP_XML_ATTR("cipherChaining", keyData.cipherChaining);
|
||||
}
|
||||
|
||||
CP_XML_ATTR("hashAlgorithm", keyData.hashAlgorithm);
|
||||
CP_XML_ATTR("saltValue", keyData.saltValue);
|
||||
}
|
||||
@ -400,7 +434,90 @@ bool WriteXmlEncryptionInfo(const _ecmaCryptData & cryptData, std::string & xml_
|
||||
|
||||
return true;
|
||||
}
|
||||
bool WriteStandartEncryptionInfo(unsigned char* data, int &size, _ecmaCryptData & cryptData)
|
||||
{
|
||||
if (!data || size < 1) return false;
|
||||
MemoryStream mem_stream(data, size, false);
|
||||
|
||||
_UINT32 SizeHeader = 0, Flags = 0, SizeExtra = 0, AlgID = 0, AlgIDHash = 0, KeySize = 0, ProviderType = 0, Reserved1 = 0, Reserved2 = 0;
|
||||
|
||||
bool fCryptoAPI = true, fDocProps = false, fExternal = false, fAES = cryptData.cipherAlgorithm != CRYPT_METHOD::RC4;
|
||||
|
||||
SETBIT(Flags, 2, fCryptoAPI);
|
||||
SETBIT(Flags, 3, fDocProps);
|
||||
SETBIT(Flags, 4, fExternal);
|
||||
SETBIT(Flags, 5, fAES);
|
||||
|
||||
mem_stream.WriteUInt32(SizeHeader);
|
||||
|
||||
KeySize = (cryptData.keySize == 5) ? 0 : cryptData.keySize * 8;
|
||||
|
||||
switch(cryptData.cipherAlgorithm)
|
||||
{
|
||||
case CRYPT_METHOD::RC4:
|
||||
{
|
||||
ProviderType = 0x0001;
|
||||
AlgID = 0x6801;
|
||||
}break;
|
||||
case CRYPT_METHOD::AES_ECB:
|
||||
case CRYPT_METHOD::AES_CBC:
|
||||
{
|
||||
ProviderType = 0x0018;
|
||||
switch(KeySize)
|
||||
{
|
||||
case 128: AlgID = 0x660E; break;
|
||||
case 192: AlgID = 0x660F; break;
|
||||
case 256: AlgID = 0x6610; break;
|
||||
}
|
||||
break;
|
||||
}break;
|
||||
}
|
||||
switch(cryptData.hashAlgorithm)
|
||||
{
|
||||
case CRYPT_METHOD::MD5: AlgIDHash = 0x8003; break;
|
||||
case CRYPT_METHOD::SHA1: AlgIDHash = 0x8004; break;
|
||||
}
|
||||
|
||||
mem_stream.WriteUInt32(Flags);
|
||||
mem_stream.WriteUInt32(SizeExtra);
|
||||
mem_stream.WriteUInt32(AlgID);
|
||||
mem_stream.WriteUInt32(AlgIDHash);
|
||||
mem_stream.WriteUInt32(KeySize);
|
||||
mem_stream.WriteUInt32(ProviderType);
|
||||
mem_stream.WriteUInt32(Reserved1);
|
||||
mem_stream.WriteUInt32(Reserved2);
|
||||
|
||||
std::string provider = "Microsoft Enhanced RSA and AES Cryptographic Provider";// to utf16
|
||||
|
||||
for (size_t i = 0; i < provider.length(); ++i)
|
||||
{
|
||||
mem_stream.WriteByte((unsigned char)provider[i]);
|
||||
mem_stream.WriteByte((unsigned char)0);
|
||||
}
|
||||
mem_stream.WriteByte((unsigned char)0); //null terminate
|
||||
mem_stream.WriteByte((unsigned char)0);
|
||||
|
||||
SizeHeader = mem_stream.GetPosition() - 4;
|
||||
|
||||
//EncryptionVerifier
|
||||
mem_stream.WriteUInt32((_UINT32)cryptData.saltSize);
|
||||
|
||||
mem_stream.WriteBytes((unsigned char*)cryptData.saltValue.c_str(), cryptData.saltSize);
|
||||
|
||||
mem_stream.WriteBytes((unsigned char*)cryptData.encryptedVerifierInput.c_str(), 0x10);
|
||||
|
||||
mem_stream.WriteUInt32((_UINT32)cryptData.hashSize);
|
||||
|
||||
int szEncryptedVerifierHash = (ProviderType == 0x0001) ? 0x14 : 0x20; //RC4 | AES
|
||||
mem_stream.WriteBytes((unsigned char*)cryptData.encryptedVerifierValue.c_str(), szEncryptedVerifierHash);
|
||||
|
||||
size = mem_stream.GetPosition();
|
||||
|
||||
mem_stream.Seek(0);
|
||||
mem_stream.WriteUInt32(SizeHeader);
|
||||
|
||||
return true;
|
||||
}
|
||||
bool ReadStandartEncryptionInfo(unsigned char* data, int size, _ecmaCryptData & cryptData)
|
||||
{
|
||||
if (!data || size < 1) return false;
|
||||
@ -445,21 +562,29 @@ bool ReadStandartEncryptionInfo(unsigned char* data, int size, _ecmaCryptData &
|
||||
|
||||
cryptData.hashSize = mem_stream.ReadUInt32();
|
||||
|
||||
int szEncryptedVerifierHash = (ProviderType == 0x0001) ? 0x14 : 0x20;
|
||||
int szEncryptedVerifierHash = (ProviderType == 0x0001) ? 0x14 : 0x20; // RC4 | AES
|
||||
cryptData.encryptedVerifierValue = std::string((char*)data + mem_stream.GetPosition(), szEncryptedVerifierHash);
|
||||
mem_stream.ReadBytes(szEncryptedVerifierHash, false);
|
||||
|
||||
pos = mem_stream.GetPosition();
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
cryptData.hashAlgorithm = CRYPT_METHOD::SHA1; //by AlgIDHash -> 0x0000 || 0x8004
|
||||
cryptData.spinCount = 50000;
|
||||
switch(AlgIDHash)
|
||||
{
|
||||
case 0x8003:
|
||||
cryptData.hashAlgorithm = CRYPT_METHOD::MD5; break;
|
||||
case 0x0000:
|
||||
case 0x8004:
|
||||
cryptData.hashAlgorithm = CRYPT_METHOD::SHA1; break;
|
||||
}
|
||||
cryptData.spinCount = 50000;
|
||||
|
||||
switch(AlgID)
|
||||
{
|
||||
case 0x6801:
|
||||
cryptData.cipherAlgorithm = CRYPT_METHOD::RC4;
|
||||
cryptData.keySize = KeySize / 8;
|
||||
if (KeySize == 0) cryptData.keySize = 5; //40 bit
|
||||
else cryptData.keySize = KeySize / 8;
|
||||
break;
|
||||
case 0x660E:
|
||||
cryptData.cipherAlgorithm = CRYPT_METHOD::AES_ECB;
|
||||
@ -488,12 +613,44 @@ bool ECMACryptFile::EncryptOfficeFile(const std::wstring &file_name_inp, const s
|
||||
{
|
||||
_ecmaCryptData cryptData;
|
||||
|
||||
cryptData.bAgile = true;
|
||||
cryptData.hashAlgorithm = CRYPT_METHOD::SHA512;
|
||||
cryptData.keySize = 0x20;
|
||||
cryptData.hashSize = 0x40;
|
||||
cryptData.blockSize = 0x10;
|
||||
cryptData.saltSize = 0x10;
|
||||
//cryptData.bAgile = true;
|
||||
//cryptData.cipherAlgorithm = CRYPT_METHOD::DES_ECB;
|
||||
//cryptData.hashAlgorithm = CRYPT_METHOD::SHA512;
|
||||
//cryptData.keySize = 0x08;
|
||||
//cryptData.hashSize = 0x40;
|
||||
//cryptData.blockSize = 0x10;
|
||||
//cryptData.saltSize = 0x10;
|
||||
//cryptData.hashAlgorithm = CRYPT_METHOD::SHA1;
|
||||
//cryptData.keySize = 0x08;
|
||||
//cryptData.hashSize = 0x14;
|
||||
//cryptData.blockSize = 0x10;
|
||||
//cryptData.saltSize = 0x10;
|
||||
|
||||
cryptData.bAgile = true;
|
||||
cryptData.cipherAlgorithm = CRYPT_METHOD::AES_CBC;
|
||||
cryptData.hashAlgorithm = CRYPT_METHOD::SHA512;
|
||||
cryptData.keySize = 0x20;
|
||||
cryptData.hashSize = 0x40;
|
||||
cryptData.blockSize = 0x10;
|
||||
cryptData.saltSize = 0x10;
|
||||
|
||||
//cryptData.bAgile = false;
|
||||
//cryptData.cipherAlgorithm = CRYPT_METHOD::AES_ECB;
|
||||
//cryptData.hashAlgorithm = CRYPT_METHOD::SHA1;
|
||||
//cryptData.keySize = 0x10;
|
||||
//cryptData.hashSize = 0x14;
|
||||
//cryptData.blockSize = 0x10;
|
||||
//cryptData.saltSize = 0x10;
|
||||
//cryptData.spinCount = 50000;
|
||||
|
||||
//cryptData.bAgile = false;
|
||||
//cryptData.cipherAlgorithm = CRYPT_METHOD::RC4;
|
||||
//cryptData.hashAlgorithm = CRYPT_METHOD::SHA1;
|
||||
//cryptData.keySize = 7;
|
||||
//cryptData.hashSize = 0x14;
|
||||
//cryptData.blockSize = 0x10;
|
||||
//cryptData.saltSize = 0x10;
|
||||
//cryptData.spinCount = 50000;
|
||||
|
||||
ECMAEncryptor cryptor;
|
||||
|
||||
@ -539,22 +696,53 @@ bool ECMACryptFile::EncryptOfficeFile(const std::wstring &file_name_inp, const s
|
||||
|
||||
cryptor.GetCryptData(cryptData);
|
||||
|
||||
std::string strXml;
|
||||
WriteXmlEncryptionInfo(cryptData, strXml);
|
||||
if (cryptData.bAgile)
|
||||
{
|
||||
_UINT16 VersionInfoMajor = 0x0004, VersionInfoMinor = 0x0004; //agile
|
||||
|
||||
pStream->write((unsigned char*)&VersionInfoMajor, 2);
|
||||
pStream->write((unsigned char*)&VersionInfoMinor, 2);
|
||||
|
||||
_UINT16 VersionInfoMajor = 0x0004, VersionInfoMinor = 0x0004; //agile standart
|
||||
_UINT32 nEncryptionInfoFlags = 64;
|
||||
pStream->write((unsigned char*)&nEncryptionInfoFlags, 4);
|
||||
|
||||
std::string strXml;
|
||||
WriteXmlEncryptionInfo(cryptData, strXml);
|
||||
|
||||
pStream->write((unsigned char*)strXml.c_str(), strXml.length());
|
||||
|
||||
pStream->flush();
|
||||
delete pStream;
|
||||
}
|
||||
else
|
||||
{
|
||||
_UINT16 VersionInfoMajor = 0x0004, VersionInfoMinor = 0x0002; // standart
|
||||
|
||||
pStream->write((unsigned char*)&VersionInfoMajor, 2);
|
||||
pStream->write((unsigned char*)&VersionInfoMinor, 2);
|
||||
pStream->write((unsigned char*)&VersionInfoMajor, 2);
|
||||
pStream->write((unsigned char*)&VersionInfoMinor, 2);
|
||||
|
||||
_UINT32 nEncryptionInfoFlags = 64;
|
||||
pStream->write((unsigned char*)&nEncryptionInfoFlags, 4);
|
||||
|
||||
pStream->write((unsigned char*)strXml.c_str(), strXml.length());
|
||||
|
||||
pStream->flush();
|
||||
delete pStream;
|
||||
//-------------------------------------------------------------------
|
||||
_UINT32 nEncryptionInfoFlags = 0;
|
||||
bool fCryptoAPI = true, fDocProps = false, fExternal = false, fAES = cryptData.cipherAlgorithm != CRYPT_METHOD::RC4;
|
||||
|
||||
SETBIT(nEncryptionInfoFlags, 2, fCryptoAPI);
|
||||
SETBIT(nEncryptionInfoFlags, 3, fDocProps);
|
||||
SETBIT(nEncryptionInfoFlags, 4, fExternal);
|
||||
SETBIT(nEncryptionInfoFlags, 5, fAES);
|
||||
|
||||
pStream->write((unsigned char*)&nEncryptionInfoFlags, 4);
|
||||
|
||||
int nEncryptionInfoSize = 4096;
|
||||
unsigned char* byteEncryptionInfo = new unsigned char[nEncryptionInfoSize];
|
||||
|
||||
WriteStandartEncryptionInfo(byteEncryptionInfo, nEncryptionInfoSize, cryptData);
|
||||
|
||||
pStream->write(byteEncryptionInfo, nEncryptionInfoSize);
|
||||
delete []byteEncryptionInfo;
|
||||
|
||||
pStream->flush();
|
||||
delete pStream;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
pStream = new POLE::Stream(pStorage, L"EncryptedPackage", true, lengthData);
|
||||
|
||||
pStream->write(data_out, lengthData);
|
||||
@ -651,10 +839,10 @@ bool ECMACryptFile::DecryptOfficeFile(const std::wstring &file_name_inp, const s
|
||||
else
|
||||
{
|
||||
cryptData.bAgile = false;
|
||||
bool fCryptoAPI = GETBIT(nEncryptionInfoFlags, 1);
|
||||
bool fDocProps = GETBIT(nEncryptionInfoFlags, 2);
|
||||
bool fExternal = GETBIT(nEncryptionInfoFlags, 3);
|
||||
bool fAES = GETBIT(nEncryptionInfoFlags, 4);
|
||||
bool fCryptoAPI = GETBIT(nEncryptionInfoFlags, 2);
|
||||
bool fDocProps = GETBIT(nEncryptionInfoFlags, 3);
|
||||
bool fExternal = GETBIT(nEncryptionInfoFlags, 4);
|
||||
bool fAES = GETBIT(nEncryptionInfoFlags, 5);
|
||||
|
||||
if ((VersionInfoMajor == 0x0003 || VersionInfoMajor == 0x0004) && VersionInfoMinor == 0x0003) //extensible info
|
||||
{
|
||||
@ -676,28 +864,6 @@ bool ECMACryptFile::DecryptOfficeFile(const std::wstring &file_name_inp, const s
|
||||
delete pStorage;
|
||||
return false;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
//pStream = new POLE::Stream(pStorage, "DataSpaces/DataSpaceMap");
|
||||
//if (pStream)
|
||||
//{
|
||||
// delete pStream;
|
||||
// pStorage->deleteByName("DataSpaces");
|
||||
|
||||
// //_UINT32 size = 0;
|
||||
// //_UINT32 count = 0;
|
||||
// //
|
||||
// //pStream->read((unsigned char*)&size, 4);
|
||||
// //pStream->read((unsigned char*)&count, 4);
|
||||
|
||||
// //for (int i = 0 ; i < count; i++)
|
||||
// //{
|
||||
// // _mapEntry m;
|
||||
// // ReadMapEntry(pStream, m);
|
||||
|
||||
// // mapEntries.push_back(m);
|
||||
// //}
|
||||
// //delete pStream;
|
||||
//}
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
ECMADecryptor decryptor;
|
||||
|
||||
|
||||
@ -31,8 +31,6 @@
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
69676CA91CA58B7400D7A1D1 /* libOfficeUtils.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libOfficeUtils.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
69676CB61CA58BBD00D7A1D1 /* ASCOfficeCriticalSection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASCOfficeCriticalSection.h; sourceTree = "<group>"; };
|
||||
69676CB71CA58BBD00D7A1D1 /* CSLocker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSLocker.h; sourceTree = "<group>"; };
|
||||
69676CB81CA58BBD00D7A1D1 /* OfficeUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OfficeUtils.cpp; sourceTree = "<group>"; };
|
||||
69676CB91CA58BBD00D7A1D1 /* OfficeUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OfficeUtils.h; sourceTree = "<group>"; };
|
||||
69676CBA1CA58BBD00D7A1D1 /* OfficeUtilsCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OfficeUtilsCommon.h; sourceTree = "<group>"; };
|
||||
@ -81,8 +79,6 @@
|
||||
69676CB51CA58BBD00D7A1D1 /* src */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
69676CB61CA58BBD00D7A1D1 /* ASCOfficeCriticalSection.h */,
|
||||
69676CB71CA58BBD00D7A1D1 /* CSLocker.h */,
|
||||
69676CB81CA58BBD00D7A1D1 /* OfficeUtils.cpp */,
|
||||
69676CB91CA58BBD00D7A1D1 /* OfficeUtils.h */,
|
||||
69676CBA1CA58BBD00D7A1D1 /* OfficeUtilsCommon.h */,
|
||||
|
||||
@ -46,7 +46,7 @@ namespace NSUnicodeConverter
|
||||
const char* DisplayName;
|
||||
};
|
||||
|
||||
#define UNICODE_CONVERTER_ENCODINGS_COUNT 52
|
||||
#define UNICODE_CONVERTER_ENCODINGS_COUNT 53
|
||||
static const EncodindId Encodings[UNICODE_CONVERTER_ENCODINGS_COUNT] =
|
||||
{
|
||||
{ 0, 28596, "ISO-8859-6", "Arabic (ISO 8859-6)" },
|
||||
@ -118,7 +118,9 @@ namespace NSUnicodeConverter
|
||||
{ 49, 1201, "UTF-16BE", "Unicode (UTF-16 Big Endian)" },
|
||||
|
||||
{ 50, 12000, "UTF-32LE", "Unicode (UTF-32)" },
|
||||
{ 51, 12001, "UTF-32BE", "Unicode (UTF-32 Big Endian)" }
|
||||
{ 51, 12001, "UTF-32BE", "Unicode (UTF-32 Big Endian)" },
|
||||
{ 52, 950, "EUC-JP", "Japanese (EUC-JP)" }
|
||||
|
||||
};
|
||||
|
||||
static std::map<int, std::string> create_mapEncodingsICU()
|
||||
@ -161,6 +163,7 @@ namespace NSUnicodeConverter
|
||||
m[1255] = "windows-1255";
|
||||
|
||||
m[932] = "Shift_JIS";
|
||||
m[950] = "EUC-JP";
|
||||
|
||||
m[949] = "KS_C_5601-1987";
|
||||
m[51949] = "EUC-KR";
|
||||
|
||||
@ -24,7 +24,6 @@
|
||||
17C8DEC71ACD696100902C85 /* X2tConverter.mm in Sources */ = {isa = PBXBuildFile; fileRef = 17C27A191AC2DB3D00E1D003 /* X2tConverter.mm */; };
|
||||
17C8DECC1ACD696100902C85 /* X2tConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C27A171AC2DB3D00E1D003 /* X2tConverter.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
6911A9691F6036DA0061AB4D /* OfficeFileErrorDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = 6911A9681F6036DA0061AB4D /* OfficeFileErrorDescription.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
691A8BD31E2FA68F00DCB54A /* liblibxml2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 691A8BD01E2FA67E00DCB54A /* liblibxml2.a */; };
|
||||
69415F271CB51C37003E771B /* libOfficeUtils.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 69415F241CB51C2A003E771B /* libOfficeUtils.a */; };
|
||||
69415F311CB51D41003E771B /* libASCOfficeDocxFile2Lib_ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 17E17F5B1AC457CD00BEA2EA /* libASCOfficeDocxFile2Lib_ios.a */; };
|
||||
69415FE01CB52455003E771B /* libmng_ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 69415FD41CB5243F003E771B /* libmng_ios.a */; };
|
||||
@ -75,20 +74,6 @@
|
||||
remoteGlobalIDString = 17E17EDC1AC453F800BEA2EA;
|
||||
remoteInfo = ASCOfficeDocxFile2Lib;
|
||||
};
|
||||
691A8BCF1E2FA67E00DCB54A /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 691A8BCB1E2FA67E00DCB54A /* libxml2.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 69967F581E2F84F100B620CD;
|
||||
remoteInfo = libxml2;
|
||||
};
|
||||
691A8BD11E2FA68900DCB54A /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 691A8BCB1E2FA67E00DCB54A /* libxml2.xcodeproj */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 69967F571E2F84F100B620CD;
|
||||
remoteInfo = libxml2;
|
||||
};
|
||||
69415F231CB51C2A003E771B /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 69415F1F1CB51C29003E771B /* OfficeUtils.xcodeproj */;
|
||||
@ -447,7 +432,6 @@
|
||||
17C8DED01ACD696100902C85 /* libX2tConverter.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libX2tConverter.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
17E17F561AC457CD00BEA2EA /* ASCOfficeDocxFile2Lib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ASCOfficeDocxFile2Lib.xcodeproj; path = ../../../../ASCOfficeDocxFile2/Mac/ASCOfficeDocxFile2Lib.xcodeproj; sourceTree = "<group>"; };
|
||||
6911A9681F6036DA0061AB4D /* OfficeFileErrorDescription.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OfficeFileErrorDescription.h; path = ../../../../../Common/OfficeFileErrorDescription.h; sourceTree = "<group>"; };
|
||||
691A8BCB1E2FA67E00DCB54A /* libxml2.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libxml2.xcodeproj; path = ../../../../DesktopEditor/xml/mac/libxml2.xcodeproj; sourceTree = "<group>"; };
|
||||
69415F1F1CB51C29003E771B /* OfficeUtils.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = OfficeUtils.xcodeproj; path = ../../../../OfficeUtils/OfficeUtils.xcodeproj; sourceTree = "<group>"; };
|
||||
69415FAE1CB5243F003E771B /* mng.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = mng.xcodeproj; path = ../../../../DesktopEditor/mac_build/cximage/mng/mng.xcodeproj; sourceTree = "<group>"; };
|
||||
69415FB11CB5243F003E771B /* png.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = png.xcodeproj; path = ../../../../DesktopEditor/mac_build/cximage/png/png.xcodeproj; sourceTree = "<group>"; };
|
||||
@ -490,7 +474,6 @@
|
||||
files = (
|
||||
8A9FAC2B207772E1007787F6 /* libicu.a in Frameworks */,
|
||||
696DD7CF1F5D98220021D0F3 /* libOfficeCryptReader.a in Frameworks */,
|
||||
691A8BD31E2FA68F00DCB54A /* liblibxml2.a in Frameworks */,
|
||||
6967B1D11E27B9D700A129E2 /* libRtfFormatLib.a in Frameworks */,
|
||||
6967B10A1E27A41B00A129E2 /* libPdfWriter.a in Frameworks */,
|
||||
6967B0D41E27A36E00A129E2 /* libHtmlFile.a in Frameworks */,
|
||||
@ -526,7 +509,6 @@
|
||||
children = (
|
||||
8A9FAC22207772CC007787F6 /* icu.xcodeproj */,
|
||||
696DD7C91F5D981A0021D0F3 /* OfficeCryptReader.xcodeproj */,
|
||||
691A8BCB1E2FA67E00DCB54A /* libxml2.xcodeproj */,
|
||||
6967B1C91E27B9C400A129E2 /* RtfFormatLib.xcodeproj */,
|
||||
6967B1031E27A41300A129E2 /* PdfWriter.xcodeproj */,
|
||||
6967B0CC1E27A35E00A129E2 /* HtmlFile.xcodeproj */,
|
||||
@ -585,14 +567,6 @@
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
691A8BCC1E2FA67E00DCB54A /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
691A8BD01E2FA67E00DCB54A /* liblibxml2.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
69415F201CB51C29003E771B /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -856,7 +830,6 @@
|
||||
dependencies = (
|
||||
8A9FAC2A207772D9007787F6 /* PBXTargetDependency */,
|
||||
696DD7D11F5D98270021D0F3 /* PBXTargetDependency */,
|
||||
691A8BD21E2FA68900DCB54A /* PBXTargetDependency */,
|
||||
6967B1D01E27B9D000A129E2 /* PBXTargetDependency */,
|
||||
6967B10C1E27A42500A129E2 /* PBXTargetDependency */,
|
||||
6967B0D31E27A36800A129E2 /* PBXTargetDependency */,
|
||||
@ -959,10 +932,6 @@
|
||||
ProductGroup = 69415FBB1CB5243F003E771B /* Products */;
|
||||
ProjectRef = 69415FBA1CB5243F003E771B /* libpsd.xcodeproj */;
|
||||
},
|
||||
{
|
||||
ProductGroup = 691A8BCC1E2FA67E00DCB54A /* Products */;
|
||||
ProjectRef = 691A8BCB1E2FA67E00DCB54A /* libxml2.xcodeproj */;
|
||||
},
|
||||
{
|
||||
ProductGroup = 69DA322D1CEE08DC00E10AF0 /* Products */;
|
||||
ProjectRef = 69DA322C1CEE08DC00E10AF0 /* metafile.xcodeproj */;
|
||||
@ -1032,13 +1001,6 @@
|
||||
remoteRef = 17E17F5A1AC457CD00BEA2EA /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
691A8BD01E2FA67E00DCB54A /* liblibxml2.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = liblibxml2.a;
|
||||
remoteRef = 691A8BCF1E2FA67E00DCB54A /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
69415F241CB51C2A003E771B /* libOfficeUtils.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
@ -1265,11 +1227,6 @@
|
||||
name = ASCOfficeDocxFile2Lib_ios;
|
||||
targetProxy = 17C8DEDB1ACD6A3900902C85 /* PBXContainerItemProxy */;
|
||||
};
|
||||
691A8BD21E2FA68900DCB54A /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = libxml2;
|
||||
targetProxy = 691A8BD11E2FA68900DCB54A /* PBXContainerItemProxy */;
|
||||
};
|
||||
69415F261CB51C32003E771B /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = OfficeUtils;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#ifndef X2T_VERSION_H
|
||||
#define X2T_VERSION_H
|
||||
|
||||
#define X2T_VERSION "2.4.539.0"
|
||||
#define X2T_VERSION "2.4.545.0"
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user