mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-22 07:47:05 +08:00
Compare commits
23 Commits
core-linux
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| 67a40a5fc4 | |||
| 67cd654785 | |||
| 3816162555 | |||
| 3fb166f99a | |||
| d8121d1a12 | |||
| a76bf57051 | |||
| 97b92cf75c | |||
| 506de8e9e1 | |||
| fb34d57ee6 | |||
| da2d997838 | |||
| 76d68fa70f | |||
| 677e3e49e0 | |||
| 02c84d107b | |||
| b59908e4c2 | |||
| 04e6b642f4 | |||
| 49cd76d0f3 | |||
| c9ddd5b7b5 | |||
| 53a75261e3 | |||
| 26f32dd511 | |||
| e1e788b768 | |||
| a74c927e7e | |||
| c94e1e3223 | |||
| 4afe985955 |
@ -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)
|
||||
@ -952,55 +967,57 @@ namespace DocFileFormat
|
||||
}
|
||||
else if ((oPicture.mfp.mm > 98) && (NULL != oPicture.shapeContainer)/* && (false == oPicture.shapeContainer->isLastIdentify())*/)
|
||||
{
|
||||
bool bFormula = false;
|
||||
|
||||
|
||||
bool bPicture = 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) bPicture = false;//шаблон 1.doc картинка в колонтитуле
|
||||
m_bSkip = oPicture.shapeContainer->m_bSkip;
|
||||
}
|
||||
|
||||
XMLTools::CStringXmlWriter pictWriter;
|
||||
pictWriter.WriteNodeBegin (L"w:pict");
|
||||
|
||||
if (bPicture)
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -1009,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 );
|
||||
}
|
||||
@ -1020,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 );
|
||||
}
|
||||
@ -1037,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 );
|
||||
}
|
||||
}
|
||||
@ -1192,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);
|
||||
|
||||
@ -79,7 +79,7 @@ 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)
|
||||
@ -97,8 +97,8 @@ namespace DocFileFormat
|
||||
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;
|
||||
}
|
||||
@ -140,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];
|
||||
|
||||
|
||||
@ -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;
|
||||
};
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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
|
||||
|
||||
@ -324,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);
|
||||
@ -463,12 +467,9 @@ namespace DocFileFormat
|
||||
{
|
||||
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());
|
||||
}
|
||||
else
|
||||
{
|
||||
appendValueAttribute(m_imageData, L"r:id", L"");
|
||||
}
|
||||
m_pXmlWriter->WriteString(m_imageData->GetXMLString());
|
||||
|
||||
|
||||
{//borders
|
||||
writePictureBorder( L"bordertop", pict->brcTop );
|
||||
|
||||
@ -250,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>())
|
||||
{
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -72,10 +72,10 @@ std::wostream & override_content_type::xml_to_stream(std::wostream & _Wostream)
|
||||
return _Wostream;
|
||||
}
|
||||
|
||||
const wchar_t * content_type_content::ns = L"";
|
||||
const wchar_t * content_type_content::name = L"Types";
|
||||
const wchar_t * content_type::ns = L"";
|
||||
const wchar_t * content_type::name = L"Types";
|
||||
|
||||
std::wostream & content_type_content::xml_to_stream(std::wostream & _Wostream) const
|
||||
std::wostream & content_type::xml_to_stream(std::wostream & _Wostream) const
|
||||
{
|
||||
CP_XML_WRITER(_Wostream)
|
||||
{
|
||||
|
||||
@ -86,8 +86,8 @@ public:
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
// content_type_content
|
||||
class content_type_content : public xml::element_impl<content_type_content>
|
||||
// content_type
|
||||
class content_type : public xml::element_impl<content_type>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
|
||||
@ -128,54 +128,7 @@ text_tracked_context::_state & text_tracked_context::get_tracked_change(std::wst
|
||||
else
|
||||
return current_state_; //empty
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------------------
|
||||
void text_forms_context::start_element (int type)
|
||||
{
|
||||
current_state_.clear();
|
||||
|
||||
current_state_.type = type;
|
||||
}
|
||||
void text_forms_context::set_id (const std::wstring& id)
|
||||
{
|
||||
current_state_.id = id;
|
||||
}
|
||||
void text_forms_context::set_name (const std::wstring& name)
|
||||
{
|
||||
current_state_.name = name;
|
||||
}
|
||||
void text_forms_context::set_label (const std::wstring& label)
|
||||
{
|
||||
current_state_.label = label;
|
||||
}
|
||||
void text_forms_context::set_uuid (const std::wstring& uuid)
|
||||
{
|
||||
current_state_.uuid = uuid;
|
||||
}
|
||||
void text_forms_context::set_value (const std::wstring &value)
|
||||
{
|
||||
current_state_.value = value;
|
||||
}
|
||||
void text_forms_context::set_element(odf_reader::form_element *elm)
|
||||
{
|
||||
current_state_.element = elm;
|
||||
}
|
||||
void text_forms_context::end_element ()
|
||||
{
|
||||
mapElements_.insert( std::make_pair(current_state_.id, current_state_));
|
||||
|
||||
current_state_.clear();
|
||||
}
|
||||
text_forms_context::_state& text_forms_context::get_state_element (std::wstring id)
|
||||
{
|
||||
std::map<std::wstring, _state>::iterator it = mapElements_.find(id);
|
||||
|
||||
if (it != mapElements_.end())
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
else
|
||||
return current_state_; //empty
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------------------
|
||||
docx_conversion_context::docx_conversion_context(odf_reader::odf_document * OdfDocument) :
|
||||
next_dump_page_properties_ (false),
|
||||
@ -1100,7 +1053,7 @@ void docx_conversion_context::process_styles()
|
||||
if (odf_reader::style_content * content = arStyles[i]->content())
|
||||
{
|
||||
get_tabs_context().clear();
|
||||
odf_reader::calc_tab_stops(arStyles[i].get(), get_tabs_context());
|
||||
calc_tab_stops(arStyles[i].get(), get_tabs_context());
|
||||
|
||||
get_styles_context().start_process_style(arStyles[i].get());
|
||||
content->docx_convert(*this, true);
|
||||
@ -1575,7 +1528,7 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
|
||||
|
||||
start_automatic_style(id);
|
||||
|
||||
odf_reader::calc_tab_stops(styleInst, get_tabs_context());
|
||||
calc_tab_stops(styleInst, get_tabs_context());
|
||||
|
||||
//вытаскивает rtl c цепочки стилей !! - просто прописать в наследуемом НЕЛЬЗЯ !!
|
||||
odf_reader::paragraph_format_properties properties = odf_reader::calc_paragraph_properties_content(styleInst);
|
||||
|
||||
@ -572,47 +572,6 @@ private:
|
||||
std::map<std::wstring, _state> mapChanges_;
|
||||
};
|
||||
|
||||
class text_forms_context
|
||||
{
|
||||
public:
|
||||
struct _state
|
||||
{
|
||||
std::wstring id;
|
||||
std::wstring name;
|
||||
int type = 0; //enum?
|
||||
std::wstring label;
|
||||
std::wstring uuid;
|
||||
std::wstring value;
|
||||
odf_reader::form_element* element = NULL;
|
||||
|
||||
void clear()
|
||||
{
|
||||
type = 0;
|
||||
id.clear();
|
||||
name.clear();
|
||||
label.clear();
|
||||
value.clear();
|
||||
uuid.clear();
|
||||
element = NULL;
|
||||
}
|
||||
};
|
||||
text_forms_context(){}
|
||||
|
||||
void start_element (int type);
|
||||
void set_id (const std::wstring& id);
|
||||
void set_name (const std::wstring& name);
|
||||
void set_label (const std::wstring& label);
|
||||
void set_uuid (const std::wstring& uuid);
|
||||
void set_value (const std::wstring& value);
|
||||
void set_element(odf_reader::form_element *elm);
|
||||
void end_element ();
|
||||
|
||||
_state& get_state_element (std::wstring id);
|
||||
|
||||
private:
|
||||
_state current_state_;
|
||||
std::map<std::wstring, _state> mapElements_;
|
||||
};
|
||||
class table_content_context
|
||||
{
|
||||
public:
|
||||
@ -930,7 +889,7 @@ public:
|
||||
section_context & get_section_context() { return section_context_; }
|
||||
notes_context & get_notes_context() { return notes_context_; }
|
||||
text_tracked_context& get_text_tracked_context(){ return text_tracked_context_; }
|
||||
text_forms_context & get_forms_context() { return text_forms_context_; }
|
||||
forms_context & get_forms_context() { return forms_context_; }
|
||||
tabs_context & get_tabs_context() { return tabs_context_;}
|
||||
|
||||
table_content_context & get_table_content_context() { return table_content_context_;}
|
||||
@ -1012,7 +971,7 @@ private:
|
||||
header_footer_context header_footer_context_;
|
||||
notes_context notes_context_;
|
||||
text_tracked_context text_tracked_context_;
|
||||
text_forms_context text_forms_context_;
|
||||
forms_context forms_context_;
|
||||
tabs_context tabs_context_;
|
||||
table_content_context table_content_context_;
|
||||
|
||||
|
||||
@ -243,7 +243,7 @@ void customXml_files::write(const std::wstring & RootPath)
|
||||
const std::wstring fileNameItem = std::wstring(L"item") + std::to_wstring(i+1) + L".xml";
|
||||
const std::wstring fileNameProps = std::wstring(L"itemProps") + std::to_wstring(i+1) + L".xml";
|
||||
|
||||
content_type_content * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
content_type * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
contentTypes->add_override(std::wstring(L"/customXml/") + fileNameProps,
|
||||
L"application/vnd.openxmlformats-officedocument.customXmlProperties+xml");
|
||||
|
||||
@ -280,7 +280,7 @@ void docx_charts_files::write(const std::wstring & RootPath)
|
||||
const std::wstring fileName = std::wstring(L"chart") + std::to_wstring(count) + L".xml";
|
||||
const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
|
||||
|
||||
content_type_content * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
content_type * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
contentTypes->add_override(std::wstring(L"/word/charts/") + fileName, kWSConType);
|
||||
|
||||
package::simple_element(fileName, charts_[i]->str()).write(path);
|
||||
|
||||
@ -101,6 +101,10 @@ std::wstring static get_default_file_name(RelsType type)
|
||||
return L"video";
|
||||
case typeAudio:
|
||||
return L"audio";
|
||||
case typeControl:
|
||||
return L"control";
|
||||
case typeControlProps:
|
||||
return L"controlProps";
|
||||
default:
|
||||
return L"";
|
||||
}
|
||||
@ -180,6 +184,10 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
|
||||
{
|
||||
sub_path = L"embeddings/";
|
||||
}
|
||||
else if ( type == typeControlProps)
|
||||
{
|
||||
sub_path = L"ctrlProps/";
|
||||
}
|
||||
else
|
||||
{
|
||||
isMediaInternal = is_internal(href, odf_packet_);
|
||||
@ -198,6 +206,7 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
|
||||
else if ( type == typeSlide) number = count_slide + 1;
|
||||
else if ( type == typeMsObject ||
|
||||
type == typeOleObject) number = count_object + 1;
|
||||
else if ( type == typeControl) number = count_control + 1;
|
||||
else
|
||||
number = items_.size() + 1;
|
||||
|
||||
@ -277,7 +286,19 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
|
||||
isInternal = isMediaInternal;
|
||||
return id;
|
||||
}
|
||||
std::wstring mediaitems::add_control_props(std::wstring & oox_target)
|
||||
{
|
||||
const bool isMediaInternal = true;
|
||||
|
||||
count_control++;
|
||||
|
||||
std::wstring rId = std::wstring(L"ctrlId") + std::to_wstring(count_control);
|
||||
|
||||
oox_target = std::wstring(L"ctrlProp") + std::to_wstring(count_control) + L".xml";
|
||||
|
||||
items_.push_back( item(L"", typeControlProps, oox_target, isMediaInternal, rId) );
|
||||
return rId;
|
||||
}
|
||||
void mediaitems::dump_rels(rels & Rels)
|
||||
{
|
||||
for (size_t i = 0; i < items_.size(); i++)
|
||||
|
||||
@ -52,6 +52,8 @@ public:
|
||||
count_audio = 0;
|
||||
count_video = 0;
|
||||
count_slide = 0;
|
||||
count_activeX = 0;
|
||||
count_control = 0;
|
||||
}
|
||||
|
||||
struct item
|
||||
@ -82,10 +84,14 @@ public:
|
||||
size_t count_shape;
|
||||
size_t count_tables;
|
||||
size_t count_object;
|
||||
size_t count_activeX;
|
||||
size_t count_control;
|
||||
|
||||
std::wstring add_or_find(const std::wstring & href, RelsType type, bool & isInternal);//возможны ссылки на один и тот же объект
|
||||
std::wstring add_or_find(const std::wstring & href, RelsType type, bool & isInternal, std::wstring & ref);
|
||||
|
||||
std::wstring add_control_props (std::wstring & oox_target);
|
||||
|
||||
void dump_rels(rels & Rels);
|
||||
items_array & items() { return items_; }
|
||||
|
||||
@ -102,6 +108,9 @@ public:
|
||||
case typeAudio: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio";
|
||||
case typeVideo: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/video";
|
||||
case typeSlide: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide";
|
||||
case typeExternalLink: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath";
|
||||
case typeActiveX: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/control";
|
||||
case typeControlProps: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/ctrlProp";
|
||||
default:
|
||||
return L"";
|
||||
}
|
||||
|
||||
@ -42,7 +42,56 @@
|
||||
#include "../odf/style_paragraph_properties.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox
|
||||
{
|
||||
void forms_context::start_element (int type)
|
||||
{
|
||||
current_state_.clear();
|
||||
|
||||
current_state_.type = type;
|
||||
}
|
||||
void forms_context::set_id (const std::wstring& id)
|
||||
{
|
||||
current_state_.id = id;
|
||||
}
|
||||
void forms_context::set_name (const std::wstring& name)
|
||||
{
|
||||
current_state_.name = name;
|
||||
}
|
||||
void forms_context::set_label (const std::wstring& label)
|
||||
{
|
||||
current_state_.label = label;
|
||||
}
|
||||
void forms_context::set_uuid (const std::wstring& uuid)
|
||||
{
|
||||
current_state_.uuid = uuid;
|
||||
}
|
||||
void forms_context::set_value (const std::wstring &value)
|
||||
{
|
||||
current_state_.value = value;
|
||||
}
|
||||
void forms_context::set_element(odf_reader::form_element *elm)
|
||||
{
|
||||
current_state_.element = elm;
|
||||
}
|
||||
void forms_context::end_element ()
|
||||
{
|
||||
mapElements_.insert( std::make_pair(current_state_.id, current_state_));
|
||||
|
||||
current_state_.clear();
|
||||
}
|
||||
forms_context::_state& forms_context::get_state_element (std::wstring id)
|
||||
{
|
||||
std::map<std::wstring, _state>::iterator it = mapElements_.find(id);
|
||||
|
||||
if (it != mapElements_.end())
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
else
|
||||
return current_state_; //empty
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------------------
|
||||
void tabs_context::reset()
|
||||
{
|
||||
for (size_t i = 0; i < tabs.size(); i++)
|
||||
@ -190,8 +239,7 @@ void styles_context::docx_serialize_table_style(std::wostream & strm, std::wstri
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace oox
|
||||
{
|
||||
|
||||
math_context::math_context(odf_reader::fonts_container & fonts, bool graphic) :
|
||||
base_font_size_(12), fonts_container_(fonts), is_need_e_(false)
|
||||
{
|
||||
|
||||
@ -56,9 +56,55 @@ namespace odf_reader
|
||||
typedef boost::shared_ptr<style_text_properties> style_text_properties_ptr;
|
||||
|
||||
class office_element;
|
||||
class form_element;
|
||||
typedef boost::shared_ptr<office_element> office_element_ptr;
|
||||
};
|
||||
|
||||
namespace oox {
|
||||
class forms_context
|
||||
{
|
||||
public:
|
||||
struct _state
|
||||
{
|
||||
std::wstring id;
|
||||
std::wstring name;
|
||||
int type = 0; //enum?
|
||||
std::wstring label;
|
||||
std::wstring uuid;
|
||||
std::wstring value;
|
||||
odf_reader::form_element* element = NULL;
|
||||
|
||||
std::wstring ctrlPropId;
|
||||
|
||||
void clear()
|
||||
{
|
||||
type = 0;
|
||||
id.clear();
|
||||
name.clear();
|
||||
label.clear();
|
||||
value.clear();
|
||||
uuid.clear();
|
||||
ctrlPropId.clear();
|
||||
element = NULL;
|
||||
}
|
||||
};
|
||||
forms_context(){}
|
||||
|
||||
void start_element (int type);
|
||||
void set_id (const std::wstring& id);
|
||||
void set_name (const std::wstring& name);
|
||||
void set_label (const std::wstring& label);
|
||||
void set_uuid (const std::wstring& uuid);
|
||||
void set_value (const std::wstring& value);
|
||||
void set_element(odf_reader::form_element *elm);
|
||||
void end_element ();
|
||||
|
||||
_state& get_state_element (std::wstring id);
|
||||
|
||||
private:
|
||||
_state current_state_;
|
||||
std::map<std::wstring, _state> mapElements_;
|
||||
};
|
||||
class tabs_context : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
@ -115,7 +161,6 @@ private:
|
||||
};
|
||||
|
||||
|
||||
namespace oox {
|
||||
|
||||
class math_context : boost::noncopyable
|
||||
{
|
||||
|
||||
@ -123,7 +123,7 @@ void content_types_file::write(const std::wstring & RootPath)
|
||||
elm.write(RootPath);
|
||||
}
|
||||
|
||||
content_type_content * content_types_file::content()
|
||||
content_type * content_types_file::content()
|
||||
{
|
||||
return &content_type_content_;
|
||||
}
|
||||
@ -279,11 +279,11 @@ _CP_PTR(customXml_content) customXml_content::create(const std::wstring &item, c
|
||||
return boost::make_shared<customXml_content>(item, props);
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
element_ptr simple_element::create(const std::wstring & FileName, const std::wstring & Content)
|
||||
simple_element_ptr simple_element::create(const std::wstring & FileName, const std::wstring & Content)
|
||||
{
|
||||
return boost::make_shared<simple_element>(FileName, Content);
|
||||
}
|
||||
element_ptr simple_element::create(const std::wstring & FileName, const std::string & Content)
|
||||
simple_element_ptr simple_element::create(const std::wstring & FileName, const std::string & Content)
|
||||
{
|
||||
return boost::make_shared<simple_element>(FileName, Content);
|
||||
}
|
||||
|
||||
@ -86,23 +86,27 @@ public:
|
||||
bool add_or_find_default (const std::wstring & extension);
|
||||
bool add_or_find_override(const std::wstring & fileName);
|
||||
void set_media (mediaitems & _Mediaitems);
|
||||
content_type_content * content ();
|
||||
content_type * content ();
|
||||
|
||||
private:
|
||||
content_type_content content_type_content_;
|
||||
content_type content_type_content_;
|
||||
std::wstring filename_;
|
||||
};
|
||||
|
||||
class simple_element;
|
||||
typedef boost::shared_ptr<simple_element> simple_element_ptr;
|
||||
|
||||
class simple_element : public element
|
||||
{
|
||||
public:
|
||||
simple_element(const std::wstring & FileName, const std::wstring & Content);
|
||||
static element_ptr create(const std::wstring & FileName, const std::wstring & Content);
|
||||
static simple_element_ptr create(const std::wstring & FileName, const std::wstring & Content);
|
||||
|
||||
simple_element(const std::wstring & FileName, const std::string & Content);
|
||||
static element_ptr create(const std::wstring & FileName, const std::string & Content);
|
||||
static simple_element_ptr create(const std::wstring & FileName, const std::string & Content);
|
||||
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
std::wstring get_filename() {return file_name_;}
|
||||
|
||||
private:
|
||||
std::wstring file_name_;
|
||||
@ -111,7 +115,6 @@ private:
|
||||
bool bXml;
|
||||
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
class rels_file;
|
||||
typedef boost::shared_ptr<rels_file> rels_file_ptr;
|
||||
|
||||
@ -56,7 +56,10 @@ enum RelsType
|
||||
typeSlide,
|
||||
typeVideo,
|
||||
typeAudio,
|
||||
typeControl
|
||||
typeExternalLink,
|
||||
typeActiveX,
|
||||
typeControl,
|
||||
typeControlProps
|
||||
};
|
||||
|
||||
struct _rel
|
||||
|
||||
@ -121,7 +121,7 @@ void slides_files::write(const std::wstring & RootPath)
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"slides" ;
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.presentationml.slide+xml";
|
||||
|
||||
for (int i = 0; i < slides_.size(); i++)
|
||||
@ -156,7 +156,7 @@ void notes_files::write(const std::wstring & RootPath)
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"notesSlides" ;
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml";
|
||||
|
||||
for (int i = 0; i < slides_.size(); i++)
|
||||
@ -199,7 +199,7 @@ void slideMasters_files::write(const std::wstring & RootPath)
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"slideMasters" ;
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml";
|
||||
|
||||
for (int i = 0; i < slides_.size(); i++)
|
||||
@ -233,7 +233,7 @@ void notesMaster_files::write(const std::wstring & RootPath)
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"notesMasters" ;
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml";
|
||||
|
||||
for (int i = 0; i < slides_.size(); i++)
|
||||
@ -282,7 +282,7 @@ void slideLayouts_files::write(const std::wstring & RootPath)
|
||||
const std::wstring fileName = std::wstring(L"slideLayout") + std::to_wstring( i + 1 ) + L".xml";
|
||||
const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml";
|
||||
|
||||
content_type_content * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
content_type * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
contentTypes->add_override(std::wstring(L"/ppt/slideLayouts/") + fileName, kWSConType);
|
||||
|
||||
slides_[i]->get_rel_file()->set_file_name(fileName + L".rels");//внитренние релсы
|
||||
@ -332,7 +332,7 @@ void ppt_charts_files::write(const std::wstring & RootPath)
|
||||
if (!charts_[i]) continue;
|
||||
|
||||
const std::wstring fileName = std::wstring(L"chart") + std::to_wstring( i + 1 ) + L".xml";
|
||||
content_type_content * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
content_type * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
|
||||
contentTypes->add_override(std::wstring(L"/ppt/charts/") + fileName, kWSConType);
|
||||
@ -364,7 +364,7 @@ void ppt_themes_files::write(const std::wstring & RootPath)
|
||||
const std::wstring fileName = std::wstring(L"theme") + std::to_wstring( i + 1) + L".xml";
|
||||
const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.theme+xml";
|
||||
|
||||
content_type_content * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
content_type * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
contentTypes->add_override(std::wstring(L"/ppt/theme/") + fileName, kWSConType);
|
||||
|
||||
std::wstringstream content;
|
||||
@ -385,7 +385,7 @@ void ppt_comments_files::write(const std::wstring & RootPath)
|
||||
|
||||
for (int i = 0; i < comments_.size(); i++)
|
||||
{
|
||||
content_type_content * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
content_type * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.presentationml.comments+xml";
|
||||
contentTypes->add_override(std::wstring(L"/ppt/comments/") + comments_[i].filename, kWSConType);
|
||||
|
||||
@ -289,7 +289,8 @@ void xlsx_serialize(std::wostream & strm, _xlsx_drawing & val)
|
||||
xlsx_serialize_group(strm, val);
|
||||
}
|
||||
else if (val.type == typeOleObject ||
|
||||
val.type == typeMsObject )
|
||||
val.type == typeMsObject ||
|
||||
val.type == typeControl)
|
||||
{
|
||||
xlsx_serialize_object(strm, val);
|
||||
}
|
||||
@ -371,5 +372,37 @@ void _xlsx_drawing::serialize_object (std::wostream & strm)
|
||||
|
||||
}
|
||||
|
||||
void _xlsx_drawing::serialize_control (std::wostream & strm)
|
||||
{
|
||||
if (type != typeControl) return;
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"control")
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", objectId);
|
||||
CP_XML_ATTR(L"shapeId", id);
|
||||
//CP_XML_ATTR(L"name", objectProgId);
|
||||
|
||||
CP_XML_NODE(L"controlPr")
|
||||
{
|
||||
CP_XML_ATTR(L"defaultSize", 0);
|
||||
if (fill.bitmap)
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", fill.bitmap->rId);
|
||||
}
|
||||
CP_XML_NODE(L"anchor")
|
||||
{
|
||||
CP_XML_ATTR(L"moveWithCells", 1);
|
||||
|
||||
from_.serialize (CP_XML_STREAM(), L"");
|
||||
to_.serialize (CP_XML_STREAM(), L"");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,7 +66,8 @@ public:
|
||||
std::wstring content_group_;
|
||||
|
||||
void serialize (std::wostream & strm);
|
||||
void serialize_object (std::wostream & strm);
|
||||
void serialize_object (std::wostream & strm);
|
||||
void serialize_control (std::wostream & strm);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -297,6 +297,11 @@ void xlsx_drawing_context::set_ms_object(const std::wstring & path, const std::w
|
||||
impl_->object_description_.xlink_href_ = path;
|
||||
impl_->object_description_.descriptor_ = progId;
|
||||
}
|
||||
void xlsx_drawing_context::set_control(const std::wstring & ctrlPropId)
|
||||
{
|
||||
impl_->object_description_.type_ = typeControl;
|
||||
impl_->object_description_.xlink_href_ = ctrlPropId;
|
||||
}
|
||||
void xlsx_drawing_context::set_image(const std::wstring & path)
|
||||
{
|
||||
int pos_replaicement = path.find(L"ObjectReplacements");
|
||||
@ -575,15 +580,14 @@ void xlsx_drawing_context::process_chart(drawing_object_description & obj,_xlsx_
|
||||
if (drawing.inGroup)
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.objectId, ref, obj.type_); // не объект
|
||||
}
|
||||
|
||||
void xlsx_drawing_context::process_object(drawing_object_description & obj, xlsx_table_metrics & table_metrics,_xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_)
|
||||
void xlsx_drawing_context::process_object(drawing_object_description & obj, xlsx_table_metrics & table_metrics, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_)
|
||||
{
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
|
||||
if (drawing.type_anchor == 2) // absolute
|
||||
{
|
||||
//пересчет нужен для оле
|
||||
//пересчет нужен
|
||||
xlsx_table_position from, to;
|
||||
|
||||
process_position_properties (obj, table_metrics, from, to);
|
||||
@ -600,11 +604,19 @@ void xlsx_drawing_context::process_object(drawing_object_description & obj, xlsx
|
||||
drawing.to_.position.row = to.row;
|
||||
drawing.to_.position.rowOff = static_cast<size_t>(odf_types::length(to.rowOff, odf_types::length::pt).get_value_unit(odf_types::length::emu));
|
||||
}
|
||||
|
||||
drawing.objectId = impl_->get_mediaitems().add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
drawing.objectProgId = obj.descriptor_;
|
||||
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, drawing.objectId, ref, obj.type_, true);
|
||||
if (obj.type_ == typeControl)
|
||||
{
|
||||
drawing.objectId = obj.xlink_href_;
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, drawing.objectId, ref, obj.type_);
|
||||
}
|
||||
else
|
||||
{
|
||||
drawing.objectId = impl_->get_mediaitems().add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
drawing.objectProgId = obj.descriptor_;
|
||||
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, drawing.objectId, ref, obj.type_, true);
|
||||
}
|
||||
|
||||
if (drawing.inGroup)
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.objectId, ref, obj.type_); // не объект
|
||||
@ -680,7 +692,8 @@ void xlsx_drawing_context::process_group_objects(std::vector<drawing_object_desc
|
||||
case typeShape: process_shape ( obj, drawing, xlsx_drawings_); break;
|
||||
case typeGroupShape: process_group ( obj, table_metrics, drawing, xlsx_drawings_); break;
|
||||
case typeMsObject:
|
||||
case typeOleObject:
|
||||
case typeOleObject:
|
||||
case typeControl:
|
||||
process_object ( obj, table_metrics, drawing, xlsx_drawings_); break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,6 +95,7 @@ public:
|
||||
void set_chart (const std::wstring & path);
|
||||
void set_ole_object (const std::wstring & path, const std::wstring & progId);
|
||||
void set_ms_object (const std::wstring & path, const std::wstring & progId);
|
||||
void set_control (const std::wstring & ctrlPropId);
|
||||
void set_text_box ();
|
||||
void end_frame();
|
||||
|
||||
|
||||
@ -121,7 +121,15 @@ public:
|
||||
xlsx_drawings_[i].serialize_object(strm);
|
||||
}
|
||||
}
|
||||
|
||||
void serialize_controls(std::wostream & strm)
|
||||
{
|
||||
for (size_t i = 0 ; i < xlsx_drawings_.size(); i++)
|
||||
{
|
||||
if (xlsx_drawings_[i].type != typeControl) continue;
|
||||
|
||||
xlsx_drawings_[i].serialize_control(strm);
|
||||
}
|
||||
}
|
||||
bool empty() const
|
||||
{
|
||||
return (xlsx_drawings_.empty());
|
||||
@ -193,6 +201,10 @@ void xlsx_drawings::serialize_objects(std::wostream & strm)
|
||||
{
|
||||
impl_->serialize_objects(strm);
|
||||
}
|
||||
void xlsx_drawings::serialize_controls(std::wostream & strm)
|
||||
{
|
||||
impl_->serialize_controls(strm);
|
||||
}
|
||||
|
||||
bool xlsx_drawings::empty() const
|
||||
{
|
||||
|
||||
@ -73,6 +73,7 @@ public:
|
||||
|
||||
void serialize (std::wostream & _Wostream);
|
||||
void serialize_objects (std::wostream & _Wostream);
|
||||
void serialize_controls (std::wostream & _Wostream);
|
||||
private:
|
||||
class Impl;
|
||||
_CP_SCOPED_PTR(Impl) impl_;
|
||||
|
||||
@ -58,6 +58,7 @@ public:
|
||||
std::wstringstream dataValidations_;
|
||||
std::wstringstream ole_objects_;
|
||||
std::wstringstream page_props_;
|
||||
std::wstringstream controls_;
|
||||
|
||||
rels sheet_rels_;
|
||||
|
||||
@ -136,6 +137,10 @@ std::wostream & xlsx_xml_worksheet::ole_objects()
|
||||
{
|
||||
return impl_->ole_objects_;
|
||||
}
|
||||
std::wostream & xlsx_xml_worksheet::controls()
|
||||
{
|
||||
return impl_->controls_;
|
||||
}
|
||||
std::wostream & xlsx_xml_worksheet::page_properties()
|
||||
{
|
||||
return impl_->page_props_;
|
||||
@ -203,7 +208,7 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
|
||||
CP_XML_STREAM() << impl_->drawing_.str();
|
||||
|
||||
if (impl_->commentsId_.length()>0)
|
||||
if (!impl_->commentsId_.empty())
|
||||
{
|
||||
CP_XML_NODE(L"legacyDrawing")
|
||||
{
|
||||
@ -216,6 +221,13 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
{
|
||||
CP_XML_STREAM() << impl_->ole_objects_.str();
|
||||
}
|
||||
}
|
||||
if (!impl_->controls_.str().empty())
|
||||
{
|
||||
CP_XML_NODE(L"controls")
|
||||
{
|
||||
CP_XML_STREAM() << impl_->controls_.str();
|
||||
}
|
||||
}
|
||||
CP_XML_STREAM() << impl_->picture_background_.str();
|
||||
|
||||
|
||||
@ -66,6 +66,7 @@ public:
|
||||
std::wostream & sort();
|
||||
std::wostream & ole_objects();
|
||||
std::wostream & page_properties();
|
||||
std::wostream & controls();
|
||||
|
||||
rels & sheet_rels(); //hyperlink, background image, external, media ...
|
||||
|
||||
|
||||
@ -148,7 +148,7 @@ void sheets_files::write(const std::wstring & RootPath)
|
||||
const std::wstring fileName = std::wstring(L"sheet") + std::to_wstring(i + 1) + L".xml";
|
||||
const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml";
|
||||
|
||||
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
contentTypes->add_override(std::wstring(L"/xl/worksheets/") + fileName, kWSConType);
|
||||
|
||||
if (rels_)
|
||||
@ -194,6 +194,10 @@ void xl_files::write(const std::wstring & RootPath)
|
||||
sheets_files_.set_main_document( this->get_main_document() );
|
||||
sheets_files_.write(path);
|
||||
}
|
||||
{
|
||||
control_props_files_.set_main_document( this->get_main_document() );
|
||||
control_props_files_.write(path);
|
||||
}
|
||||
int index = 1;
|
||||
if (true)
|
||||
{
|
||||
@ -210,7 +214,7 @@ void xl_files::write(const std::wstring & RootPath)
|
||||
connections_->write(path);
|
||||
rels_files_.add( relationship( L"cnId1", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/connections", L"connections.xml" ) );
|
||||
|
||||
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
contentTypes->add_override(L"/xl/connections.xml", L"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml");
|
||||
}
|
||||
|
||||
@ -322,6 +326,10 @@ void xl_files::add_jsaProject(const std::string &content)
|
||||
{
|
||||
jsaProject_ = package::simple_element::create(L"jsaProject.bin", content);
|
||||
}
|
||||
void xl_files::add_control_props (simple_element_ptr element)
|
||||
{
|
||||
control_props_files_.add_control_props(element);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
void xl_pivot_cache_files::add_pivot_cache(pivot_cache_content_ptr pivot_cache)
|
||||
{
|
||||
@ -332,7 +340,7 @@ void xl_pivot_cache_files::write(const std::wstring & RootPath)
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"pivotCache";
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
|
||||
static const std::wstring kWSConTypeD = L"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml";
|
||||
static const std::wstring kWSConTypeR = L"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml";
|
||||
@ -384,7 +392,7 @@ void xl_pivot_table_files::write(const std::wstring & RootPath)
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"pivotTables";
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml";
|
||||
|
||||
@ -425,7 +433,7 @@ void xl_charts_files::write(const std::wstring & RootPath)
|
||||
{
|
||||
count++;
|
||||
const std::wstring fileName = std::wstring(L"chart") + std::to_wstring(i + 1) + L".xml";
|
||||
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
|
||||
contentTypes->add_override(std::wstring(L"/xl/charts/") + fileName, kWSConType);
|
||||
@ -440,6 +448,33 @@ void xl_charts_files::write(const std::wstring & RootPath)
|
||||
relFiles.write(path);
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
void xl_control_props_files::add_control_props(simple_element_ptr query_table)
|
||||
{
|
||||
control_props_.push_back(query_table);
|
||||
}
|
||||
void xl_control_props_files::write(const std::wstring & RootPath)
|
||||
{
|
||||
if (control_props_.empty()) return;
|
||||
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"ctrlProps";
|
||||
|
||||
NSDirectory::CreateDirectory(path);
|
||||
|
||||
content_type *contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
static const std::wstring kWSConType = L"application/vnd.ms-excel.controlproperties+xml";
|
||||
|
||||
for (size_t i = 0; i < control_props_.size(); i++)
|
||||
{
|
||||
if (!control_props_[i])continue;
|
||||
|
||||
const std::wstring fileName = control_props_[i]->get_filename();
|
||||
|
||||
contentTypes->add_override(std::wstring(L"/xl/ctrlProps/") + fileName, kWSConType);
|
||||
|
||||
control_props_[i]->write(path);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
xl_drawings_ptr xl_drawings::create(const std::vector<drawing_elm> & elms)
|
||||
{
|
||||
@ -463,7 +498,7 @@ void xl_drawings::write(const std::wstring & RootPath)
|
||||
relFiles.add_rel_file(r);
|
||||
relFiles.write(path);
|
||||
|
||||
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
|
||||
const std::wstring kDrawingCT = L"application/vnd.openxmlformats-officedocument.drawing+xml";
|
||||
contentTypes->add_override(L"/xl/drawings/" + drawings_[i].filename, kDrawingCT);
|
||||
@ -483,7 +518,7 @@ void xl_comments::write(const std::wstring & RootPath)
|
||||
|
||||
for (size_t i = 0; i < comments_.size(); i++)
|
||||
{
|
||||
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml";
|
||||
contentTypes->add_override(std::wstring(L"/xl/") + comments_[i].filename, kWSConType);
|
||||
|
||||
@ -211,13 +211,23 @@ private:
|
||||
rels_files * rels_;
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
class xl_control_props_files : public element
|
||||
{
|
||||
public:
|
||||
xl_control_props_files(){}
|
||||
|
||||
void add_control_props(simple_element_ptr props);
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
std::vector<simple_element_ptr> control_props_;
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
|
||||
class xl_files : public element
|
||||
{
|
||||
public:
|
||||
xl_files();
|
||||
|
||||
public:
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
void set_workbook (element_ptr Element);
|
||||
@ -233,6 +243,7 @@ public:
|
||||
void add_pivot_cache (pivot_cache_content_ptr cache);
|
||||
void add_pivot_table (pivot_table_content_ptr table);
|
||||
void add_jsaProject (const std::string &content);
|
||||
void add_control_props (simple_element_ptr Element);
|
||||
|
||||
private:
|
||||
rels_files rels_files_;
|
||||
@ -240,7 +251,8 @@ private:
|
||||
xl_charts_files charts_files_;
|
||||
xl_pivot_cache_files pivot_cache_files_;
|
||||
xl_pivot_table_files pivot_table_files_;
|
||||
|
||||
xl_control_props_files control_props_files_;
|
||||
|
||||
element_ptr theme_;
|
||||
element_ptr workbook_;
|
||||
|
||||
|
||||
@ -492,6 +492,10 @@ void xlsx_table_state::serialize_ole_objects(std::wostream & strm)
|
||||
{
|
||||
return xlsx_drawing_context_.get_drawings()->serialize_objects(strm);
|
||||
}
|
||||
void xlsx_table_state::serialize_controls(std::wostream & strm)
|
||||
{
|
||||
return xlsx_drawing_context_.get_drawings()->serialize_controls(strm);
|
||||
}
|
||||
void xlsx_table_state::serialize_hyperlinks(std::wostream & strm)
|
||||
{
|
||||
return xlsx_hyperlinks_.xlsx_serialize(strm);
|
||||
|
||||
@ -134,6 +134,7 @@ public:
|
||||
void serialize_table_format (std::wostream & _Wostream);
|
||||
void serialize_merge_cells (std::wostream & _Wostream);
|
||||
void serialize_hyperlinks (std::wostream & _Wostream);
|
||||
void serialize_controls (std::wostream & _Wostream);
|
||||
void serialize_ole_objects (std::wostream & _Wostream);
|
||||
void serialize_page_properties (std::wostream & _Wostream);
|
||||
void serialize_background (std::wostream & _Wostream);
|
||||
|
||||
@ -336,6 +336,10 @@ void xlsx_table_context::serialize_ole_objects(std::wostream & _Wostream)
|
||||
{
|
||||
return state()->serialize_ole_objects(_Wostream);
|
||||
}
|
||||
void xlsx_table_context::serialize_controls(std::wostream & _Wostream)
|
||||
{
|
||||
return state()->serialize_controls(_Wostream);
|
||||
}
|
||||
void xlsx_table_context::dump_rels_hyperlinks(rels & Rels)
|
||||
{
|
||||
return state()->dump_rels_hyperlinks(Rels);
|
||||
|
||||
@ -89,6 +89,7 @@ public:
|
||||
void serialize_conditionalFormatting(std::wostream & _Wostream);
|
||||
void serialize_hyperlinks (std::wostream & _Wostream);
|
||||
void serialize_ole_objects (std::wostream & _Wostream);
|
||||
void serialize_controls (std::wostream & _Wostream);
|
||||
void serialize_page_properties (std::wostream & _Wostream);
|
||||
void serialize_background (std::wostream & _Wostream);
|
||||
void serialize_data_validation (std::wostream & _Wostream);
|
||||
|
||||
@ -188,8 +188,10 @@ void xlsx_conversion_context::end_document()
|
||||
}
|
||||
|
||||
}
|
||||
//добавляем диаграммы
|
||||
|
||||
for (std::map<std::wstring, std::wstring>::iterator it = control_props_.begin(); it != control_props_.end(); ++it)
|
||||
{
|
||||
output_document_->get_xl_files().add_control_props( package::simple_element::create(it->first, it->second) );
|
||||
}
|
||||
for (size_t i = 0; i < charts_.size(); i++)
|
||||
{
|
||||
package::chart_content_ptr content = package::chart_content::create();
|
||||
@ -444,7 +446,8 @@ void xlsx_conversion_context::end_table()
|
||||
|
||||
get_table_context().serialize_hyperlinks (current_sheet().hyperlinks());
|
||||
get_table_context().serialize_ole_objects (current_sheet().ole_objects());
|
||||
|
||||
get_table_context().serialize_controls (current_sheet().controls());
|
||||
|
||||
get_table_context().dump_rels_hyperlinks (current_sheet().sheet_rels());
|
||||
get_table_context().dump_rels_ole_objects (current_sheet().sheet_rels());
|
||||
|
||||
@ -499,6 +502,17 @@ void xlsx_conversion_context::end_table()
|
||||
}
|
||||
get_table_context().end_table();
|
||||
}
|
||||
void xlsx_conversion_context::add_control_props(const std::wstring & rid, const std::wstring & target, const std::wstring & props)
|
||||
{
|
||||
if (rid.empty()) return;
|
||||
if (props.empty()) return;
|
||||
|
||||
control_props_.insert(std::make_pair(target, props));
|
||||
|
||||
current_sheet().sheet_rels().add(oox::relationship(rid,
|
||||
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/ctrlProp",
|
||||
L"../ctrlProps/" + target));
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::start_table_column(unsigned int repeated, const std::wstring & defaultCellStyleName, int & cMin, int & cMax)
|
||||
{
|
||||
|
||||
@ -158,6 +158,8 @@ public:
|
||||
void set_conditional_format_dataBar (_CP_OPT(int) min, _CP_OPT(int) max);
|
||||
|
||||
void add_jsaProject (const std::string &content);
|
||||
|
||||
void add_control_props(const std::wstring & rid, const std::wstring & target, const std::wstring & props);
|
||||
//------------------------------------------------------------------------------------
|
||||
|
||||
odf_reader::odf_document * root()
|
||||
@ -172,8 +174,9 @@ public:
|
||||
xlsx_text_context & get_text_context() { return xlsx_text_context_; }
|
||||
xlsx_table_context & get_table_context() { return xlsx_table_context_; }
|
||||
const xlsx_table_context & get_table_context() const { return xlsx_table_context_; }
|
||||
xlsx_style_manager & get_style_manager() { return xlsx_style_; }
|
||||
|
||||
xlsx_style_manager & get_style_manager() { return xlsx_style_; }
|
||||
forms_context & get_forms_context() { return forms_context_; }
|
||||
|
||||
oox_chart_context & current_chart();
|
||||
math_context & get_math_context() { return math_context_; }
|
||||
num_format_context & get_num_format_context() { return num_format_context_; }
|
||||
@ -210,16 +213,20 @@ private:
|
||||
size_t default_style_;
|
||||
mediaitems mediaitems_;
|
||||
std::multimap<std::wstring, int> mapPivotsTableView_;
|
||||
|
||||
|
||||
std::map<std::wstring, std::wstring>control_props_;
|
||||
|
||||
xlsx_style_manager xlsx_style_;
|
||||
xlsx_defined_names xlsx_defined_names_;
|
||||
xlsx_table_context xlsx_table_context_;
|
||||
xlsx_text_context xlsx_text_context_;
|
||||
math_context math_context_;
|
||||
xlsx_pivots_context xlsx_pivots_context_;
|
||||
xlsx_drawing_context_handle xlsx_drawing_context_handle_;
|
||||
xlsx_comments_context_handle xlsx_comments_context_handle_;
|
||||
xlsx_dataValidations_context xlsx_dataValidations_context_;
|
||||
|
||||
math_context math_context_;
|
||||
forms_context forms_context_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -156,7 +156,7 @@ paragraph_format_properties calc_paragraph_properties_content(const std::vector<
|
||||
return result;
|
||||
}
|
||||
|
||||
void calc_tab_stops(const style_instance * styleInstance, tabs_context & context)
|
||||
void calc_tab_stops(const style_instance * styleInstance, oox::tabs_context & context)
|
||||
{
|
||||
std::vector<const style_paragraph_properties*> parProps;
|
||||
while (styleInstance)
|
||||
|
||||
@ -40,22 +40,26 @@
|
||||
#include "odfcontext.h"
|
||||
#include <vector>
|
||||
|
||||
namespace cpdoccore {
|
||||
class tabs_context;
|
||||
namespace odf_reader {
|
||||
namespace cpdoccore
|
||||
{
|
||||
namespace oox
|
||||
{
|
||||
class tabs_context;
|
||||
}
|
||||
namespace odf_reader
|
||||
{
|
||||
graphic_format_properties calc_graphic_properties_content(const style_instance * styleInstance);
|
||||
graphic_format_properties calc_graphic_properties_content(const std::vector<const style_instance *> & styleInstances);
|
||||
|
||||
graphic_format_properties calc_graphic_properties_content(const style_instance * styleInstance);
|
||||
graphic_format_properties calc_graphic_properties_content(const std::vector<const style_instance *> & styleInstances);
|
||||
text_format_properties_content calc_text_properties_content(const style_instance * styleInstance);
|
||||
text_format_properties_content calc_text_properties_content(const std::vector<const style_instance *> & styleInstances);
|
||||
|
||||
text_format_properties_content calc_text_properties_content(const style_instance * styleInstance);
|
||||
text_format_properties_content calc_text_properties_content(const std::vector<const style_instance *> & styleInstances);
|
||||
paragraph_format_properties calc_paragraph_properties_content(const style_instance * styleInstance);
|
||||
paragraph_format_properties calc_paragraph_properties_content(const std::vector<const style_instance *> & styleInstances);
|
||||
|
||||
paragraph_format_properties calc_paragraph_properties_content(const style_instance * styleInstance);
|
||||
paragraph_format_properties calc_paragraph_properties_content(const std::vector<const style_instance *> & styleInstances);
|
||||
style_table_cell_properties_attlist calc_table_cell_properties(const style_instance * styleInstance);
|
||||
style_table_cell_properties_attlist calc_table_cell_properties(const std::vector<const style_instance *> & styleInstances);
|
||||
|
||||
style_table_cell_properties_attlist calc_table_cell_properties(const style_instance * styleInstance);
|
||||
style_table_cell_properties_attlist calc_table_cell_properties(const std::vector<const style_instance *> & styleInstances);
|
||||
|
||||
void calc_tab_stops(const style_instance * styleInstance, tabs_context & context);
|
||||
}
|
||||
void calc_tab_stops(const style_instance * styleInstance, oox::tabs_context & context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -430,29 +430,6 @@ void draw_plugin::add_child_element( xml::sax * Reader, const std::wstring & Ns,
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
// draw:control
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * draw_control::ns = L"draw";
|
||||
const wchar_t * draw_control::name = L"control";
|
||||
|
||||
void draw_control::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"xml:id", xml_id_);
|
||||
CP_APPLY_ATTR(L"draw:caption-id", caption_id_);
|
||||
CP_APPLY_ATTR(L"draw:control", control_id_);
|
||||
|
||||
draw_attlists_.shape_with_text_and_styles_.add_attributes(Attributes);
|
||||
draw_attlists_.position_.add_attributes(Attributes);
|
||||
draw_attlists_.rel_size_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void draw_control::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
if CP_CHECK_NAME(L"draw", L"glue-point")
|
||||
{
|
||||
CP_CREATE_ELEMENT(draw_glue_point_);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ public:
|
||||
static const ElementType type = typeDrawFrame;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
draw_frame() : oox_drawing_(NULL), idx_in_owner(-1) {}
|
||||
draw_frame() : oox_drawing_(), idx_in_owner(-1) {}
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
@ -378,33 +378,7 @@ private:
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_plugin);
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class draw_control : public office_element_impl<draw_control>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeDrawControl;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
|
||||
|
||||
odf_types::union_common_draw_attlists draw_attlists_;
|
||||
_CP_OPT(std::wstring) xml_id_;
|
||||
_CP_OPT(std::wstring) caption_id_;
|
||||
_CP_OPT(std::wstring) control_id_;
|
||||
|
||||
office_element_ptr draw_glue_point_;
|
||||
//<svg:desc>
|
||||
//<svg:title>
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_control);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,6 +51,7 @@
|
||||
|
||||
#include "../docx/docx_drawing.h"
|
||||
#include "../docx/xlsx_package.h"
|
||||
#include "../docx/oox_conversion_context.h"
|
||||
|
||||
#include "chart_build_oox.h"
|
||||
|
||||
@ -1670,7 +1671,7 @@ void draw_control::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
if (!control_id_) return;
|
||||
|
||||
oox::text_forms_context::_state & state = Context.get_forms_context().get_state_element(*control_id_);
|
||||
oox::forms_context::_state & state = Context.get_forms_context().get_state_element(*control_id_);
|
||||
if (state.id.empty()) return;
|
||||
|
||||
if ((state.type == 6 || state.type == 4) && state.element)
|
||||
@ -1709,10 +1710,10 @@ void draw_control::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
Context.start_paragraph(false);
|
||||
|
||||
if (draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_)
|
||||
if (common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_)
|
||||
{
|
||||
text::paragraph_attrs attrs_;
|
||||
attrs_.text_style_name_ = *draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_;
|
||||
attrs_.text_style_name_ = *common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_;
|
||||
|
||||
int textStyle = Context.process_paragraph_attr(&attrs_);
|
||||
}
|
||||
@ -1757,7 +1758,7 @@ void draw_control::docx_convert(oox::docx_conversion_context & Context)
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
|
||||
/////////
|
||||
common_draw_docx_convert(Context, draw_attlists_, &drawing);
|
||||
common_draw_docx_convert(Context, common_draw_attlists_, &drawing);
|
||||
/////////
|
||||
|
||||
std::wostream & strm = Context.output_stream();
|
||||
|
||||
@ -52,9 +52,11 @@
|
||||
#include "odf_document_impl.h"
|
||||
|
||||
#include "calcs_styles.h"
|
||||
#include "../docx/xlsx_drawing.h"
|
||||
#include "chart_build_oox.h"
|
||||
|
||||
#include "../docx/oox_conversion_context.h"
|
||||
#include "../docx/xlsx_drawing.h"
|
||||
|
||||
#include "datatypes/length.h"
|
||||
#include "datatypes/borderstyle.h"
|
||||
|
||||
@ -255,7 +257,7 @@ void draw_text_box::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
|
||||
std::wstring text_content_ = Context.get_text_context().end_drawing_content();
|
||||
|
||||
if (text_content_.length()>0)
|
||||
if (!text_content_.empty())
|
||||
{
|
||||
Context.get_drawing_context().set_property(_property(L"text-content", text_content_));
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ namespace odf_reader {
|
||||
|
||||
const wchar_t * draw_shape::ns = L"draw";
|
||||
const wchar_t * draw_shape::name = L"shape";
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// draw-shape-attlist
|
||||
void draw_shape_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
@ -88,7 +88,9 @@ void draw_rect_attlist::add_attributes( const xml::attributes_wc_ptr & Attribute
|
||||
CP_APPLY_ATTR(L"draw:filter-name", draw_filter_name_);
|
||||
CP_APPLY_ATTR(L"draw:corner-radius",draw_corner_radius_);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
/// draw:rect
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_rect::ns = L"draw";
|
||||
const wchar_t * draw_rect::name = L"rect";
|
||||
|
||||
@ -103,9 +105,6 @@ void draw_rect::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
sub_type_ = 9;
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// draw-ellipse-attlist
|
||||
|
||||
void draw_ellipse_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
@ -113,7 +112,9 @@ void draw_ellipse_attlist::add_attributes( const xml::attributes_wc_ptr & Attrib
|
||||
CP_APPLY_ATTR(L"draw:filter-name", draw_filter_name_);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
/// draw:ellipse
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_ellipse::ns = L"draw";
|
||||
const wchar_t * draw_ellipse::name = L"ellipse";
|
||||
|
||||
@ -133,7 +134,9 @@ void draw_circle_attlist::add_attributes( const xml::attributes_wc_ptr & Attribu
|
||||
{
|
||||
//CP_APPLY_ATTR(L"draw:filter-name", draw_filter_name_);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:circle
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_circle::ns = L"draw";
|
||||
const wchar_t * draw_circle::name = L"circle";
|
||||
|
||||
@ -144,7 +147,6 @@ void draw_circle::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
sub_type_ = 4;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// draw-line-attlist
|
||||
void draw_line_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
@ -153,7 +155,9 @@ void draw_line_attlist::add_attributes( const xml::attributes_wc_ptr & Attribute
|
||||
CP_APPLY_ATTR(L"svg:y1", svg_y1_);
|
||||
CP_APPLY_ATTR(L"svg:y2", svg_y2_);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:line
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_line::ns = L"draw";
|
||||
const wchar_t * draw_line::name = L"line";
|
||||
|
||||
@ -199,7 +203,9 @@ void draw_line::reset_svg_attributes()
|
||||
void draw_custom_shape_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:custom_shape
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_custom_shape::ns = L"draw";
|
||||
const wchar_t * draw_custom_shape::name = L"custom-shape";
|
||||
|
||||
@ -218,7 +224,9 @@ void draw_path_attlist::add_attributes( const xml::attributes_wc_ptr & Attribute
|
||||
CP_APPLY_ATTR(L"svg:viewBox", svg_viewbox_);
|
||||
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:path
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_path::ns = L"draw";
|
||||
const wchar_t * draw_path::name = L"path";
|
||||
|
||||
@ -276,11 +284,15 @@ void draw_polygon_attlist::add_attributes( const xml::attributes_wc_ptr & Attrib
|
||||
CP_APPLY_ATTR(L"svg:viewBox", svg_viewbox_);
|
||||
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:polygon
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_polygon::ns = L"draw";
|
||||
const wchar_t * draw_polygon::name = L"polygon";
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:contour-polygon
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_contour_polygon::ns = L"draw";
|
||||
const wchar_t * draw_contour_polygon::name = L"contour-polygon";
|
||||
|
||||
@ -338,7 +350,9 @@ void draw_polyline_attlist::add_attributes( const xml::attributes_wc_ptr & Attri
|
||||
CP_APPLY_ATTR(L"svg:viewBox", svg_viewbox_);
|
||||
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:polyline
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_polyline::ns = L"draw";
|
||||
const wchar_t * draw_polyline::name = L"polyline";
|
||||
|
||||
@ -396,7 +410,7 @@ void draw_polyline::reset_polyline_path()
|
||||
}
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//-------------------------------------------------------------------------------------------
|
||||
void draw_equation_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"draw:name", draw_name_);
|
||||
@ -417,7 +431,9 @@ void draw_handle_attlist::add_attributes( const xml::attributes_wc_ptr & Attribu
|
||||
|
||||
CP_APPLY_ATTR(L"draw:handle-polar", draw_handle_polar_);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:path
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_handle::ns = L"draw";
|
||||
const wchar_t * draw_handle::name = L"handle";
|
||||
|
||||
@ -459,7 +475,9 @@ void draw_enhanced_geometry_attlist::add_attributes( const xml::attributes_wc_pt
|
||||
CP_APPLY_ATTR(L"drawooo:enhanced-path" , drawooo_enhanced_path_);
|
||||
CP_APPLY_ATTR(L"drawooo:sub-view-size" , drawooo_sub_view_size_);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:enhanced_geometry
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_enhanced_geometry::ns = L"draw";
|
||||
const wchar_t * draw_enhanced_geometry::name = L"enhanced-geometry";
|
||||
|
||||
@ -584,13 +602,15 @@ void draw_enhanced_geometry::find_draw_type_oox()
|
||||
//draw_handle_geometry_.push_back(elm);
|
||||
// }
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//-------------------------------------------------------------------------------------------
|
||||
/// draw-caption-attlist
|
||||
//-------------------------------------------------------------------------------------------
|
||||
void draw_caption_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:caption
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_caption::ns = L"draw";
|
||||
const wchar_t * draw_caption::name = L"caption";
|
||||
|
||||
@ -601,15 +621,18 @@ void draw_caption::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
|
||||
sub_type_ = 1;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//-------------------------------------------------------------------------------------------
|
||||
/// draw-connector-attlist
|
||||
//-------------------------------------------------------------------------------------------
|
||||
void draw_connector_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"svg:d", svg_d_);
|
||||
CP_APPLY_ATTR(L"svg:viewBox", svg_viewbox_);
|
||||
CP_APPLY_ATTR(L"draw:type", draw_type_);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:connector
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_connector::ns = L"draw";
|
||||
const wchar_t * draw_connector::name = L"connector";
|
||||
|
||||
@ -667,7 +690,9 @@ void draw_connector::reset_svg_path()
|
||||
}
|
||||
///////////////////////////////////////
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// dr3d:scene
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * dr3d_scene::ns = L"dr3d";
|
||||
const wchar_t * dr3d_scene::name = L"scene";
|
||||
|
||||
@ -678,7 +703,9 @@ void dr3d_scene::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
sub_type_ = 10;
|
||||
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// dr3d:extrude
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * dr3d_extrude::ns = L"dr3d";
|
||||
const wchar_t * dr3d_extrude::name = L"extrude";
|
||||
|
||||
@ -692,7 +719,9 @@ void dr3d_extrude::reset_svg_path()
|
||||
if (!svg_d_) return;
|
||||
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// dr3d:light
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * dr3d_light::ns = L"dr3d";
|
||||
const wchar_t * dr3d_light::name = L"light";
|
||||
|
||||
@ -703,6 +732,28 @@ void dr3d_light::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
CP_APPLY_ATTR(L"dr3d:specular", dr3d_specular_);
|
||||
CP_APPLY_ATTR(L"dr3d:enabled", dr3d_enabled_);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:control
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_control::ns = L"draw";
|
||||
const wchar_t * draw_control::name = L"control";
|
||||
|
||||
void draw_control::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"xml:id", xml_id_);
|
||||
CP_APPLY_ATTR(L"draw:caption-id", caption_id_);
|
||||
CP_APPLY_ATTR(L"draw:control", control_id_);
|
||||
|
||||
draw_shape::add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void draw_control::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
if CP_CHECK_NAME(L"draw", L"glue-point")
|
||||
{
|
||||
CP_CREATE_ELEMENT(draw_glue_point_);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -621,6 +621,31 @@ public:
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(dr3d_light);
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class draw_control : public draw_shape
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeDrawControl;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
|
||||
|
||||
_CP_OPT(std::wstring) xml_id_;
|
||||
_CP_OPT(std::wstring) caption_id_;
|
||||
_CP_OPT(std::wstring) control_id_;
|
||||
|
||||
office_element_ptr draw_glue_point_;
|
||||
//<svg:desc>
|
||||
//<svg:title>
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_control);
|
||||
}
|
||||
}
|
||||
@ -42,6 +42,7 @@
|
||||
|
||||
#include <xml/xmlchar.h>
|
||||
#include <xml/attributes.h>
|
||||
#include <xml/utils.h>
|
||||
#include <odf/odf_document.h>
|
||||
|
||||
#include "serialize_elements.h"
|
||||
@ -53,7 +54,7 @@
|
||||
#include "datatypes/borderstyle.h"
|
||||
|
||||
#include "../docx/xlsx_utils.h"
|
||||
#include "../docx/oox_drawing.h"
|
||||
#include "../docx/docx_drawing.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
|
||||
|
||||
@ -44,6 +44,7 @@
|
||||
#include <xml/attributes.h>
|
||||
#include <odf/odf_document.h>
|
||||
|
||||
#include "office_forms.h"
|
||||
#include "serialize_elements.h"
|
||||
#include "style_graphic_properties.h"
|
||||
#include "odfcontext.h"
|
||||
@ -140,7 +141,7 @@ void draw_shape::common_xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
}
|
||||
std::wstring text_content_ = Context.get_text_context().end_drawing_content();
|
||||
|
||||
if (text_content_.length()>0)
|
||||
if (!text_content_.empty())
|
||||
{
|
||||
Context.get_drawing_context().set_property(_property(L"text-content",text_content_));
|
||||
}
|
||||
@ -355,5 +356,38 @@ void dr3d_light::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
|
||||
}
|
||||
void draw_control::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
if (!control_id_) return;
|
||||
|
||||
oox::forms_context::_state & state = Context.get_forms_context().get_state_element(*control_id_);
|
||||
if (state.id.empty()) return;
|
||||
|
||||
if (state.ctrlPropId.empty())
|
||||
{
|
||||
std::wstring target;
|
||||
state.ctrlPropId = Context.get_mediaitems().add_control_props(target);
|
||||
|
||||
std::wstringstream strm;
|
||||
|
||||
form_element* control = dynamic_cast<form_element*>(state.element);
|
||||
if (control)
|
||||
{
|
||||
control->serialize_control_props(strm);
|
||||
}
|
||||
|
||||
Context.add_control_props(state.ctrlPropId, target, strm.str());
|
||||
}
|
||||
|
||||
Context.get_drawing_context().start_frame();
|
||||
Context.get_drawing_context().set_control(state.ctrlPropId);
|
||||
|
||||
common_xlsx_convert(Context);
|
||||
|
||||
Context.get_drawing_context().end_frame();
|
||||
Context.get_drawing_context().clear();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -40,6 +40,7 @@
|
||||
|
||||
#include "serialize_elements.h"
|
||||
|
||||
#include "../formulasconvert/formulasconvert.h"
|
||||
namespace cpdoccore {
|
||||
namespace odf_reader {
|
||||
|
||||
@ -65,6 +66,13 @@ void office_forms::docx_convert(oox::docx_conversion_context & Context)
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
}
|
||||
void office_forms::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->xlsx_convert(Context);
|
||||
}
|
||||
}
|
||||
// form:form
|
||||
//----------------------------------------------------------------------------------
|
||||
const wchar_t * form_form::ns = L"form";
|
||||
@ -117,6 +125,13 @@ void form_form::docx_convert(oox::docx_conversion_context & Context)
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
}
|
||||
void form_form::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->xlsx_convert(Context);
|
||||
}
|
||||
}
|
||||
// form:properties
|
||||
//----------------------------------------------------------------------------------
|
||||
const wchar_t * form_properties::ns = L"form";
|
||||
@ -132,6 +147,10 @@ void form_properties::docx_convert(oox::docx_conversion_context & Context)
|
||||
// {
|
||||
// content_[i]->docx_convert(Context);
|
||||
// }
|
||||
}
|
||||
void form_properties::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
|
||||
}
|
||||
// form:property
|
||||
//----------------------------------------------------------------------------------
|
||||
@ -165,6 +184,13 @@ void form_list_property::docx_convert(oox::docx_conversion_context & Context)
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
}
|
||||
void form_list_property::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->xlsx_convert(Context);
|
||||
}
|
||||
}
|
||||
// form:list-value
|
||||
//----------------------------------------------------------------------------------
|
||||
const wchar_t * form_list_value::ns = L"form";
|
||||
@ -194,6 +220,7 @@ void form_element::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
CP_APPLY_ATTR(L"form:title", title_);
|
||||
CP_APPLY_ATTR(L"form:value", value_);
|
||||
CP_APPLY_ATTR(L"form:current-value",current_value_);
|
||||
CP_APPLY_ATTR(L"form:dropdown", dropdown_);
|
||||
CP_APPLY_ATTR(L"xml:id", xml_id_);
|
||||
CP_APPLY_ATTR(L"xforms:bind", xforms_bind_);
|
||||
}
|
||||
@ -224,6 +251,21 @@ void form_element::docx_convert(oox::docx_conversion_context & Context)
|
||||
Context.get_forms_context().end_element();
|
||||
|
||||
}
|
||||
void form_element::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
std::wstring id = id_ ? *id_ : (xml_id_ ? *xml_id_ : L"");
|
||||
Context.get_forms_context().set_id(id);
|
||||
|
||||
if (name_) Context.get_forms_context().set_name(*name_);
|
||||
if (label_) Context.get_forms_context().set_label(*label_);
|
||||
|
||||
if (current_value_) Context.get_forms_context().set_value(*current_value_);
|
||||
else if (value_) Context.get_forms_context().set_value(*value_);
|
||||
|
||||
if (control_implementation_) Context.get_forms_context().set_uuid(*control_implementation_);
|
||||
|
||||
Context.get_forms_context().end_element();
|
||||
}
|
||||
// form:button
|
||||
//----------------------------------------------------------------------------------
|
||||
const wchar_t * form_button::ns = L"form";
|
||||
@ -239,7 +281,27 @@ void form_button::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
form_element::docx_convert(Context);
|
||||
}
|
||||
void form_button::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
Context.get_forms_context().start_element(1);
|
||||
|
||||
form_element::xlsx_convert(Context);
|
||||
}
|
||||
void form_button::serialize_control_props(std::wostream & strm)
|
||||
{
|
||||
formulasconvert::odf2oox_converter converter;
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"formControlPr")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
|
||||
|
||||
CP_XML_ATTR(L"objectType", L"Button");
|
||||
|
||||
CP_XML_ATTR(L"dx", L"20");
|
||||
CP_XML_ATTR(L"noThreeD", L"1");
|
||||
}
|
||||
}}
|
||||
// form:text
|
||||
//----------------------------------------------------------------------------------
|
||||
const wchar_t * form_text::ns = L"form";
|
||||
@ -256,6 +318,30 @@ void form_text::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
form_element::docx_convert(Context);
|
||||
}
|
||||
void form_text::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
Context.get_forms_context().start_element(2);
|
||||
Context.get_forms_context().set_element(dynamic_cast<form_element*>(this));
|
||||
|
||||
form_element::xlsx_convert(Context);
|
||||
}
|
||||
void form_text::serialize_control_props(std::wostream & strm)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"formControlPr")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
|
||||
|
||||
CP_XML_ATTR(L"objectType", L"EditBox");
|
||||
|
||||
CP_XML_ATTR(L"dx", L"20");
|
||||
CP_XML_ATTR(L"noThreeD", L"1");
|
||||
|
||||
if (value_)
|
||||
CP_XML_ATTR(L"val", *value_);
|
||||
}
|
||||
}}
|
||||
void form_text::docx_convert_sdt(oox::docx_conversion_context & Context, draw_control *draw)
|
||||
{
|
||||
if (!draw) return;
|
||||
@ -333,6 +419,30 @@ void form_checkbox::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
form_element::docx_convert(Context);
|
||||
}
|
||||
void form_checkbox::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
Context.get_forms_context().start_element(3);
|
||||
Context.get_forms_context().set_element(dynamic_cast<form_element*>(this));
|
||||
|
||||
form_element::xlsx_convert(Context);
|
||||
}
|
||||
void form_checkbox::serialize_control_props(std::wostream & strm)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"formControlPr")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
|
||||
|
||||
CP_XML_ATTR(L"objectType", L"CheckBox");
|
||||
if (current_state_)
|
||||
CP_XML_ATTR(L"checked", L"Checked");
|
||||
|
||||
CP_XML_ATTR(L"dx", L"20");
|
||||
CP_XML_ATTR(L"noThreeD", L"1");
|
||||
}
|
||||
}
|
||||
}
|
||||
void form_checkbox::docx_convert_sdt(oox::docx_conversion_context & Context, draw_control *draw)
|
||||
{
|
||||
if (!draw) return;
|
||||
@ -405,6 +515,9 @@ const wchar_t * form_combobox::name = L"combobox";
|
||||
void form_combobox::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
form_element::add_attributes(Attributes);
|
||||
|
||||
CP_APPLY_ATTR(L"form:source-cell-range", source_cell_range_);
|
||||
CP_APPLY_ATTR(L"form:list-source", list_source_);
|
||||
}
|
||||
void form_combobox::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
@ -424,6 +537,42 @@ void form_combobox::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
form_element::docx_convert(Context);
|
||||
}
|
||||
void form_combobox::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
Context.get_forms_context().start_element(4);
|
||||
Context.get_forms_context().set_element(dynamic_cast<form_element*>(this));
|
||||
|
||||
form_element::xlsx_convert(Context);
|
||||
}
|
||||
void form_combobox::serialize_control_props(std::wostream & strm)
|
||||
{
|
||||
formulasconvert::odf2oox_converter converter;
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"formControlPr")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
|
||||
CP_XML_ATTR(L"objectType", L"Drop");
|
||||
CP_XML_ATTR(L"dropStyle", L"combo");
|
||||
CP_XML_ATTR(L"dx", L"20");
|
||||
CP_XML_ATTR(L"noThreeD", L"1");
|
||||
|
||||
if (linked_cell_)
|
||||
{
|
||||
std::wstring fmla = converter.convert_named_expr(*linked_cell_);
|
||||
CP_XML_ATTR(L"fmlaLink", fmla);
|
||||
}
|
||||
if (source_cell_range_)
|
||||
{
|
||||
std::wstring fmla = converter.convert_named_expr(*source_cell_range_);
|
||||
CP_XML_ATTR(L"fmlaRange", fmla);
|
||||
}
|
||||
//CP_XML_ATTR(L"sel", L"3");
|
||||
if (value_)
|
||||
CP_XML_ATTR(L"val", *value_);
|
||||
}
|
||||
}
|
||||
}
|
||||
void form_combobox::docx_convert_sdt(oox::docx_conversion_context & Context, draw_control *draw)
|
||||
{
|
||||
Context.finish_run();
|
||||
@ -489,13 +638,60 @@ const wchar_t * form_listbox::name = L"listbox";
|
||||
void form_listbox::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
form_element::add_attributes(Attributes);
|
||||
|
||||
CP_APPLY_ATTR(L"form:source-cell-range", source_cell_range_);
|
||||
CP_APPLY_ATTR(L"form:list-source", list_source_);
|
||||
CP_APPLY_ATTR(L"form:list-source-type", list_source_type_);
|
||||
CP_APPLY_ATTR(L"form:list-linkage-type", list_linkage_type_);
|
||||
}
|
||||
void form_listbox::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
Context.get_forms_context().start_element(5);
|
||||
Context.get_forms_context().set_element(dynamic_cast<form_element*>(this));
|
||||
|
||||
form_element::docx_convert(Context);
|
||||
}
|
||||
void form_listbox::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
Context.get_forms_context().start_element(5);
|
||||
Context.get_forms_context().set_element(dynamic_cast<form_element*>(this));
|
||||
|
||||
form_element::xlsx_convert(Context);
|
||||
}
|
||||
void form_listbox::serialize_control_props(std::wostream & strm)
|
||||
{
|
||||
formulasconvert::odf2oox_converter converter;
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"formControlPr")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
|
||||
|
||||
CP_XML_ATTR(L"objectType", L"List");
|
||||
if ((dropdown_) && (dropdown_->get()))
|
||||
{
|
||||
CP_XML_ATTR(L"dropStyle", L"combo");
|
||||
}
|
||||
CP_XML_ATTR(L"dx", L"20");
|
||||
CP_XML_ATTR(L"noThreeD", L"1");
|
||||
|
||||
if (linked_cell_)
|
||||
{
|
||||
std::wstring fmla = converter.convert_named_expr(*linked_cell_);
|
||||
CP_XML_ATTR(L"fmlaLink", fmla);
|
||||
}
|
||||
if (source_cell_range_)
|
||||
{
|
||||
std::wstring fmla = converter.convert_named_expr(*source_cell_range_);
|
||||
CP_XML_ATTR(L"fmlaRange", fmla);
|
||||
}
|
||||
//CP_XML_ATTR(L"sel", L"3");
|
||||
if (value_)
|
||||
CP_XML_ATTR(L"val", *value_);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
// form:button
|
||||
//----------------------------------------------------------------------------------
|
||||
const wchar_t * form_date::ns = L"form";
|
||||
@ -512,6 +708,16 @@ void form_date::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
form_element::docx_convert(Context);
|
||||
}
|
||||
void form_date::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
Context.get_forms_context().start_element(6);
|
||||
Context.get_forms_context().set_element(dynamic_cast<form_element*>(this));
|
||||
|
||||
form_element::xlsx_convert(Context);
|
||||
}
|
||||
void form_date::serialize_control_props(std::wostream & strm)
|
||||
{
|
||||
}
|
||||
void form_date::docx_convert_sdt(oox::docx_conversion_context & Context, draw_control *draw)
|
||||
{
|
||||
Context.finish_run();
|
||||
|
||||
@ -57,10 +57,12 @@ public:
|
||||
static const ElementType type = typeOfficeForms;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context) ;
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context) ;
|
||||
|
||||
public:
|
||||
office_element_ptr_array content_;
|
||||
@ -80,10 +82,12 @@ public:
|
||||
static const ElementType type = typeFormForm;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context) ;
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context) ;
|
||||
|
||||
public:
|
||||
office_element_ptr_array content_;
|
||||
@ -128,10 +132,12 @@ public:
|
||||
static const ElementType type = typeFormProperties;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context) ;
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ){}
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context) ;
|
||||
|
||||
public:
|
||||
office_element_ptr_array content_; //form property && form list-property
|
||||
@ -168,10 +174,12 @@ public:
|
||||
static const ElementType type = typeFormListProperty;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context) ;
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context) ;
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) property_name_;
|
||||
@ -210,18 +218,20 @@ public:
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeFormElement;
|
||||
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
form_element() {}
|
||||
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context) ;
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) {}
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context) {}
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
|
||||
|
||||
virtual void docx_convert_sdt (oox::docx_conversion_context & Context, draw_control* draw) {}
|
||||
virtual void docx_convert_field (oox::docx_conversion_context & Context, draw_control* draw) {}
|
||||
form_element() {}
|
||||
|
||||
//CPDOCCORE_DEFINE_VISITABLE();
|
||||
virtual void serialize_control_props(std::wostream & strm){}
|
||||
|
||||
friend class odf_document;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
office_element_ptr office_event_listeners_;
|
||||
@ -242,6 +252,7 @@ public:
|
||||
_CP_OPT(std::wstring) xml_id_;
|
||||
_CP_OPT(std::wstring) xforms_bind_;
|
||||
_CP_OPT(std::wstring) current_value_;
|
||||
_CP_OPT(odf_types::Bool) dropdown_;
|
||||
};
|
||||
|
||||
// form:button
|
||||
@ -254,7 +265,11 @@ public:
|
||||
static const ElementType type = typeFormButton;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context) ;
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
|
||||
|
||||
virtual void serialize_control_props(std::wostream & strm);
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
@ -285,9 +300,14 @@ public:
|
||||
static const ElementType type = typeFormText;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert (oox::docx_conversion_context & Context) ;
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
|
||||
|
||||
virtual void docx_convert_sdt (oox::docx_conversion_context & Context, draw_control* draw);
|
||||
virtual void docx_convert_field (oox::docx_conversion_context & Context, draw_control* draw);
|
||||
|
||||
virtual void serialize_control_props(std::wostream & strm);
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
@ -310,9 +330,15 @@ public:
|
||||
static const ElementType type = typeFormCheckbox;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert (oox::docx_conversion_context & Context) ;
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
|
||||
|
||||
virtual void docx_convert_sdt (oox::docx_conversion_context & Context, draw_control *draw);
|
||||
virtual void docx_convert_field (oox::docx_conversion_context & Context, draw_control* draw);
|
||||
|
||||
virtual void serialize_control_props(std::wostream & strm);
|
||||
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
@ -336,23 +362,26 @@ public:
|
||||
static const ElementType type = typeFormCombobox;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert (oox::docx_conversion_context & Context) ;
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
|
||||
|
||||
virtual void docx_convert_sdt (oox::docx_conversion_context & Context, draw_control* draw);
|
||||
|
||||
virtual void serialize_control_props(std::wostream & strm);
|
||||
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
public:
|
||||
_CP_OPT(odf_types::Bool) dropdown_;
|
||||
office_element_ptr_array items_;
|
||||
_CP_OPT(int ) size_;
|
||||
|
||||
//form:list-source-type
|
||||
//form:size
|
||||
_CP_OPT(std::wstring) source_cell_range_;
|
||||
_CP_OPT(std::wstring) list_source_;
|
||||
|
||||
//form:auto-complete
|
||||
//form:list-source
|
||||
//form:sourcecell-range
|
||||
//form:dropdown
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(form_combobox);
|
||||
@ -367,14 +396,19 @@ public:
|
||||
static const ElementType type = typeFormListbox;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert (oox::docx_conversion_context & Context) ;
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
|
||||
virtual void serialize_control_props(std::wostream & strm);
|
||||
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
public:
|
||||
//form:list-source-type
|
||||
//form:list-source
|
||||
//form:source-cell-range
|
||||
_CP_OPT(std::wstring) list_linkage_type_;
|
||||
_CP_OPT(std::wstring) source_cell_range_;
|
||||
_CP_OPT(std::wstring) list_source_;
|
||||
_CP_OPT(std::wstring) list_source_type_;
|
||||
|
||||
//form:bound-column
|
||||
//form:xforms-list-source
|
||||
@ -395,8 +429,14 @@ public:
|
||||
static const ElementType type = typeFormDate;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert (oox::docx_conversion_context & Context) ;
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
|
||||
|
||||
virtual void docx_convert_sdt (oox::docx_conversion_context & Context, draw_control* draw);
|
||||
|
||||
virtual void serialize_control_props(std::wostream & strm);
|
||||
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
|
||||
@ -226,7 +226,7 @@ int text_format_properties_content::process_font_style(const _CP_OPT(font_style)
|
||||
}
|
||||
void text_format_properties_content::pptx_convert_as_list(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
styles_context & styles_context_ = Context.get_text_context().get_styles_context();
|
||||
oox::styles_context & styles_context_ = Context.get_text_context().get_styles_context();
|
||||
CP_XML_WRITER(styles_context_.text_style())
|
||||
{
|
||||
if (fo_color_)
|
||||
@ -948,7 +948,7 @@ void text_format_properties_content::docx_serialize(std::wostream & _rPr, fonts_
|
||||
|
||||
void text_format_properties_content::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
styles_context & styles_context_ = Context.get_text_context().get_styles_context();
|
||||
oox::styles_context & styles_context_ = Context.get_text_context().get_styles_context();
|
||||
fonts_container & fonts_ = Context.root()->odf_context().fontContainer();
|
||||
|
||||
drawing_serialize(styles_context_.text_style(), styles_context_.extern_node(), fonts_, styles_context_.get_current_processed_style(), styles_context_.hlinkClick());
|
||||
|
||||
@ -181,6 +181,10 @@ void table_table::add_child_element( xml::sax * Reader, const std::wstring & Ns,
|
||||
else if CP_CHECK_NAME(L"calcext", L"conditional-formats")
|
||||
{
|
||||
CP_CREATE_ELEMENT(conditional_formats_);
|
||||
}
|
||||
else if CP_CHECK_NAME(L"office", L"forms")
|
||||
{
|
||||
CP_CREATE_ELEMENT(office_forms_);
|
||||
}
|
||||
else
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
|
||||
@ -647,9 +647,9 @@ public:
|
||||
|
||||
office_element_ptr table_shapes_;
|
||||
office_element_ptr_array table_named_;
|
||||
office_element_ptr office_forms_;
|
||||
//office-dde-source
|
||||
//table-scenario
|
||||
//office-forms
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(table_table);
|
||||
|
||||
|
||||
@ -323,6 +323,11 @@ void table_table::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
|
||||
_CP_LOG << L"[info][xlsx] process table \"" << tableName << L"\"\n" << std::endl;
|
||||
|
||||
if (office_forms_)
|
||||
{
|
||||
office_forms_->xlsx_convert(Context);
|
||||
}
|
||||
|
||||
if (table_table_source_)
|
||||
{
|
||||
table_table_source* table_source = dynamic_cast<table_table_source*>( table_table_source_.get() );
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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++)
|
||||
{
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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
|
||||
}
|
||||
@ -1 +1 @@
|
||||
2.4.545.0
|
||||
2.4.547.0
|
||||
|
||||
@ -690,9 +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_THEME_THUMBNAILS 21
|
||||
#define ASC_MENU_EVENT_TYPE_LAYOUT_THUMBNAILS 22
|
||||
#define ASC_MENU_EVENT_TYPE_SLIDETIMINGALL 23
|
||||
#define ASC_MENU_EVENT_TYPE_CHART 21
|
||||
|
||||
// insert commands
|
||||
#define ASC_MENU_EVENT_TYPE_INSERT_IMAGE 50
|
||||
@ -751,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);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user