mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-16 21:06:06 +08:00
Compare commits
116 Commits
core-linux
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| bd1dc5a7b6 | |||
| 1ccbe323f4 | |||
| 3811169415 | |||
| 2871769479 | |||
| 185dc3064f | |||
| c6f8a1cde8 | |||
| acdce1edb9 | |||
| 67a40a5fc4 | |||
| 67cd654785 | |||
| 3816162555 | |||
| 3fb166f99a | |||
| d8121d1a12 | |||
| a76bf57051 | |||
| 97b92cf75c | |||
| 506de8e9e1 | |||
| fb34d57ee6 | |||
| da2d997838 | |||
| 76d68fa70f | |||
| 677e3e49e0 | |||
| 02c84d107b | |||
| b59908e4c2 | |||
| 04e6b642f4 | |||
| 49cd76d0f3 | |||
| c9ddd5b7b5 | |||
| 53a75261e3 | |||
| 26f32dd511 | |||
| e1e788b768 | |||
| a74c927e7e | |||
| c94e1e3223 | |||
| 395e54cf76 | |||
| 40476e7555 | |||
| 04f06c23a1 | |||
| a9a635747a | |||
| 4afe985955 | |||
| 4027a0de25 | |||
| a232fcd9e1 | |||
| 5bc537749e | |||
| 6e7f6cf204 | |||
| b0c10403c5 | |||
| 5f516f0c56 | |||
| bfe8abb847 | |||
| d765a7590b | |||
| dac34c32c0 | |||
| 599bf9654d | |||
| fbd55ca485 | |||
| 68bb25301d | |||
| 2390e5bffe | |||
| 01c9c018af | |||
| 53ed94dbbe | |||
| e1fa9b5c46 | |||
| 6341cdbbdb | |||
| c93989767e | |||
| f4fa754ce4 | |||
| a965b30d72 | |||
| dd3dd1e42a | |||
| d2f1460f1b | |||
| 7d88a91fcc | |||
| bf02eec8ef | |||
| 8513ec5ae7 | |||
| 35b43e0683 | |||
| 421e58fe34 | |||
| 048cac74b6 | |||
| 069b12839f | |||
| c23ff4c8cd | |||
| ccc27a2e1b | |||
| 3843f52601 | |||
| c3ec17c132 | |||
| 72cb63b9f5 | |||
| dd04f5cf12 | |||
| dde6621d10 | |||
| 7c3b060794 | |||
| a8e4ccdf80 | |||
| aa609336ca | |||
| 9601d90671 | |||
| f59d7ff845 | |||
| adf2399368 | |||
| 5da57d65c1 | |||
| feddb37222 | |||
| 81db8d1776 | |||
| 2a809ab970 | |||
| b6a0614f00 | |||
| 452917f213 | |||
| 96202979ea | |||
| 5b5ccdc9be | |||
| 4ca2126abc | |||
| adf7ca65ea | |||
| 89235ca12a | |||
| 08d551752e | |||
| 77b1303d62 | |||
| 93e56e2b8a | |||
| e032fc8294 | |||
| 5ae2ac2385 | |||
| 6b8cb6cae4 | |||
| e66ea7c628 | |||
| 2447925fd6 | |||
| 9991195d56 | |||
| 51f579a682 | |||
| 45e0459434 | |||
| 2f194ebd97 | |||
| 5e4ce83dc1 | |||
| 50d4f451b9 | |||
| d464aa659a | |||
| db2d001110 | |||
| b883cfcbd4 | |||
| bb8add215a | |||
| ff7d7a908c | |||
| 958e213f9b | |||
| 3d3baa50b5 | |||
| ee987f8713 | |||
| 5e126e28ff | |||
| e98f4ae7b4 | |||
| 6900c0a640 | |||
| 5f09bf7835 | |||
| 5a9a89979c | |||
| 6a052f68aa | |||
| fc9b5e0613 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -35,6 +35,7 @@ Common/3dParty/openssl/openssl
|
||||
.idea
|
||||
.svn
|
||||
.DS_Store
|
||||
.qmake.stash
|
||||
Thumbs.db
|
||||
*.xcuserstate
|
||||
*.xcuserdatad
|
||||
@ -55,3 +56,4 @@ X2tConverter/**/Makefile.*
|
||||
*.zip
|
||||
*.tar.gz
|
||||
**/*.build/
|
||||
|
||||
|
||||
@ -52,6 +52,7 @@
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include "../../Common/DocxFormat/Source/Base/Types_32.h"
|
||||
#include "../../DesktopEditor/common/Types.h"
|
||||
#include "../../Common/DocxFormat/Source/Base/unicode_util.h"
|
||||
#include "../../UnicodeConverter/UnicodeConverter.h"
|
||||
|
||||
@ -58,7 +58,8 @@ namespace DocFileFormat
|
||||
}
|
||||
else
|
||||
{
|
||||
short cch = reader->ReadInt16();
|
||||
short cch = reader->ReadInt16();
|
||||
|
||||
|
||||
unsigned char *chars = reader->ReadBytes(18, true);
|
||||
|
||||
@ -67,13 +68,34 @@ namespace DocFileFormat
|
||||
newObject->m_AuthorIndex = reader->ReadUInt16();
|
||||
|
||||
//skip 4 bytes
|
||||
reader->ReadBytes(4, false);
|
||||
unsigned int skip = reader->ReadUInt32();
|
||||
|
||||
newObject->m_BookmarkId = reader->ReadInt32();
|
||||
newObject->m_BookmarkId = reader->ReadInt32(); //-1 - comment is on a length zero text range in the Main Document
|
||||
RELEASEARRAYOBJECTS(chars);
|
||||
}
|
||||
|
||||
|
||||
return static_cast<ByteStructure*>(newObject);
|
||||
}
|
||||
ByteStructure* AnnotationReferenceExDescriptor::ConstructObject(VirtualStreamReader* reader, int length)
|
||||
{
|
||||
AnnotationReferenceExDescriptor *newObject = new AnnotationReferenceExDescriptor();
|
||||
|
||||
if (reader->nWordVersion > 0)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
m_nDTTM = reader->ReadUInt32();
|
||||
reader->ReadUInt16(); //padding1
|
||||
m_nDepth = reader->ReadUInt32();
|
||||
m_nDiatrdParent = reader->ReadUInt32();
|
||||
unsigned int flag = reader->ReadUInt32();
|
||||
m_fInkAtn = GETBIT(flag, 1);
|
||||
}
|
||||
|
||||
|
||||
return static_cast<ByteStructure*>(newObject);
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,21 +46,6 @@ namespace DocFileFormat
|
||||
return (nWordVersion > 0) ? STRUCTURE_SIZE_OLD : STRUCTURE_SIZE;
|
||||
}
|
||||
|
||||
inline std::wstring GetUserInitials() const
|
||||
{
|
||||
return m_UserInitials;
|
||||
}
|
||||
|
||||
inline unsigned short GetAuthorIndex() const
|
||||
{
|
||||
return m_AuthorIndex;
|
||||
}
|
||||
|
||||
inline int GetBookmarkId() const
|
||||
{
|
||||
return m_BookmarkId;
|
||||
}
|
||||
|
||||
AnnotationReferenceDescriptor() : m_AuthorIndex(0), m_BookmarkId(0)
|
||||
{
|
||||
}
|
||||
@ -71,13 +56,35 @@ namespace DocFileFormat
|
||||
|
||||
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length );
|
||||
|
||||
private:
|
||||
|
||||
/// The initials of the user who left the annotation.
|
||||
std::wstring m_UserInitials;
|
||||
/// An index into the string table of comment author names.
|
||||
unsigned short m_AuthorIndex;
|
||||
/// Identifies a bookmark.
|
||||
int m_BookmarkId;
|
||||
};
|
||||
|
||||
class AnnotationReferenceExDescriptor: public ByteStructure
|
||||
{
|
||||
public:
|
||||
static const int STRUCTURE_SIZE = 18;
|
||||
static const int STRUCTURE_SIZE_OLD = 0;
|
||||
|
||||
static const int GetSize(int nWordVersion)
|
||||
{
|
||||
return (nWordVersion > 0) ? STRUCTURE_SIZE_OLD : STRUCTURE_SIZE;
|
||||
}
|
||||
|
||||
AnnotationReferenceExDescriptor() : m_nDTTM(0), m_nDepth(0), m_nDiatrdParent(0), m_fInkAtn(false)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~AnnotationReferenceExDescriptor()
|
||||
{
|
||||
}
|
||||
|
||||
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length );
|
||||
|
||||
unsigned int m_nDTTM;
|
||||
unsigned int m_nDepth;
|
||||
unsigned int m_nDiatrdParent;
|
||||
bool m_fInkAtn;
|
||||
};
|
||||
}
|
||||
|
||||
@ -39,13 +39,8 @@ namespace DocFileFormat
|
||||
class BookmarkFirst: public ByteStructure
|
||||
{
|
||||
private:
|
||||
/// An unsigned integer that specifies a zero-based index into the PlcfBkl or PlcfBkld
|
||||
/// that is paired with the PlcfBkf or PlcfBkfd containing this FBKF.
|
||||
/// The entry found at said index specifies the location of the end of the bookmark associated with this FBKF.
|
||||
/// Ibkl MUST be unique for all FBKFs inside a given PlcfBkf or PlcfBkfd.
|
||||
short ibkl;
|
||||
/// A BKC that specifies further information about the bookmark associated with this FBKF.
|
||||
short bkc;
|
||||
short ibkl;
|
||||
short bkc;
|
||||
|
||||
public:
|
||||
static const int STRUCTURE_SIZE = 4;
|
||||
@ -78,4 +73,32 @@ namespace DocFileFormat
|
||||
return static_cast<ByteStructure*>( newObject );
|
||||
}
|
||||
};
|
||||
class AtnBookmarkFirst: public ByteStructure
|
||||
{
|
||||
public:
|
||||
unsigned short bmc;
|
||||
unsigned int lTag;
|
||||
|
||||
static const int STRUCTURE_SIZE = 10;
|
||||
|
||||
AtnBookmarkFirst()
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~AtnBookmarkFirst()
|
||||
{
|
||||
}
|
||||
|
||||
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length )
|
||||
{
|
||||
AtnBookmarkFirst *newObject = new AtnBookmarkFirst();
|
||||
|
||||
newObject->bmc = reader->ReadUInt16(); //0x0100
|
||||
newObject->lTag = reader->ReadUInt32();
|
||||
|
||||
unsigned int lTagOld = reader->ReadUInt32();
|
||||
|
||||
return static_cast<ByteStructure*>( newObject );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ namespace DocFileFormat
|
||||
convertSprms( dynamic_cast<CharacterPropertyExceptions*>( chpx )->grpprl, _rPr );
|
||||
|
||||
// apend revision changes
|
||||
if (_revisionData->Type == Changed)
|
||||
if ((_revisionData) && (_revisionData->Type == Changed))
|
||||
{
|
||||
XMLTools::XMLElement rPrChange( L"w:rPrChange");
|
||||
|
||||
|
||||
@ -52,8 +52,6 @@ namespace DocFileFormat
|
||||
{
|
||||
m_context->_docx->RegisterComments();
|
||||
|
||||
int index = 0;
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"?xml version=\"1.0\" encoding=\"UTF-8\"?");
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:comments", TRUE );
|
||||
|
||||
@ -63,33 +61,60 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:o", OpenXmlNamespaces::Office );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:w10", OpenXmlNamespaces::OfficeWord );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:r", OpenXmlNamespaces::Relationships );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wpc", L"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:cx", L"http://schemas.microsoft.com/office/drawing/2014/chartex" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:cx1", L"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:mc", L"http://schemas.openxmlformats.org/markup-compatibility/2006" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:m", L"http://schemas.openxmlformats.org/officeDocument/2006/math" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wp14", L"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:w14", L"http://schemas.microsoft.com/office/word/2010/wordml" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:w15", L"http://schemas.microsoft.com/office/word/2012/wordml" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:w16se", L"http://schemas.microsoft.com/office/word/2015/wordml/symex" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wpg", L"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wpi", L"http://schemas.microsoft.com/office/word/2010/wordprocessingInk" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wne", L"http://schemas.microsoft.com/office/word/2006/wordml" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wps", L"http://schemas.microsoft.com/office/word/2010/wordprocessingShape" );
|
||||
m_pXmlWriter->WriteAttribute( L"mc:Ignorable", L"w14 w15 w16se wp14");
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
int cp = m_document->FIB->m_RgLw97.ccpText + m_document->FIB->m_RgLw97.ccpFtn + m_document->FIB->m_RgLw97.ccpHdr;
|
||||
|
||||
size_t count = m_document->AnnotationsReferencePlex->Elements.size();
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
for (size_t index = 0; index < count; ++index)
|
||||
{
|
||||
AnnotationReferenceDescriptor* atrdPre10 = static_cast<AnnotationReferenceDescriptor*>(m_document->AnnotationsReferencePlex->Elements[index]);
|
||||
AnnotationReferenceExDescriptor* atrdPost10 = m_document->AnnotationsReferenceExPlex ? static_cast<AnnotationReferenceExDescriptor*>(m_document->AnnotationsReferenceExPlex->Elements[index]) : NULL;
|
||||
|
||||
unsigned short index_author = atrdPre10->GetAuthorIndex();
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:comment", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 ));
|
||||
if (index_author < m_document->AnnotationOwners->size()) //conv_253l2H1CehgKwsxCtNk__docx.doc
|
||||
if (atrdPre10->m_BookmarkId < 0)
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 + count + 1024 ));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 ));
|
||||
}
|
||||
if (atrdPost10)
|
||||
{
|
||||
//!!!TODO!!!
|
||||
/*//ATRDpost10 is optional and not saved in all files
|
||||
if (doc.AnnotationReferenceExtraTable != null &&
|
||||
doc.AnnotationReferenceExtraTable.Count > index)
|
||||
{
|
||||
AnnotationReferenceDescriptorExtra atrdPost10 = doc.AnnotationReferenceExtraTable[index];
|
||||
atrdPost10.Date.Convert(new DateMapping(_writer));
|
||||
}*/
|
||||
}
|
||||
if (atrdPre10->m_AuthorIndex < m_document->AnnotationOwners->size()) //conv_253l2H1CehgKwsxCtNk__docx.doc
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:author",
|
||||
FormatUtils::XmlEncode(m_document->AnnotationOwners->at( index_author ) ));
|
||||
FormatUtils::XmlEncode(m_document->AnnotationOwners->at( atrdPre10->m_AuthorIndex ) ));
|
||||
}
|
||||
m_pXmlWriter->WriteAttribute( L"w:initials", atrdPre10->GetUserInitials());
|
||||
m_pXmlWriter->WriteAttribute( L"w:initials", atrdPre10->m_UserInitials);
|
||||
|
||||
|
||||
//!!!TODO!!!
|
||||
/*//ATRDpost10 is optional and not saved in all files
|
||||
if (doc.AnnotationReferenceExtraTable != null &&
|
||||
doc.AnnotationReferenceExtraTable.Count > index)
|
||||
{
|
||||
AnnotationReferenceDescriptorExtra atrdPost10 = doc.AnnotationReferenceExtraTable[index];
|
||||
atrdPost10.Date.Convert(new DateMapping(_writer));
|
||||
}*/
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
@ -116,8 +141,6 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd(L"w:comment" );
|
||||
|
||||
++index;
|
||||
}
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"w:comments" );
|
||||
|
||||
@ -45,7 +45,7 @@ namespace DocFileFormat
|
||||
{
|
||||
DocumentMapping::DocumentMapping(ConversionContext* context, IMapping* caller) : _skipRuns(0), _lastValidPapx(NULL), _lastValidSepx(NULL),
|
||||
AbstractOpenXmlMapping( new XMLTools::CStringXmlWriter() ), _sectionNr(0), _footnoteNr(0),
|
||||
_endnoteNr(0), _commentNr(0), _caller(caller)
|
||||
_endnoteNr(0), _commentNr(1), _caller(caller)
|
||||
{
|
||||
m_document = NULL;
|
||||
m_context = context;
|
||||
@ -506,7 +506,7 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
//write text
|
||||
for (unsigned int i = 0; i < chars->size(); ++i)
|
||||
for (size_t i = 0; i < chars->size(); ++i)
|
||||
{
|
||||
wchar_t c = chars->at(i), code = c;
|
||||
|
||||
@ -526,7 +526,20 @@ namespace DocFileFormat
|
||||
|
||||
text.clear();
|
||||
|
||||
XMLTools::XMLElement elem(L"w:br");
|
||||
if (textType == L"instrText")
|
||||
{
|
||||
m_pXmlWriter->WriteNodeEnd(L"w:r");
|
||||
m_pXmlWriter->WriteNodeBegin(L"w:r");
|
||||
CharacterPropertiesMapping* rPr = new CharacterPropertiesMapping(m_pXmlWriter, m_document, NULL, _lastValidPapx, false);
|
||||
if (rPr)
|
||||
{
|
||||
rPr->_webHidden = _writeWebHidden;
|
||||
|
||||
chpx->Convert(rPr);
|
||||
RELEASEOBJECT(rPr);
|
||||
}
|
||||
}
|
||||
XMLTools::XMLElement elem(L"w:br");
|
||||
elem.AppendAttribute(L"w:type", L"textWrapping");
|
||||
elem.AppendAttribute(L"w:clear", L"all");
|
||||
|
||||
@ -591,6 +604,7 @@ namespace DocFileFormat
|
||||
std::wstring HYPERLINK ( L"HYPERLINK" );
|
||||
std::wstring PAGEREF ( L"PAGEREF" );
|
||||
std::wstring PAGE ( L"PAGE" );
|
||||
std::wstring SHAPE ( L"SHAPE" );
|
||||
|
||||
if (arField.empty() == false)
|
||||
f = arField[0];
|
||||
@ -611,6 +625,7 @@ namespace DocFileFormat
|
||||
bool bEquation = search( f.begin(), f.end(), Equation.begin(), Equation.end()) != f.end();
|
||||
bool bPAGE = search( f.begin(), f.end(), PAGE.begin(), PAGE.end()) != f.end();
|
||||
bool bTOC = search( f.begin(), f.end(), TOC.begin(), TOC.end()) != f.end();
|
||||
bool bSHAPE = search( f.begin(), f.end(), SHAPE.begin(), SHAPE.end()) != f.end();
|
||||
|
||||
bool bPAGEREF = false;
|
||||
if (bHYPERLINK && arField.size() > 1)
|
||||
@ -916,7 +931,7 @@ namespace DocFileFormat
|
||||
PictureDescriptor pictDiscr(chpx, m_document->WordDocumentStream, 0x7fffffff, m_document->nWordVersion);
|
||||
ShapeContainer* pShape = m_document->GetOfficeArt()->GetShapeContainer(pSpa->GetShapeID());
|
||||
|
||||
if (pShape)
|
||||
if ((pShape) /*&& (false == pShape->isLastIdentify())*/)
|
||||
{
|
||||
VMLShapeMapping oVmlWriter (m_context, m_pXmlWriter, pSpa, &pictDiscr, _caller);
|
||||
|
||||
@ -950,55 +965,59 @@ namespace DocFileFormat
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd (L"w:pict");
|
||||
}
|
||||
else if ((oPicture.mfp.mm > 98) && (NULL != oPicture.shapeContainer))
|
||||
else if ((oPicture.mfp.mm > 98) && (NULL != oPicture.shapeContainer)/* && (false == oPicture.shapeContainer->isLastIdentify())*/)
|
||||
{
|
||||
bool bFormula = false;
|
||||
|
||||
XMLTools::CStringXmlWriter pictWriter;
|
||||
pictWriter.WriteNodeBegin (L"w:pict");
|
||||
|
||||
bool picture = true;
|
||||
bool bPicture = true;
|
||||
bool m_bSkip = false;
|
||||
|
||||
if (oPicture.shapeContainer)
|
||||
{
|
||||
int shape_type = oPicture.shapeContainer->getShapeType();
|
||||
if (oPicture.shapeContainer->m_nShapeType != msosptPictureFrame)
|
||||
bPicture = false;//шаблон 1.doc картинка в колонтитуле
|
||||
|
||||
if (shape_type != msosptPictureFrame) picture = false;//шаблон 1.doc картинка в колонтитуле
|
||||
m_bSkip = oPicture.shapeContainer->m_bSkip;
|
||||
}
|
||||
|
||||
if (picture)
|
||||
if (!m_bSkip)
|
||||
{
|
||||
VMLPictureMapping oVmlMapper(m_context, &pictWriter, false, _caller, isInline);
|
||||
oPicture.Convert (&oVmlMapper);
|
||||
|
||||
if (oVmlMapper.m_isEmbedded)
|
||||
bool bFormula = false;
|
||||
XMLTools::CStringXmlWriter pictWriter;
|
||||
pictWriter.WriteNodeBegin (L"w:pict");
|
||||
|
||||
if (bPicture)
|
||||
{
|
||||
OleObject ole ( chpx, m_document);
|
||||
OleObjectMapping oleObjectMapping( &pictWriter, m_context, &oPicture, _caller, oVmlMapper.m_shapeId );
|
||||
VMLPictureMapping oVmlMapper(m_context, &pictWriter, false, _caller, isInline);
|
||||
oPicture.Convert (&oVmlMapper);
|
||||
|
||||
ole.isEquation = oVmlMapper.m_isEquation;
|
||||
ole.isEmbedded = oVmlMapper.m_isEmbedded;
|
||||
ole.emeddedData = oVmlMapper.m_embeddedData;
|
||||
|
||||
ole.Convert( &oleObjectMapping );
|
||||
if (oVmlMapper.m_isEmbedded)
|
||||
{
|
||||
OleObject ole ( chpx, m_document);
|
||||
OleObjectMapping oleObjectMapping( &pictWriter, m_context, &oPicture, _caller, oVmlMapper.m_shapeId );
|
||||
|
||||
ole.isEquation = oVmlMapper.m_isEquation;
|
||||
ole.isEmbedded = oVmlMapper.m_isEmbedded;
|
||||
ole.emeddedData = oVmlMapper.m_embeddedData;
|
||||
|
||||
ole.Convert( &oleObjectMapping );
|
||||
}
|
||||
else if (oVmlMapper.m_isEquation)
|
||||
{
|
||||
//нельзя в Run писать oMath
|
||||
//m_pXmlWriter->WriteString(oVmlMapper.m_equationXml);
|
||||
_writeAfterRun = oVmlMapper.m_equationXml;
|
||||
bFormula = true;
|
||||
}
|
||||
}
|
||||
else if (oVmlMapper.m_isEquation)
|
||||
else
|
||||
{
|
||||
//нельзя в Run писать oMath
|
||||
//m_pXmlWriter->WriteString(oVmlMapper.m_equationXml);
|
||||
_writeAfterRun = oVmlMapper.m_equationXml;
|
||||
bFormula = true;
|
||||
VMLShapeMapping oVmlMapper(m_context, &pictWriter, NULL, &oPicture, _caller, isInline);
|
||||
oPicture.shapeContainer->Convert(&oVmlMapper);
|
||||
}
|
||||
}else
|
||||
{
|
||||
VMLShapeMapping oVmlMapper(m_context, &pictWriter, NULL, &oPicture, _caller, isInline);
|
||||
oPicture.shapeContainer->Convert(&oVmlMapper);
|
||||
}
|
||||
|
||||
pictWriter.WriteNodeEnd (L"w:pict");
|
||||
|
||||
pictWriter.WriteNodeEnd (L"w:pict");
|
||||
|
||||
if (!bFormula)
|
||||
m_pXmlWriter->WriteString(pictWriter.GetXmlString());
|
||||
if (!bFormula)
|
||||
m_pXmlWriter->WriteString(pictWriter.GetXmlString());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -1007,6 +1026,11 @@ namespace DocFileFormat
|
||||
if ((m_document->FootnoteReferenceCharactersPlex != NULL) && (m_document->FootnoteReferenceCharactersPlex->IsCpExists(cp)))
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:footnoteReference", true );
|
||||
FootnoteDescriptor* desc = dynamic_cast<FootnoteDescriptor*>(m_document->FootnoteReferenceCharactersPlex->Elements[_footnoteNr]);
|
||||
if (desc && desc->aFtnIdx == 0)
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:customMarkFollows", L"1");
|
||||
}
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString(_footnoteNr++ ) );
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true );
|
||||
}
|
||||
@ -1018,6 +1042,11 @@ namespace DocFileFormat
|
||||
else if ((m_document->EndnoteReferenceCharactersPlex != NULL) && (m_document->EndnoteReferenceCharactersPlex->IsCpExists(cp)))
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:endnoteReference", true );
|
||||
EndnoteDescriptor* desc = dynamic_cast<EndnoteDescriptor*>(m_document->EndnoteReferenceCharactersPlex->Elements[_footnoteNr]);
|
||||
if (desc && desc->aEndIdx == 0)
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:customMarkFollows", L"1");
|
||||
}
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString(_endnoteNr++ ));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true );
|
||||
}
|
||||
@ -1035,10 +1064,10 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:annotationRef", true );
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true );
|
||||
}
|
||||
else
|
||||
else if ((m_document->AnnotationsReferencePlex) && (_commentNr <= m_document->AnnotationsReferencePlex->Elements.size()))
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:commentReference", true );
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( _commentNr ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( _commentNr++ ));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true );
|
||||
}
|
||||
}
|
||||
@ -1190,7 +1219,7 @@ namespace DocFileFormat
|
||||
|
||||
// add the parts
|
||||
|
||||
for (unsigned int i = 0; i < splitIndices->size(); ++i)
|
||||
for (size_t i = 0; i < splitIndices->size(); ++i)
|
||||
{
|
||||
int cch = splitIndices->at( i ) - startIndex;
|
||||
|
||||
|
||||
@ -37,21 +37,14 @@ namespace DocFileFormat
|
||||
{
|
||||
class EndnoteDescriptor: public ByteStructure
|
||||
{
|
||||
private:
|
||||
short aEndIdx;
|
||||
|
||||
public:
|
||||
static const int STRUCTURE_SIZE = 2;
|
||||
|
||||
EndnoteDescriptor():
|
||||
aEndIdx(0)
|
||||
{
|
||||
}
|
||||
EndnoteDescriptor(): aEndIdx(0) {}
|
||||
|
||||
virtual ~EndnoteDescriptor()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length )
|
||||
{
|
||||
EndnoteDescriptor *newObject = new EndnoteDescriptor();
|
||||
@ -60,5 +53,7 @@ namespace DocFileFormat
|
||||
|
||||
return static_cast<ByteStructure*>( newObject );
|
||||
}
|
||||
|
||||
short aEndIdx;
|
||||
};
|
||||
}
|
||||
|
||||
@ -560,8 +560,7 @@ namespace DocFileFormat
|
||||
m_FibWord97.fcPlcffndRef = reader.ReadInt32();
|
||||
m_FibWord97.lcbPlcffndRef = reader.ReadInt32();
|
||||
|
||||
m_FibWord97.lcbPlcfandTxt = reader.ReadInt32();//112
|
||||
|
||||
m_FibWord97.fcPlcffndTxt = reader.ReadInt32();//112
|
||||
m_FibWord97.lcbPlcffndTxt = reader.ReadInt32();
|
||||
|
||||
m_FibWord97.fcPlcfandRef = reader.ReadInt32();
|
||||
|
||||
@ -37,21 +37,15 @@ namespace DocFileFormat
|
||||
{
|
||||
class FootnoteDescriptor: public ByteStructure
|
||||
{
|
||||
private:
|
||||
short aFtnIdx;
|
||||
|
||||
public:
|
||||
static const int STRUCTURE_SIZE = 2;
|
||||
|
||||
FootnoteDescriptor():
|
||||
aFtnIdx(0)
|
||||
{
|
||||
}
|
||||
FootnoteDescriptor() : aFtnIdx(0) {}
|
||||
|
||||
virtual ~FootnoteDescriptor()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length )
|
||||
{
|
||||
FootnoteDescriptor *newObject = new FootnoteDescriptor();
|
||||
@ -60,5 +54,7 @@ namespace DocFileFormat
|
||||
|
||||
return static_cast<ByteStructure*>( newObject );
|
||||
}
|
||||
|
||||
short aFtnIdx;
|
||||
};
|
||||
}
|
||||
|
||||
@ -63,7 +63,35 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:o", OpenXmlNamespaces::Office );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:w10", OpenXmlNamespaces::OfficeWord );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:r", OpenXmlNamespaces::Relationships );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wpc", L"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:mc", L"http://schemas.openxmlformats.org/markup-compatibility/2006");
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wp14", L"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:w14", L"http://schemas.microsoft.com/office/word/2010/wordml" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wpg", L"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wpi", L"http://schemas.microsoft.com/office/word/2010/wordprocessingInk" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wne", L"http://schemas.microsoft.com/office/word/2006/wordml" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wps", L"http://schemas.microsoft.com/office/word/2010/wordprocessingShape" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:m", L"http://schemas.openxmlformats.org/officeDocument/2006/math" );
|
||||
m_pXmlWriter->WriteAttribute( L"mc:Ignorable", L"w14 wp14" );
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
//m_pXmlWriter->WriteNodeBegin( L"w:footnote", TRUE );
|
||||
//m_pXmlWriter->WriteAttribute( L"w:type", L"separator");
|
||||
//m_pXmlWriter->WriteAttribute( L"w:id", L"-1");
|
||||
//m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
//m_pXmlWriter->WriteString(L"<w:p><w:pPr><w:spacing w:lineRule=\"auto\" w:line=\"240\" w:after=\"0\"/></w:pPr><w:r></w:r><w:r><w:separator/></w:r></w:p>");
|
||||
//m_pXmlWriter->WriteNodeEnd( L"w:footnote");
|
||||
|
||||
//m_pXmlWriter->WriteNodeBegin( L"w:footnote", TRUE );
|
||||
//m_pXmlWriter->WriteAttribute( L"w:type", L"continuationSeparator");
|
||||
//m_pXmlWriter->WriteAttribute( L"w:id", L"0");
|
||||
//m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
//m_pXmlWriter->WriteString(L"<w:p><w:pPr><w:spacing w:lineRule=\"auto\" w:line=\"240\" w:after=\"0\"/></w:pPr><w:r></w:r><w:r><w:continuationSeparator/></w:r></w:p>");
|
||||
//m_pXmlWriter->WriteNodeEnd( L"w:footnote");
|
||||
|
||||
int cp = m_document->FIB->m_RgLw97.ccpText;
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ std::wstring readXstz(VirtualStreamReader *reader)
|
||||
|
||||
std::wstring ret;
|
||||
|
||||
if (cch > 0)
|
||||
if (cch > 0 && cch < 0x0fff)
|
||||
{
|
||||
std::shared_ptr<unsigned char>data = std::shared_ptr<unsigned char>(reader->ReadBytes(cch * 2, true));
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
|
||||
@ -32,6 +32,8 @@
|
||||
|
||||
#include "ListData.h"
|
||||
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <cctype>
|
||||
@ -46,6 +48,11 @@ namespace DocFileFormat
|
||||
RELEASEOBJECT(rglvl);
|
||||
}
|
||||
|
||||
ListDataPtr ListData::create(VirtualStreamReader* reader, int length)
|
||||
{
|
||||
return boost::make_shared<ListData>(reader, length);
|
||||
}
|
||||
|
||||
// Parses the StreamReader to retrieve a ListData
|
||||
|
||||
ListData::ListData(VirtualStreamReader* reader, int length) : rglvl(NULL)
|
||||
@ -80,9 +87,85 @@ namespace DocFileFormat
|
||||
|
||||
grfhic = reader->ReadByte();
|
||||
}
|
||||
NumberingDescriptorPtr NumberingDescriptor::create(unsigned char * data, int length)
|
||||
{
|
||||
return boost::make_shared<NumberingDescriptor>(data, length);
|
||||
}
|
||||
bool NumberingDescriptor::operator == (const NumberingDescriptor & val) const
|
||||
{
|
||||
const bool res =
|
||||
nfc == val.nfc &&
|
||||
cbTextBefore == val.cbTextBefore &&
|
||||
cbTextAfter == val.cbTextAfter &&
|
||||
jc == val.jc &&
|
||||
fPrev == val.fPrev &&
|
||||
fHang == val.fHang &&
|
||||
fSetBold == val.fSetBold &&
|
||||
fSetItalic == val.fSetItalic &&
|
||||
fSetSmallCaps == val.fSetSmallCaps &&
|
||||
fSetCaps == val.fSetCaps &&
|
||||
fSetStrike == val.fSetStrike &&
|
||||
fSetKul == val.fSetKul &&
|
||||
fPrevSpace == val.fPrevSpace &&
|
||||
fBold == val.fBold &&
|
||||
fItalic == val.fItalic &&
|
||||
fSmallCaps == val.fSmallCaps &&
|
||||
fCaps == val.fCaps &&
|
||||
fStrike == val.fStrike &&
|
||||
kul == val.kul &&
|
||||
ico == val.ico &&
|
||||
ftc == val.ftc &&
|
||||
hps == val.hps &&
|
||||
iStartAt == val.iStartAt &&
|
||||
dxaIndent == val.dxaIndent &&
|
||||
dxaSpace == val.dxaSpace &&
|
||||
fNumber1 == val.fNumber1 &&
|
||||
fNumberAcross == val.fNumberAcross &&
|
||||
fRestartHdn == val.fRestartHdn &&
|
||||
fSpareX == val.fSpareX;
|
||||
|
||||
return res;
|
||||
}
|
||||
bool NumberingDescriptor::operator == (const NumberingDescriptorPtr & val) const
|
||||
{
|
||||
if (!val) return false;
|
||||
const bool res =
|
||||
nfc == val->nfc &&
|
||||
cbTextBefore == val->cbTextBefore &&
|
||||
cbTextAfter == val->cbTextAfter &&
|
||||
jc == val->jc &&
|
||||
fPrev == val->fPrev &&
|
||||
fHang == val->fHang &&
|
||||
fSetBold == val->fSetBold &&
|
||||
fSetItalic == val->fSetItalic &&
|
||||
fSetSmallCaps == val->fSetSmallCaps &&
|
||||
fSetCaps == val->fSetCaps &&
|
||||
fSetStrike == val->fSetStrike &&
|
||||
fSetKul == val->fSetKul &&
|
||||
fPrevSpace == val->fPrevSpace &&
|
||||
fBold == val->fBold &&
|
||||
fItalic == val->fItalic &&
|
||||
fSmallCaps == val->fSmallCaps &&
|
||||
fCaps == val->fCaps &&
|
||||
fStrike == val->fStrike &&
|
||||
kul == val->kul &&
|
||||
ico == val->ico &&
|
||||
ftc == val->ftc &&
|
||||
hps == val->hps &&
|
||||
iStartAt == val->iStartAt &&
|
||||
dxaIndent == val->dxaIndent &&
|
||||
dxaSpace == val->dxaSpace &&
|
||||
fNumber1 == val->fNumber1 &&
|
||||
fNumberAcross == val->fNumberAcross &&
|
||||
fRestartHdn == val->fRestartHdn &&
|
||||
fSpareX == val->fSpareX;
|
||||
|
||||
return res;
|
||||
|
||||
}
|
||||
NumberingDescriptor::NumberingDescriptor( unsigned char * data, int length )
|
||||
{
|
||||
id = 0;
|
||||
nfc = FormatUtils::BytesToUChar(data, 0, length);
|
||||
cbTextBefore = FormatUtils::BytesToUChar(data, 1, length);
|
||||
cbTextAfter = FormatUtils::BytesToUChar(data, 2, length);
|
||||
|
||||
@ -36,6 +36,9 @@
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
class ListData;
|
||||
typedef class boost::shared_ptr<ListData> ListDataPtr;
|
||||
|
||||
class ListData
|
||||
{
|
||||
friend class ListTable;
|
||||
@ -74,15 +77,20 @@ namespace DocFileFormat
|
||||
|
||||
virtual ~ListData();
|
||||
ListData( VirtualStreamReader* reader, int length );
|
||||
|
||||
static ListDataPtr create(VirtualStreamReader* reader, int length);
|
||||
};
|
||||
|
||||
class NumberingDescriptor;
|
||||
typedef class boost::shared_ptr<NumberingDescriptor> NumberingDescriptorPtr;
|
||||
|
||||
class NumberingDescriptor : public IVisitable
|
||||
{
|
||||
friend class ListTable;
|
||||
friend class NumberingMapping;
|
||||
|
||||
private:
|
||||
|
||||
size_t id;
|
||||
unsigned char nfc;
|
||||
unsigned char cbTextBefore;
|
||||
unsigned char cbTextAfter;
|
||||
@ -121,9 +129,15 @@ namespace DocFileFormat
|
||||
std::wstring xst; //32 chars ansi
|
||||
|
||||
public:
|
||||
|
||||
bool operator == (const NumberingDescriptor & val) const;
|
||||
bool operator == (const NumberingDescriptorPtr & val) const;
|
||||
|
||||
virtual ~NumberingDescriptor(){}
|
||||
// Parses the given StreamReader to retrieve a ANLD struct
|
||||
NumberingDescriptor( unsigned char * data, int length ); //cbANLD (count of bytes of ANLD) is 52
|
||||
|
||||
static NumberingDescriptorPtr create(unsigned char * data, int length);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -38,7 +38,6 @@ namespace DocFileFormat
|
||||
{
|
||||
ListTable::~ListTable()
|
||||
{
|
||||
for_each( this->listData.begin(), this->listData.end(), DeleteDynamicObject() );
|
||||
}
|
||||
|
||||
ListTable::ListTable( FileInformationBlock* fib, POLE::Stream* tableStream )
|
||||
@ -59,23 +58,32 @@ namespace DocFileFormat
|
||||
//read the LSTF structs
|
||||
for ( int i = 0; i < count; i++ )
|
||||
{
|
||||
listData.push_back( new ListData( &reader, ListData::VARIABLE_LENGTH ) );
|
||||
listData.push_back( ListData::create( &reader, ListData::VARIABLE_LENGTH ) );
|
||||
}
|
||||
|
||||
//read the LVLF structs
|
||||
for ( std::list<ListData*>::iterator iter = listData.begin(); iter != listData.end(); iter++ )
|
||||
for ( size_t i = 0; i < listData.size(); ++i)
|
||||
{
|
||||
for ( unsigned int j = 0; j < (*iter)->rglvl->size(); j++ )
|
||||
for ( size_t j = 0; j < listData[i]->rglvl->size(); j++ )
|
||||
{
|
||||
(*iter)->rglvl->operator []( j ) = new ListLevel( &reader, ListData::VARIABLE_LENGTH );
|
||||
listData[i]->rglvl->operator []( j ) = new ListLevel( &reader, ListData::VARIABLE_LENGTH );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ListTable::appendNumbering( const NumberingDescriptor & desc )
|
||||
size_t ListTable::appendNumbering( NumberingDescriptorPtr &desc )
|
||||
{
|
||||
for (size_t i = 0; i < listNumbering.size(); ++i)
|
||||
{
|
||||
if (listNumbering[i]->operator==(desc))
|
||||
{
|
||||
return listNumbering[i]->id;
|
||||
}
|
||||
}
|
||||
desc->id = listData.size() + listNumbering.size()/* + 1*/;
|
||||
listNumbering.push_back(desc);
|
||||
return desc->id;
|
||||
}
|
||||
|
||||
}
|
||||
@ -41,12 +41,12 @@ namespace DocFileFormat
|
||||
class ListTable: public IVisitable
|
||||
{
|
||||
public:
|
||||
std::list<ListData*> listData;
|
||||
std::list<NumberingDescriptor> listNumbering;
|
||||
std::vector<ListDataPtr> listData;
|
||||
std::vector<NumberingDescriptorPtr> listNumbering;
|
||||
|
||||
virtual ~ListTable();
|
||||
ListTable( FileInformationBlock* fib, POLE::Stream* tableStream );
|
||||
|
||||
void appendNumbering( const NumberingDescriptor & desc );
|
||||
size_t appendNumbering( NumberingDescriptorPtr &desc );
|
||||
};
|
||||
}
|
||||
@ -59,22 +59,27 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:w", OpenXmlNamespaces::WordprocessingML );
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:v", OpenXmlNamespaces::VectorML );
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:o", OpenXmlNamespaces::Office );
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:w10", OpenXmlNamespaces::OfficeWord );
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:r", OpenXmlNamespaces::Relationships );
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:w10", OpenXmlNamespaces::OfficeWord );
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:m", L"http://schemas.openxmlformats.org/officeDocument/2006/math");
|
||||
|
||||
//m_pXmlWriter->WriteAttribute(L"xmlns:wpc", L"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas");
|
||||
//m_pXmlWriter->WriteAttribute(L"xmlns:mc", L"http://schemas.openxmlformats.org/markup-compatibility/2006");
|
||||
//m_pXmlWriter->WriteAttribute(L"xmlns:wp14", L"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
|
||||
//m_pXmlWriter->WriteAttribute(L"xmlns:wp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
|
||||
//m_pXmlWriter->WriteAttribute(L"xmlns:w14", L"http://schemas.microsoft.com/office/word/2010/wordml");
|
||||
//m_pXmlWriter->WriteAttribute(L"xmlns:wpg", L"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
|
||||
//m_pXmlWriter->WriteAttribute(L"xmlns:wpi", L"http://schemas.microsoft.com/office/word/2010/wordprocessingInk");
|
||||
//m_pXmlWriter->WriteAttribute(L"xmlns:wne", L"http://schemas.microsoft.com/office/word/2006/wordml");
|
||||
//m_pXmlWriter->WriteAttribute(L"xmlns:wps", L"http://schemas.microsoft.com/office/word/2010/wordprocessingShape");
|
||||
//m_pXmlWriter->WriteAttribute(L"mc:Ignorable", L"w14 wp14");
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:wpc", L"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas");
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:cx", L"http://schemas.microsoft.com/office/drawing/2014/chartex");
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:cx1", L"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex");
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:mc", L"http://schemas.openxmlformats.org/markup-compatibility/2006");
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:wp14", L"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:wp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:w14", L"http://schemas.microsoft.com/office/word/2010/wordml");
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:w15", L"http://schemas.microsoft.com/office/word/2012/wordml");
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:w16se", L"http://schemas.microsoft.com/office/word/2015/wordml/symex");
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:wpg", L"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:wpi", L"http://schemas.microsoft.com/office/word/2010/wordprocessingInk");
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:wne", L"http://schemas.microsoft.com/office/word/2006/wordml");
|
||||
m_pXmlWriter->WriteAttribute(L"xmlns:wps", L"http://schemas.microsoft.com/office/word/2010/wordprocessingShape");
|
||||
m_pXmlWriter->WriteAttribute(L"mc:Ignorable", L"w14 w15 w16se wp14");
|
||||
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
if ((m_document->GetOfficeArt()) && (m_document->GetOfficeArt()->GetShapeBackgound()))
|
||||
{
|
||||
|
||||
@ -78,7 +78,14 @@ public:
|
||||
|
||||
return rdUShort;
|
||||
}
|
||||
|
||||
void WriteUInt16(unsigned short val)
|
||||
{
|
||||
if (m_Data)
|
||||
{
|
||||
((unsigned short *)(m_Data + m_Position))[0] = val;
|
||||
m_Position += sizeof(unsigned short);
|
||||
}
|
||||
}
|
||||
virtual short ReadInt16()
|
||||
{
|
||||
short rdShort = 0;
|
||||
@ -104,7 +111,14 @@ public:
|
||||
|
||||
return rdInt;
|
||||
}
|
||||
|
||||
void WriteInt32(_INT32 val)
|
||||
{
|
||||
if (m_Data)
|
||||
{
|
||||
((_INT32 *)(m_Data + m_Position))[0] = val;
|
||||
m_Position += sizeof(_INT32);
|
||||
}
|
||||
}
|
||||
virtual unsigned int ReadUInt32()
|
||||
{
|
||||
int rdUInt = 0;
|
||||
@ -117,7 +131,22 @@ public:
|
||||
|
||||
return rdUInt;
|
||||
}
|
||||
|
||||
void WriteByte(unsigned char val)
|
||||
{
|
||||
if (m_Data)
|
||||
{
|
||||
m_Data[m_Position] = val;
|
||||
m_Position += 1;
|
||||
}
|
||||
}
|
||||
void WriteUInt32(_UINT32 val)
|
||||
{
|
||||
if (m_Data)
|
||||
{
|
||||
((_UINT32 *)(m_Data + m_Position))[0] = val;
|
||||
m_Position += sizeof(_UINT32);
|
||||
}
|
||||
}
|
||||
virtual unsigned char ReadByte()
|
||||
{
|
||||
unsigned char rdByte = 0;
|
||||
@ -159,6 +188,14 @@ public:
|
||||
|
||||
return pBytes;
|
||||
}
|
||||
void WriteBytes(unsigned char* pData, int size)
|
||||
{
|
||||
if (m_Data)
|
||||
{
|
||||
memcpy(m_Data + m_Position, pData, size);
|
||||
m_Position += size;
|
||||
}
|
||||
}
|
||||
|
||||
virtual unsigned long GetPosition() const
|
||||
{
|
||||
@ -172,7 +209,7 @@ public:
|
||||
|
||||
virtual int Seek (int offset, int origin = 0/*STREAM_SEEK_SET*/)
|
||||
{
|
||||
if ( (m_Data != NULL) && (offset > 0) && ((unsigned int)offset < m_Size) )
|
||||
if ( (m_Data != NULL) && (offset >= 0) && ((unsigned int)offset < m_Size) )
|
||||
return m_Position = offset;
|
||||
|
||||
return 0;
|
||||
@ -180,7 +217,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
unsigned char* m_Data;
|
||||
unsigned char* m_Data;
|
||||
unsigned long m_Size;
|
||||
unsigned long m_Position;
|
||||
bool bMemoryCopy;
|
||||
|
||||
@ -72,33 +72,42 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:o", OpenXmlNamespaces::Office );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:w10", OpenXmlNamespaces::OfficeWord );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:r", OpenXmlNamespaces::Relationships );
|
||||
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wpc", L"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:mc", L"http://schemas.openxmlformats.org/markup-compatibility/2006");
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wp14", L"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:w14", L"http://schemas.microsoft.com/office/word/2010/wordml" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wpg", L"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wpi", L"http://schemas.microsoft.com/office/word/2010/wordprocessingInk" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wne", L"http://schemas.microsoft.com/office/word/2006/wordml" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wps", L"http://schemas.microsoft.com/office/word/2010/wordprocessingShape" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:m", L"http://schemas.openxmlformats.org/officeDocument/2006/math" );
|
||||
m_pXmlWriter->WriteAttribute( L"mc:Ignorable", L"w14 wp14" );
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
PictureBulletsMapping();
|
||||
|
||||
int i = 0;
|
||||
|
||||
for (std::list<ListData*>::iterator iter = rglst->listData.begin(); iter != rglst->listData.end(); ++iter, ++i)
|
||||
for (size_t i = 0; i < rglst->listData.size(); ++i)
|
||||
{
|
||||
//start abstractNum
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:abstractNum", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::IntToWideString( i ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::IntToWideString( i /*+ 1 */));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
//nsid
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:nsid", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToFormattedWideString( (*iter)->lsid, L"%08x" ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToFormattedWideString( rglst->listData[i]->lsid, L"%08x" ));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
|
||||
//multiLevelType
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:multiLevelType", TRUE );
|
||||
|
||||
if ( (*iter)->fHybrid )
|
||||
if ( rglst->listData[i]->fHybrid )
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", L"hybridMultilevel" );
|
||||
}
|
||||
else if ( (*iter)->fSimpleList )
|
||||
else if ( rglst->listData[i]->fSimpleList )
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", L"singleLevel" );
|
||||
}
|
||||
@ -111,32 +120,32 @@ namespace DocFileFormat
|
||||
|
||||
//template
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:tmpl", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToFormattedWideString( (*iter)->tplc, L"%08x"));
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToFormattedWideString( rglst->listData[i]->tplc, L"%08x"));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
|
||||
// writes the levels
|
||||
size_t length = (*iter)->rglvl->size();
|
||||
size_t length = rglst->listData[i]->rglvl->size();
|
||||
|
||||
for (size_t j = 0; j < length; ++j)
|
||||
{
|
||||
ListLevel* lvl = (*iter)->rglvl->at(j);
|
||||
LevelMapping(lvl, j, (*iter)->rgistd[j]);
|
||||
ListLevel* lvl = rglst->listData[i]->rglvl->at(j);
|
||||
LevelMapping(lvl, j, rglst->listData[i]->rgistd[j]);
|
||||
}
|
||||
|
||||
//end abstractNum
|
||||
m_pXmlWriter->WriteNodeEnd( L"w:abstractNum" );
|
||||
}
|
||||
//write old style numbering (сложносоставных не сущестует)
|
||||
for (std::list<NumberingDescriptor>::iterator iter = rglst->listNumbering.begin(); iter != rglst->listNumbering.end(); ++iter, ++i)
|
||||
for (size_t i = 0; i < rglst->listNumbering.size(); ++i)
|
||||
{
|
||||
//start abstractNum
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:abstractNum", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::IntToWideString( i ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::IntToWideString( rglst->listNumbering[i]->id ));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
////nsid
|
||||
//m_pXmlWriter->WriteNodeBegin( L"w:nsid", TRUE );
|
||||
//m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToFormattedWideString( (*iter)->lsid, L"%08x" ) ));
|
||||
//m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToFormattedWideString( rglst->listNumbering[i]->lsid, L"%08x" ) ));
|
||||
//m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
|
||||
//multiLevelType
|
||||
@ -147,14 +156,14 @@ namespace DocFileFormat
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
|
||||
LevelMapping(*iter, 0);
|
||||
LevelMapping(rglst->listNumbering[i], 0);
|
||||
|
||||
//end abstractNum
|
||||
m_pXmlWriter->WriteNodeEnd( L"w:abstractNum" );
|
||||
}
|
||||
|
||||
//write the overrides
|
||||
for (unsigned int i = 0; i < m_document->listFormatOverrideTable->size(); ++i)
|
||||
for (size_t i = 0; i < m_document->listFormatOverrideTable->size(); ++i)
|
||||
{
|
||||
ListFormatOverride* lfo = m_document->listFormatOverrideTable->at(i);
|
||||
|
||||
@ -193,16 +202,15 @@ namespace DocFileFormat
|
||||
|
||||
if (m_document->listFormatOverrideTable->empty() && !rglst->listNumbering.empty())
|
||||
{
|
||||
i = 0;
|
||||
for (std::list<NumberingDescriptor>::iterator iter = rglst->listNumbering.begin(); iter != rglst->listNumbering.end(); ++iter, ++i)
|
||||
for (size_t i = 0; i < rglst->listNumbering.size(); ++i)
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:num", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:numId", FormatUtils::IntToWideString(i+1));
|
||||
m_pXmlWriter->WriteAttribute( L"w:numId", FormatUtils::IntToWideString(rglst->listNumbering[i]->id));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:abstractNumId", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToWideString( i ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToWideString( rglst->listNumbering[i]->id ));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd(L"w:num");
|
||||
@ -215,21 +223,20 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
int NumberingMapping::FindIndexbyId(const std::list<ListData*>& listData, int id)
|
||||
int NumberingMapping::FindIndexbyId(std::vector<ListDataPtr>& listData, int lsid)
|
||||
{
|
||||
int ret = -1;
|
||||
int i = 0;
|
||||
|
||||
for (std::list<ListData*>::const_iterator iter = listData.begin(); iter != listData.end(); ++iter, ++i)
|
||||
for (size_t i = 0; i < listData.size(); ++i)
|
||||
{
|
||||
if ((*iter)->lsid == id)
|
||||
if (listData[i]->lsid == lsid)
|
||||
{
|
||||
ret = i;
|
||||
break;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Converts the number text of the binary format to the number text of OOXML.
|
||||
@ -288,15 +295,17 @@ namespace DocFileFormat
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::wstring NumberingMapping::GetLvlText(const NumberingDescriptor& lvl, bool bIsSymbol, int Before, int After) const
|
||||
std::wstring NumberingMapping::GetLvlText(NumberingDescriptorPtr& lvl, bool bIsSymbol, int Before, int After) const
|
||||
{
|
||||
if (!lvl)return L"";
|
||||
|
||||
std::wstring ret;
|
||||
|
||||
if (lvl.nfc == 0xff)
|
||||
if (lvl->nfc == 0xff)
|
||||
{
|
||||
if (!lvl.xst.empty())
|
||||
if (!lvl->xst.empty())
|
||||
{
|
||||
wchar_t xchBullet = lvl.xst[0];
|
||||
wchar_t xchBullet = lvl->xst[0];
|
||||
|
||||
// В символьном шрифте обрезать надо, в других случаях - нет
|
||||
if (bIsSymbol && (xchBullet & 0xF000) != 0)
|
||||
@ -306,7 +315,7 @@ namespace DocFileFormat
|
||||
|
||||
if (!FormatUtils::IsControlSymbol(xchBullet))
|
||||
{
|
||||
ret.push_back(lvl.xst[0]);
|
||||
ret.push_back(lvl->xst[0]);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -316,8 +325,8 @@ namespace DocFileFormat
|
||||
}
|
||||
else
|
||||
{
|
||||
std::wstring strBefore = lvl.xst.substr(0, Before);
|
||||
std::wstring strAfter = lvl.xst.substr(Before, After);
|
||||
std::wstring strBefore = lvl->xst.substr(0, Before);
|
||||
std::wstring strAfter = lvl->xst.substr(Before, After);
|
||||
|
||||
ret = strBefore + L"%1" + strAfter ;
|
||||
}
|
||||
@ -473,14 +482,16 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
void NumberingMapping::LevelMapping(const NumberingDescriptor& lvl, unsigned int level)
|
||||
void NumberingMapping::LevelMapping(NumberingDescriptorPtr & lvl, unsigned int level)
|
||||
{
|
||||
if (!lvl) return;
|
||||
|
||||
std::wstring fontFamily;
|
||||
bool isSymbol = false;
|
||||
|
||||
if( lvl.ftc < m_document->FontTable->Data.size() )
|
||||
if( lvl->ftc < m_document->FontTable->Data.size() )
|
||||
{
|
||||
FontFamilyName* ffn = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( lvl.ftc ) );
|
||||
FontFamilyName* ffn = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( lvl->ftc ) );
|
||||
isSymbol = (ffn->chs == 2);
|
||||
fontFamily = FormatUtils::XmlEncode(ffn->xszFtn);
|
||||
}
|
||||
@ -491,22 +502,22 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:start", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToWideString(lvl.iStartAt));
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToWideString(lvl->iStartAt));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:numFmt", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", GetNumberFormatWideString(lvl.nfc, true));
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", GetNumberFormatWideString(lvl->nfc, true));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
|
||||
//// suffix
|
||||
// m_pXmlWriter->WriteNodeBegin( L"w:suff", TRUE );
|
||||
// m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::MapValueToWideString(lvl.ixchFollow, &FollowingCharMap[0][0], 3, 8));
|
||||
// m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::MapValueToWideString(lvl->ixchFollow, &FollowingCharMap[0][0], 3, 8));
|
||||
// m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
|
||||
// Number level text
|
||||
std::wstring lvlText = GetLvlText(lvl, isSymbol, lvl.cbTextBefore, lvl.cbTextAfter);
|
||||
std::wstring lvlText = GetLvlText(lvl, isSymbol, lvl->cbTextBefore, lvl->cbTextAfter);
|
||||
|
||||
//if (lvlText.empty() && lvl.ftc == 0)//auto
|
||||
//if (lvlText.empty() && lvl->ftc == 0)//auto
|
||||
//{
|
||||
// lvlText.push_back(L'\xF0B7');
|
||||
// lvlText.push_back(L'\0');
|
||||
@ -522,7 +533,7 @@ namespace DocFileFormat
|
||||
|
||||
// jc
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:lvlJc", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::MapValueToWideString(lvl.jc, &LevelJustificationMap[0][0], 3, 7));
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::MapValueToWideString(lvl->jc, &LevelJustificationMap[0][0], 3, 7));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
// pPr
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:pPr", FALSE );
|
||||
|
||||
@ -63,7 +63,7 @@ namespace DocFileFormat
|
||||
NumberingMapping(ConversionContext* ctx);
|
||||
void Apply(IVisitable* visited);
|
||||
|
||||
static int FindIndexbyId(const std::list<ListData*>& listData, int id);
|
||||
static int FindIndexbyId(std::vector<ListDataPtr>& listData, int id);
|
||||
/// Converts the number format code of the binary format.
|
||||
static std::wstring GetNumberFormatWideString(int nfc, int nWordVersion = 0);
|
||||
|
||||
@ -73,12 +73,12 @@ namespace DocFileFormat
|
||||
// Converts the number text of the binary format to the number text of OOXML.
|
||||
// OOXML uses different placeholders for the numbers.
|
||||
std::wstring GetLvlText(const ListLevel* lvl, bool bIsSymbol) const;
|
||||
std::wstring GetLvlText(const NumberingDescriptor& lvl, bool bIsSymbol, int Before, int After) const;
|
||||
std::wstring GetLvlText(NumberingDescriptorPtr& lvl, bool bIsSymbol, int Before, int After) const;
|
||||
|
||||
static bool IsPlaceholder(wchar_t symbol);
|
||||
|
||||
void LevelMapping(const ListLevel* lvl, unsigned int level, short styleIndex);
|
||||
void LevelMapping(const NumberingDescriptor& lvl, unsigned int level);
|
||||
void LevelMapping(NumberingDescriptorPtr & lvl, unsigned int level);
|
||||
|
||||
void PictureBulletsMapping();
|
||||
void WriteLevelPictureBullet(const CharacterPropertyExceptions* grpprlChpx);
|
||||
|
||||
@ -58,7 +58,7 @@ namespace DocFileFormat
|
||||
|
||||
public:
|
||||
|
||||
OfficeArtContent (const FileInformationBlock* pFIB, POLE::Stream* pStream): m_pDrawingGroupData(NULL), m_pBackgroud(NULL)
|
||||
OfficeArtContent (const FileInformationBlock* pFIB, POLE::Stream* pStream): m_pDrawingGroupData(NULL), m_pBackgroud(NULL), m_uLastShapeId(1024)
|
||||
{
|
||||
VirtualStreamReader oStearmReader(pStream, 0 , pFIB->m_nWordVersion);
|
||||
|
||||
@ -79,14 +79,13 @@ namespace DocFileFormat
|
||||
drawing.dgglbl = (DrawingType)oStearmReader.ReadByte();
|
||||
drawing.container = static_cast<DrawingContainer*>(RecordFactory::ReadRecord (&oStearmReader, 0));
|
||||
|
||||
for (unsigned int i = 0; i < drawing.container->Children.size(); ++i)
|
||||
for (size_t i = 0; i < drawing.container->Children.size(); ++i)
|
||||
{
|
||||
Record* groupChild = drawing.container->Children[i];
|
||||
if (groupChild)
|
||||
{
|
||||
if (GroupContainer::TYPE_CODE_0xF003 == groupChild->TypeCode)
|
||||
{
|
||||
// the child is a subgroup
|
||||
GroupContainer* group = static_cast<GroupContainer*>(groupChild);
|
||||
if (group)
|
||||
{
|
||||
@ -95,17 +94,24 @@ namespace DocFileFormat
|
||||
}
|
||||
else if (ShapeContainer::TYPE_CODE_0xF004 == groupChild->TypeCode)
|
||||
{
|
||||
// the child is a shape
|
||||
ShapeContainer* shape = static_cast<ShapeContainer*>(groupChild);
|
||||
if (shape)
|
||||
{
|
||||
shape->Index = i;
|
||||
if (shape->isBackground())
|
||||
shape->m_nIndex = i;
|
||||
if (shape->m_bBackground)
|
||||
{
|
||||
m_pBackgroud = shape;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (DrawingRecord::TYPE_CODE_0xF008 == groupChild->TypeCode)
|
||||
{
|
||||
DrawingRecord* dr = static_cast<DrawingRecord*>(groupChild);
|
||||
if (dr)
|
||||
{
|
||||
m_uLastShapeId = dr->spidCur;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,7 +140,7 @@ namespace DocFileFormat
|
||||
GroupContainer* group = iter->container->FirstChildWithType<GroupContainer>();
|
||||
if (group)
|
||||
{
|
||||
for (unsigned int i = 1; i < group->Children.size(); ++i)
|
||||
for (size_t i = 1; i < group->Children.size(); ++i)
|
||||
{
|
||||
Record* groupChild = group->Children[i];
|
||||
|
||||
@ -183,7 +189,7 @@ namespace DocFileFormat
|
||||
{
|
||||
return m_pDrawingGroupData;
|
||||
}
|
||||
|
||||
unsigned int m_uLastShapeId;
|
||||
private:
|
||||
ShapeContainer* m_pBackgroud;
|
||||
DrawingGroup* m_pDrawingGroupData;
|
||||
|
||||
@ -40,13 +40,13 @@ namespace DocFileFormat
|
||||
public:
|
||||
static const unsigned short TYPE_CODE_0xF010 = 0xF010;
|
||||
|
||||
ClientAnchor() : Record(), clientanchor(0)
|
||||
ClientAnchor() : Record(), value(0)
|
||||
{
|
||||
}
|
||||
|
||||
ClientAnchor (IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance) : Record (_reader, size, typeCode, version, instance), clientanchor(0)
|
||||
ClientAnchor (IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance) : Record (_reader, size, typeCode, version, instance), value(0)
|
||||
{
|
||||
clientanchor = Reader->ReadInt32();
|
||||
value = Reader->ReadInt32(); //index PlcfSpa
|
||||
}
|
||||
|
||||
virtual ~ClientAnchor()
|
||||
@ -58,8 +58,6 @@ namespace DocFileFormat
|
||||
return new ClientAnchor (_reader, bodySize, typeCode, version, instance);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
int clientanchor;
|
||||
unsigned int value;
|
||||
};
|
||||
}
|
||||
@ -38,30 +38,30 @@ namespace DocFileFormat
|
||||
class DrawingRecord: public Record
|
||||
{
|
||||
public:
|
||||
static const unsigned short TYPE_CODE_0xF008 = 0xF008;
|
||||
static const unsigned short TYPE_CODE_0xF008 = 0xF008;
|
||||
|
||||
unsigned int csp; // The number of shapes in this drawing
|
||||
int spidCur; // The last MSOSPID given to an SP in this DG
|
||||
unsigned int csp; // The number of shapes in this drawing
|
||||
unsigned int spidCur; // The last MSOSPID given to an SP in this DG
|
||||
|
||||
DrawingRecord():
|
||||
Record(), csp(0), spidCur(0)
|
||||
{
|
||||
}
|
||||
DrawingRecord():
|
||||
Record(), csp(0), spidCur(0)
|
||||
{
|
||||
}
|
||||
|
||||
DrawingRecord( IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance ):
|
||||
Record( _reader, size, typeCode, version, instance )
|
||||
{
|
||||
DrawingRecord( IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance ):
|
||||
Record( _reader, size, typeCode, version, instance )
|
||||
{
|
||||
csp = Reader->ReadUInt32();
|
||||
spidCur = Reader->ReadInt32();
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~DrawingRecord()
|
||||
{
|
||||
}
|
||||
virtual ~DrawingRecord()
|
||||
{
|
||||
}
|
||||
|
||||
virtual Record* NewObject( IBinaryReader* _reader, unsigned int bodySize, unsigned int typeCode, unsigned int version, unsigned int instance )
|
||||
{
|
||||
return new DrawingRecord( _reader, bodySize, typeCode, version, instance );
|
||||
}
|
||||
virtual Record* NewObject( IBinaryReader* _reader, unsigned int bodySize, unsigned int typeCode, unsigned int version, unsigned int instance )
|
||||
{
|
||||
return new DrawingRecord( _reader, bodySize, typeCode, version, instance );
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -65,7 +65,7 @@ namespace DocFileFormat
|
||||
{
|
||||
// the child is a shape
|
||||
ShapeContainer* shape = static_cast<ShapeContainer*>(groupChild);
|
||||
shape->Index = i;
|
||||
shape->m_nIndex = i;
|
||||
this->Children[i] = shape;
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,13 +50,9 @@ namespace DocFileFormat
|
||||
/*========================================================================================================*/
|
||||
|
||||
Record::Record( IBinaryReader* _reader, unsigned int bodySize, unsigned int typeCode, unsigned int version, unsigned int instance ):
|
||||
HeaderSize(0), BodySize(0), RawData(NULL), SiblingIdx(0), TypeCode(0), Version(0), Instance(0), Reader(NULL),
|
||||
HeaderSize(Record::HEADER_SIZE_IN_BYTES), BodySize(bodySize), RawData(NULL), SiblingIdx(0), TypeCode(typeCode), Version(version), Instance(instance), Reader(NULL),
|
||||
_ParentRecord(NULL)
|
||||
{
|
||||
BodySize = bodySize;
|
||||
TypeCode = typeCode;
|
||||
Version = version;
|
||||
Instance = instance;
|
||||
HeaderSize = Record::HEADER_SIZE_IN_BYTES;
|
||||
|
||||
int real_size = _reader->GetSize() - _reader->GetPosition();
|
||||
|
||||
@ -76,7 +76,7 @@ namespace DocFileFormat
|
||||
{
|
||||
result = pRecord->NewObject (reader, size, typeCode, version, instance);
|
||||
if (result)
|
||||
result->SiblingIdx = siblingIdx;
|
||||
result->SiblingIdx = siblingIdx;
|
||||
RELEASEOBJECT(pRecord);
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,11 +84,11 @@ namespace DocFileFormat
|
||||
{
|
||||
T* firstChildWithType = NULL;
|
||||
|
||||
for ( std::vector<Record*>::const_iterator iter = this->Children.begin(); iter != this->Children.end(); iter++ )
|
||||
for ( size_t i = 0; i < this->Children.size(); ++i )
|
||||
{
|
||||
if ( (*iter != NULL) && (typeid(T) == typeid(**iter)) )
|
||||
if ( (this->Children[i] != NULL) && (typeid(T) == typeid(*(this->Children[i]))) )
|
||||
{
|
||||
firstChildWithType = static_cast<T*>(*iter);
|
||||
firstChildWithType = static_cast<T*>(this->Children[i]);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
#include "RegularContainer.h"
|
||||
#include "ShapeOptions.h"
|
||||
#include "Shape.h"
|
||||
#include "ClientAnchor.h"
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
@ -42,30 +43,35 @@ namespace DocFileFormat
|
||||
public:
|
||||
static const unsigned short TYPE_CODE_0xF004 = 0xF004;
|
||||
|
||||
int Index;
|
||||
int m_nIndex;
|
||||
unsigned int m_nShapeType;
|
||||
bool m_bBackground;
|
||||
bool m_bOLE;
|
||||
bool m_bSkip;
|
||||
|
||||
ShapeContainer():
|
||||
RegularContainer(), Index(0)
|
||||
RegularContainer(), m_nIndex(0), m_nShapeType(0), m_bSkip(false), m_bBackground(false), m_bOLE(false)
|
||||
{
|
||||
}
|
||||
|
||||
ShapeContainer( IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance ):
|
||||
RegularContainer( _reader, size, typeCode, version, instance ), Index(0)
|
||||
ShapeContainer( IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance ) :
|
||||
m_bSkip(false), m_bBackground(false), m_bOLE(false), m_nIndex(0), m_nShapeType(0), RegularContainer( _reader, size, typeCode, version, instance )
|
||||
{
|
||||
}
|
||||
|
||||
int getShapeType()
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
for ( std::vector<Record*>::const_iterator iter = this->Children.begin(); iter != this->Children.end(); iter++ )
|
||||
for ( size_t i = 0; i < this->Children.size(); ++i )
|
||||
{
|
||||
Shape* sh = dynamic_cast<Shape*>( *iter );
|
||||
ClientAnchor *clientAnchor = dynamic_cast<ClientAnchor*>( this->Children[i] );
|
||||
if ( (clientAnchor) && (clientAnchor->value == 0x80000000))
|
||||
m_bSkip = true;
|
||||
|
||||
Shape* sh = dynamic_cast<Shape*>( this->Children[i] );
|
||||
if (sh)
|
||||
{
|
||||
m_bBackground = sh->fBackground;
|
||||
m_bOLE = sh->fOleShape;
|
||||
|
||||
if (sh->shapeType)
|
||||
{
|
||||
return sh->shapeType->GetTypeCode();
|
||||
m_nShapeType = sh->shapeType->GetTypeCode();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -76,44 +82,16 @@ namespace DocFileFormat
|
||||
{
|
||||
if (sh_options->OptionsByID.end() != sh_options->OptionsByID.find(Pib))
|
||||
{
|
||||
return msosptPictureFrame;
|
||||
m_nShapeType = msosptPictureFrame;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
bool isBackground()
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
for ( std::vector<Record*>::const_iterator iter = this->Children.begin(); iter != this->Children.end(); iter++ )
|
||||
{
|
||||
Shape* sh = dynamic_cast<Shape*>( *iter );
|
||||
if (sh)
|
||||
{
|
||||
return sh->fBackground;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool isOLE()
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
for ( std::vector<Record*>::const_iterator iter = this->Children.begin(); iter != this->Children.end(); iter++ )
|
||||
{
|
||||
Shape* sh = dynamic_cast<Shape*>( *iter );
|
||||
if (sh)
|
||||
{
|
||||
return sh->fOleShape;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
virtual ~ShapeContainer()
|
||||
{
|
||||
}
|
||||
@ -128,9 +106,9 @@ namespace DocFileFormat
|
||||
std::vector<OptionEntryPtr> ret;
|
||||
|
||||
//build the list of all option entries of this shape
|
||||
for ( std::vector<Record*>::const_iterator iter = this->Children.begin(); iter != this->Children.end(); iter++ )
|
||||
for ( size_t i = 0; i < this->Children.size(); ++i )
|
||||
{
|
||||
ShapeOptions* opt = dynamic_cast<ShapeOptions*>( *iter );
|
||||
ShapeOptions* opt = dynamic_cast<ShapeOptions*>( this->Children[i] );
|
||||
|
||||
if ( opt == NULL ) continue;
|
||||
|
||||
|
||||
@ -104,7 +104,7 @@ OleObject::OleObject( const CharacterPropertyExceptions* chpx, WordDocument* doc
|
||||
szData = szData >> 16;
|
||||
}
|
||||
unsigned char* bytes = reader.ReadBytes( szData, true );
|
||||
if (bytes)
|
||||
if (bytes && szData < 0xffff)
|
||||
{
|
||||
emeddedData = std::string((char*)bytes, szData);
|
||||
delete []bytes;
|
||||
|
||||
@ -422,12 +422,11 @@ namespace DocFileFormat
|
||||
//numbering
|
||||
case sprmOldPAnld:
|
||||
{
|
||||
NumberingDescriptor desc( iter->Arguments, iter->argumentsSize );
|
||||
NumberingDescriptorPtr desc = NumberingDescriptor::create( iter->Arguments, iter->argumentsSize );
|
||||
|
||||
if (m_document->listTable)
|
||||
{
|
||||
m_document->listTable->appendNumbering( desc );
|
||||
short numId = static_cast<short>(m_document->listTable->listNumbering.size());
|
||||
unsigned short numId = m_document->listTable->appendNumbering( desc );
|
||||
appendValueElement( &numPr, L"numId", numId, true );
|
||||
}
|
||||
}break;
|
||||
@ -460,7 +459,8 @@ namespace DocFileFormat
|
||||
//Todo разобраться с закоментированным кодом
|
||||
if (NULL != m_document->listTable && false == m_document->listTable->listData.empty())
|
||||
{
|
||||
appendValueElement( &numPr, L"numId", FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize ), true );
|
||||
unsigned short numId = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
appendValueElement( &numPr, L"numId", numId, true );
|
||||
}
|
||||
|
||||
//check if there is a ilvl reference, if not, check the count of LVLs.
|
||||
@ -566,14 +566,35 @@ namespace DocFileFormat
|
||||
|
||||
case sprmOldPDxaAbs:
|
||||
case sprmPDxaAbs:
|
||||
appendValueAttribute( _framePr, L"w:x", FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
break;
|
||||
|
||||
{
|
||||
unsigned short val = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
switch (val)
|
||||
{
|
||||
case 0x0000: break; //left
|
||||
case 0xfffc: appendValueAttribute( _framePr, L"w:xAlign", L"center"); break;
|
||||
case 0xfff8: appendValueAttribute( _framePr, L"w:xAlign", L"right"); break;
|
||||
case 0xfff4: appendValueAttribute( _framePr, L"w:xAlign", L"inside"); break;
|
||||
case 0xfff0: appendValueAttribute( _framePr, L"w:xAlign", L"outside"); break;
|
||||
default:
|
||||
appendValueAttribute( _framePr, L"w:x", (short)val);
|
||||
}
|
||||
}break;
|
||||
case sprmOldPDyaAbs:
|
||||
case sprmPDyaAbs:
|
||||
appendValueAttribute( _framePr, L"w:y", FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
break;
|
||||
|
||||
{
|
||||
unsigned short val = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
switch (val)
|
||||
{
|
||||
case 0x0000: break; //inline
|
||||
case 0xfffc: appendValueAttribute( _framePr, L"w:yAlign", L"top"); break;
|
||||
case 0xfff8: appendValueAttribute( _framePr, L"w:yAlign", L"center"); break;
|
||||
case 0xfff4: appendValueAttribute( _framePr, L"w:yAlign", L"bottom"); break;
|
||||
case 0xfff0: appendValueAttribute( _framePr, L"w:yAlign", L"inside"); break;
|
||||
case 0xffec: appendValueAttribute( _framePr, L"w:yAlign", L"outside"); break;
|
||||
default:
|
||||
appendValueAttribute( _framePr, L"w:y", (short)val );
|
||||
}
|
||||
}break;
|
||||
case sprmPWHeightAbs:
|
||||
appendValueAttribute( _framePr, L"w:h", FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
break;
|
||||
|
||||
@ -48,6 +48,7 @@ namespace DocFileFormat
|
||||
std::vector<ByteStructure*> Elements;
|
||||
bool m_bIsValid;
|
||||
|
||||
std::map<int, int> mapCP;
|
||||
public:
|
||||
Plex(int structureLength, POLE::Stream* stream, unsigned int fc, unsigned int lcb, int nWordVersion)
|
||||
: m_bIsValid(false), CP_LENGTH(/*nWordVersion == 2 ? 2 :*/ 4)
|
||||
@ -77,7 +78,10 @@ namespace DocFileFormat
|
||||
|
||||
for (int i = 0; i < (n + 1); ++i)
|
||||
{
|
||||
CharacterPositions.push_back(reader.ReadInt32());
|
||||
int val = reader.ReadInt32();
|
||||
|
||||
mapCP.insert(std::make_pair(val, (int)CharacterPositions.size()));
|
||||
CharacterPositions.push_back(val);
|
||||
}
|
||||
|
||||
// read the n structs
|
||||
@ -96,9 +100,9 @@ namespace DocFileFormat
|
||||
|
||||
~Plex()
|
||||
{
|
||||
for (std::vector<ByteStructure*>::iterator iter = Elements.begin(); iter != Elements.end(); ++iter)
|
||||
for (size_t i = 0; i < Elements.size(); ++i)
|
||||
{
|
||||
RELEASEOBJECT(*iter);
|
||||
RELEASEOBJECT(Elements[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,15 +113,14 @@ namespace DocFileFormat
|
||||
{
|
||||
int index = -1;
|
||||
|
||||
for (int i = 0; i < (int)CharacterPositions.size(); ++i)
|
||||
std::map<int, int>::iterator pFind = mapCP.find(cp);
|
||||
|
||||
if (pFind != mapCP.end())
|
||||
{
|
||||
if (CharacterPositions[i] == cp)
|
||||
{
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
index = pFind->second;
|
||||
}
|
||||
|
||||
|
||||
if ((index >= 0) && (index < (int)Elements.size()))
|
||||
return this->Elements[index];
|
||||
|
||||
@ -128,13 +131,11 @@ namespace DocFileFormat
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
for (int i = 0; i < (int)CharacterPositions.size(); ++i)
|
||||
std::map<int, int>::const_iterator pFind = mapCP.find(cp);
|
||||
|
||||
if (pFind != mapCP.end())
|
||||
{
|
||||
if (CharacterPositions[i] == cp)
|
||||
{
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -142,7 +143,7 @@ namespace DocFileFormat
|
||||
|
||||
inline int operator [] (unsigned int index) const
|
||||
{
|
||||
if (index < CharacterPositions.size())
|
||||
if (index < (unsigned int)CharacterPositions.size())
|
||||
return CharacterPositions[index];
|
||||
|
||||
return -1;
|
||||
|
||||
@ -320,6 +320,18 @@ namespace DocFileFormat
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (_gridSpan <= 1 && nComputedCellWidth > _width && _width > 1)
|
||||
{
|
||||
int width_current = 0;
|
||||
for (int i = _gridIndex; i < _grid->size(); i++)
|
||||
{
|
||||
width_current += _grid->at(i);
|
||||
if (width_current >= nComputedCellWidth)
|
||||
break;
|
||||
_gridSpan++;
|
||||
}
|
||||
_width = nComputedCellWidth;
|
||||
}
|
||||
|
||||
XMLTools::XMLElement tcW ( L"w:tcW" );
|
||||
|
||||
@ -333,22 +345,23 @@ namespace DocFileFormat
|
||||
_tcPr->AppendChild( tcW );
|
||||
|
||||
|
||||
//if ( ( _gridIndex < (int)_grid->size() ) && ( nComputedCellWidth > _grid->at( _gridIndex ) ) )
|
||||
//{
|
||||
// //check the number of merged cells
|
||||
// int w = _grid->at( _gridIndex );
|
||||
if ( _gridSpan == 1 && ( _gridIndex < (int)_grid->size() ) && ( nComputedCellWidth > _grid->at( _gridIndex ) ) )
|
||||
{
|
||||
//check the number of merged cells
|
||||
int w = _grid->at( _gridIndex );
|
||||
|
||||
// for ( size_t i = _gridIndex + 1; i < _grid->size(); i++ )
|
||||
// {
|
||||
// _gridSpan++;
|
||||
for ( size_t i = _gridIndex + 1; i < _grid->size(); i++ )
|
||||
{
|
||||
_gridSpan++;
|
||||
|
||||
// w += _grid->at( i );
|
||||
w += _grid->at( i );
|
||||
|
||||
// if ( w >= nComputedCellWidth )
|
||||
// {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
if ( w >= nComputedCellWidth )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_gridSpan > 1)
|
||||
{
|
||||
appendValueElement( _tcPr, L"gridSpan", FormatUtils::IntToWideString( _gridSpan ), true );
|
||||
|
||||
@ -156,9 +156,8 @@ namespace DocFileFormat
|
||||
}break;
|
||||
|
||||
//div id
|
||||
case sprmTIpgp:
|
||||
case sprmTIpgp:// = PGPInfo.ipgpSelf (PGPInfo structure describes the border and margin properties)
|
||||
{
|
||||
appendValueElement( _trPr, L"divId", FormatUtils::IntToWideString( FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize ) ), true );
|
||||
}break;
|
||||
|
||||
//borders 80 exceptions
|
||||
|
||||
@ -142,7 +142,7 @@ namespace DocFileFormat
|
||||
{
|
||||
newXmlString.clear();
|
||||
|
||||
std::wstring sTempFolder = m_ctx->_doc->m_sTempFolder;
|
||||
std::wstring sTempFolder = m_context->_doc->m_sTempFolder;
|
||||
if (sTempFolder.empty())
|
||||
{
|
||||
sTempFolder = NSFile::CFileBinary::GetTempPath();
|
||||
@ -211,7 +211,7 @@ namespace DocFileFormat
|
||||
|
||||
VMLPictureMapping::VMLPictureMapping(ConversionContext* ctx, XMLTools::CStringXmlWriter* writer, bool olePreview, IMapping* caller, bool isInlinePicture) : PropertiesMapping(writer)
|
||||
{
|
||||
m_ctx = ctx;
|
||||
m_context = ctx;
|
||||
m_isOlePreview = olePreview;
|
||||
m_imageData = NULL;
|
||||
m_nImageId = 0;
|
||||
@ -229,7 +229,18 @@ namespace DocFileFormat
|
||||
{
|
||||
RELEASEOBJECT(m_imageData);
|
||||
}
|
||||
std::wstring VMLPictureMapping::GetShapeID(const Shape* pShape) const
|
||||
{
|
||||
std::wstring strXmlAttr;
|
||||
|
||||
if (NULL != pShape)
|
||||
{
|
||||
strXmlAttr += std::wstring(L"_x0000_i");
|
||||
strXmlAttr += FormatUtils::IntToWideString(pShape->GetShapeID());
|
||||
}
|
||||
|
||||
return strXmlAttr;
|
||||
}
|
||||
void VMLPictureMapping::Apply( IVisitable* visited )
|
||||
{
|
||||
PictureDescriptor* pict = dynamic_cast<PictureDescriptor*>(visited);
|
||||
@ -248,13 +259,14 @@ namespace DocFileFormat
|
||||
std::vector<OptionEntryPtr> options;
|
||||
|
||||
PictureFrameType type;
|
||||
Shape* pShape = NULL;
|
||||
if ((pict->shapeContainer || pict->blipStoreEntry) && pict->shapeContainer->Children.size() > 0)
|
||||
{
|
||||
Shape* shape = static_cast<Shape*>(*(pict->shapeContainer->Children.begin()));
|
||||
options = pict->shapeContainer->ExtractOptions();
|
||||
pShape = static_cast<Shape*>(*(pict->shapeContainer->Children.begin()));
|
||||
options = pict->shapeContainer->ExtractOptions();
|
||||
|
||||
//v:shapetype
|
||||
type.SetType(shape->Instance);
|
||||
type.SetType(pShape->Instance);
|
||||
|
||||
VMLShapeTypeMapping* vmlShapeTypeMapping = new VMLShapeTypeMapping( m_pXmlWriter, m_isInlinePicture );
|
||||
|
||||
@ -265,13 +277,16 @@ namespace DocFileFormat
|
||||
{
|
||||
type.SetType(msosptPictureFrame);
|
||||
}
|
||||
m_pXmlWriter->WriteNodeBegin( L"v:shape", true );
|
||||
m_pXmlWriter->WriteNodeBegin( L"v:shape", true );
|
||||
|
||||
//m_shapeId = GetShapeID(pShape); - todooo одинаковые картинки (одинаковый spid) - Anexo№3.doc
|
||||
|
||||
|
||||
count_vml_objects++;
|
||||
|
||||
if (m_shapeId.empty())
|
||||
m_shapeId = L"_x0000_s" + FormatUtils::IntToWideString(1024 + count_vml_objects);
|
||||
{
|
||||
m_context->_doc->GetOfficeArt()->m_uLastShapeId++;
|
||||
m_shapeId = L"_x0000_i" + FormatUtils::IntToWideString(m_context->_doc->GetOfficeArt()->m_uLastShapeId);
|
||||
}
|
||||
|
||||
m_pXmlWriter->WriteAttribute( L"id", m_shapeId);
|
||||
|
||||
@ -309,24 +324,28 @@ namespace DocFileFormat
|
||||
}break;
|
||||
//BORDERS
|
||||
case borderBottomColor:
|
||||
if (!pict->brcBottom)
|
||||
{
|
||||
RGBColor bottomColor( (int)iter->op, RedFirst );
|
||||
m_pXmlWriter->WriteAttribute( L"o:borderbottomcolor", L"#" + bottomColor.SixDigitHexCode);
|
||||
}
|
||||
break;
|
||||
case borderLeftColor:
|
||||
if (!pict->brcLeft)
|
||||
{
|
||||
RGBColor leftColor( (int)iter->op, RedFirst );
|
||||
m_pXmlWriter->WriteAttribute( L"o:borderleftcolor", L"#" + leftColor.SixDigitHexCode);
|
||||
}
|
||||
break;
|
||||
case borderRightColor:
|
||||
if (!pict->brcRight)
|
||||
{
|
||||
RGBColor rightColor( (int)iter->op, RedFirst );
|
||||
m_pXmlWriter->WriteAttribute( L"o:borderrightcolor", L"#" + rightColor.SixDigitHexCode);
|
||||
}
|
||||
break;
|
||||
case borderTopColor:
|
||||
if (!pict->brcTop)
|
||||
{
|
||||
RGBColor topColor( (int)iter->op, RedFirst );
|
||||
m_pXmlWriter->WriteAttribute( L"o:bordertopcolor", L"#" + topColor.SixDigitHexCode);
|
||||
@ -443,14 +462,15 @@ namespace DocFileFormat
|
||||
}
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
//v:imageData
|
||||
if (CopyPicture(pict))
|
||||
{
|
||||
//v:imageData
|
||||
appendValueAttribute(m_imageData, L"r:id", L"rId" + FormatUtils::IntToWideString(m_nImageId));
|
||||
appendValueAttribute(m_imageData, L"o:title", L"" );
|
||||
m_pXmlWriter->WriteString(m_imageData->GetXMLString());
|
||||
}
|
||||
|
||||
|
||||
{//borders
|
||||
writePictureBorder( L"bordertop", pict->brcTop );
|
||||
writePictureBorder( L"borderleft", pict->brcLeft );
|
||||
@ -510,10 +530,10 @@ namespace DocFileFormat
|
||||
pict->embeddedData = newData;
|
||||
|
||||
}
|
||||
m_ctx->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(Global::msoblipDIB),
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(Global::msoblipDIB),
|
||||
std::vector<unsigned char>(pict->embeddedData, (pict->embeddedData + pict->embeddedDataSize)), Global::msoblipDIB));
|
||||
|
||||
m_nImageId = m_ctx->_docx->RegisterImage(m_caller, btWin32);
|
||||
m_nImageId = m_context->_docx->RegisterImage(m_caller, btWin32);
|
||||
result = true;
|
||||
}
|
||||
else if ((oBlipEntry != NULL) && (oBlipEntry->Blip != NULL))
|
||||
@ -530,7 +550,7 @@ namespace DocFileFormat
|
||||
unsigned char *newData = NULL;
|
||||
int newDataSize = metaBlip->oMetaFile.ToBuffer(newData);
|
||||
|
||||
m_ctx->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlipEntry->btWin32), std::vector<unsigned char>(newData, (newData + newDataSize))));
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlipEntry->btWin32), std::vector<unsigned char>(newData, (newData + newDataSize))));
|
||||
|
||||
RELEASEARRAYOBJECTS(newData);
|
||||
}
|
||||
@ -546,7 +566,7 @@ namespace DocFileFormat
|
||||
BitmapBlip* bitBlip = static_cast<BitmapBlip*>(oBlipEntry->Blip);
|
||||
if (bitBlip)
|
||||
{
|
||||
m_ctx->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlipEntry->btWin32),
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlipEntry->btWin32),
|
||||
std::vector<unsigned char>(bitBlip->m_pvBits, (bitBlip->m_pvBits + bitBlip->pvBitsSize)), oBlipEntry->btWin32));
|
||||
}
|
||||
}break;
|
||||
@ -557,7 +577,7 @@ namespace DocFileFormat
|
||||
}break;
|
||||
}
|
||||
|
||||
m_nImageId = m_ctx->_docx->RegisterImage(m_caller, oBlipEntry->btWin32);
|
||||
m_nImageId = m_context->_docx->RegisterImage(m_caller, oBlipEntry->btWin32);
|
||||
result = true;
|
||||
}
|
||||
|
||||
|
||||
@ -58,6 +58,7 @@ namespace DocFileFormat
|
||||
void writePictureBorder (const std::wstring & name, const BorderCode* brc);
|
||||
void appendStyleProperty( std::wstring* b, const std::wstring& propName, const std::wstring& propValue ) const;
|
||||
bool ParseEmbeddedEquation( const std::string & xmlString, std::wstring & newXmlString );
|
||||
std::wstring GetShapeID(const Shape* pShape) const;
|
||||
protected:
|
||||
/// Copies the picture from the binary stream to the zip archive
|
||||
/// and creates the relationships for the image.
|
||||
@ -77,7 +78,7 @@ namespace DocFileFormat
|
||||
std::wstring m_shapeId;
|
||||
private:
|
||||
|
||||
ConversionContext* m_ctx;
|
||||
ConversionContext* m_context;
|
||||
IMapping* m_caller;
|
||||
int m_nImageId;
|
||||
|
||||
|
||||
@ -235,10 +235,11 @@ namespace DocFileFormat
|
||||
|
||||
m_shapeId = GetShapeID(pShape);
|
||||
|
||||
count_vml_objects++;
|
||||
|
||||
if (m_shapeId.empty())
|
||||
m_shapeId = std::wstring(L"_x0000_s") + FormatUtils::IntToWideString(1024 + count_vml_objects);
|
||||
{
|
||||
m_context->_doc->GetOfficeArt()->m_uLastShapeId++;
|
||||
m_shapeId = std::wstring(L"_x0000_s") + FormatUtils::IntToWideString(m_context->_doc->GetOfficeArt()->m_uLastShapeId);
|
||||
}
|
||||
|
||||
m_pXmlWriter->WriteAttribute ( L"id", m_shapeId );
|
||||
|
||||
@ -249,7 +250,7 @@ namespace DocFileFormat
|
||||
freeform = false;
|
||||
m_pXmlWriter->WriteAttribute( L"type", (std::wstring(L"#") + VMLShapeTypeMapping::GenerateTypeId(pShape->GetShapeType())));
|
||||
}
|
||||
m_pXmlWriter->WriteAttribute( L"style", FormatUtils::XmlEncode(buildStyle(pShape, pAnchor, options, pContainer->Index)));
|
||||
m_pXmlWriter->WriteAttribute( L"style", FormatUtils::XmlEncode(buildStyle(pShape, pAnchor, options, pContainer->m_nIndex)));
|
||||
|
||||
if (pShape->is<LineType>())
|
||||
{
|
||||
@ -2265,9 +2266,10 @@ namespace DocFileFormat
|
||||
TwipsValue w( primitive->dxa );
|
||||
TwipsValue h( primitive->dya );
|
||||
|
||||
std::wstring strId = std::wstring(L"_x0000_s") + FormatUtils::IntToWideString(1024 + count_vml_objects);
|
||||
m_context->_doc->GetOfficeArt()->m_uLastShapeId++;
|
||||
|
||||
std::wstring strId = std::wstring(L"_x0000_s") + FormatUtils::IntToWideString(m_context->_doc->GetOfficeArt()->m_uLastShapeId);
|
||||
|
||||
count_vml_objects++;
|
||||
//m_pXmlWriter->WriteAttribute ( L"id") , strId);
|
||||
m_pXmlWriter->WriteAttribute ( L"o:spid", strId);
|
||||
|
||||
|
||||
@ -124,12 +124,12 @@ namespace DocFileFormat
|
||||
else if (_isInlineShape)
|
||||
{
|
||||
m_pXmlWriter->WriteString(L"<v:formulas><v:f eqn=\"if lineDrawn pixelLineWidth 0\"/>\
|
||||
<v:f eqn=\"sum @0 1 0\"/><v:f eqn=\"sum 0 0 @1\"/>\
|
||||
<v:f eqn=\"prod @2 1 2\"/><v:f eqn=\"prod @3 21600 pixelWidth\"/>\
|
||||
<v:f eqn=\"prod @3 21600 pixelHeight\"/><v:f eqn=\"sum @0 0 1\"/>\
|
||||
<v:f eqn=\"prod @6 1 2\"/><v:f eqn=\"prod @7 21600 pixelWidth\"/>\
|
||||
<v:f eqn=\"sum @8 21600 0\"/><v:f eqn=\"prod @7 21600 pixelHeight\"/>\
|
||||
<v:f eqn=\"sum @10 21600 0\"/></v:formulas>");
|
||||
<v:f eqn=\"sum @0 1 0\"/><v:f eqn=\"sum 0 0 @1\"/>\
|
||||
<v:f eqn=\"prod @2 1 2\"/><v:f eqn=\"prod @3 21600 pixelWidth\"/>\
|
||||
<v:f eqn=\"prod @3 21600 pixelHeight\"/><v:f eqn=\"sum @0 0 1\"/>\
|
||||
<v:f eqn=\"prod @6 1 2\"/><v:f eqn=\"prod @7 21600 pixelWidth\"/>\
|
||||
<v:f eqn=\"sum @8 21600 0\"/><v:f eqn=\"prod @7 21600 pixelHeight\"/>\
|
||||
<v:f eqn=\"sum @10 21600 0\"/></v:formulas>");
|
||||
}
|
||||
|
||||
// Path
|
||||
|
||||
@ -37,8 +37,6 @@
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
static int count_vml_objects = 0;
|
||||
|
||||
class VMLShapeTypeMapping: public PropertiesMapping, public IMapping
|
||||
{
|
||||
private:
|
||||
|
||||
@ -85,7 +85,7 @@ namespace DocFileFormat
|
||||
IndividualFootnotesPlex(NULL), FootnoteReferenceCharactersPlex(NULL), IndividualEndnotesPlex(NULL),
|
||||
EndnoteReferenceCharactersPlex(NULL), FieldsPlex(NULL), FootnoteDocumentFieldsPlex(NULL),
|
||||
EndnoteDocumentFieldsPlex(NULL), HeadersAndFootersDocumentFieldsPlex(NULL), HeaderStoriesPlex(NULL),
|
||||
AnnotationsReferencePlex(NULL), IndividualCommentsPlex(NULL), TextboxBreakPlex(NULL), TextboxBreakPlexHeader(NULL),
|
||||
AnnotationsReferencePlex(NULL), AnnotationsReferenceExPlex(NULL), IndividualCommentsPlex(NULL), TextboxBreakPlex(NULL), TextboxBreakPlexHeader(NULL),
|
||||
TextboxIndividualPlex(NULL),AssocNames(NULL), BookmarkAnnotNames(NULL), Captions(NULL), AutoCaptions(NULL), ListPlex(NULL),
|
||||
OfficeDrawingPlex(NULL), OfficeDrawingPlexHeader(NULL), SectionPlex(NULL), BookmarkStartPlex(NULL), BookmarkEndPlex(NULL),
|
||||
AutoTextPlex(NULL), AllPapxFkps(NULL), AllChpxFkps(NULL), AllPapx(NULL), AllPapxVector(NULL), AllSepx(NULL), Styles(NULL), listTable(NULL),
|
||||
@ -318,8 +318,8 @@ namespace DocFileFormat
|
||||
// Read all needed PLCFs
|
||||
if (FIB->m_RgLw97.ccpFtn > 0)
|
||||
{
|
||||
IndividualFootnotesPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcffndTxt, FIB->m_FibWord97.lcbPlcffndTxt, nWordVersion);
|
||||
FootnoteReferenceCharactersPlex = new Plex<FootnoteDescriptor>(FootnoteDescriptor::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcffndRef, FIB->m_FibWord97.lcbPlcffndRef, nWordVersion);
|
||||
IndividualFootnotesPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcffndTxt, FIB->m_FibWord97.lcbPlcffndTxt, nWordVersion);
|
||||
}
|
||||
|
||||
if (nWordVersion > 0 && FIB->m_FibWord97.lcbPlcPad > 0)
|
||||
@ -329,8 +329,8 @@ namespace DocFileFormat
|
||||
|
||||
if (FIB->m_RgLw97.ccpEdn > 0)
|
||||
{
|
||||
IndividualEndnotesPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfendTxt, FIB->m_FibWord97.lcbPlcfendTxt, nWordVersion);
|
||||
EndnoteReferenceCharactersPlex = new Plex<EndnoteDescriptor>(EndnoteDescriptor::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfendRef, FIB->m_FibWord97.lcbPlcfendRef, nWordVersion);
|
||||
IndividualEndnotesPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfendTxt, FIB->m_FibWord97.lcbPlcfendTxt, nWordVersion);
|
||||
}
|
||||
|
||||
if (FIB->m_RgLw97.ccpHdr > 0)
|
||||
@ -338,11 +338,16 @@ namespace DocFileFormat
|
||||
HeaderStoriesPlex = new Plex<EmptyStructure>( EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfHdd, FIB->m_FibWord97.lcbPlcfHdd, nWordVersion);
|
||||
}
|
||||
|
||||
if (FIB->m_RgLw97.ccpAtn > 0)
|
||||
if (FIB->m_RgLw97.ccpAtn > 0)
|
||||
{
|
||||
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);
|
||||
@ -417,7 +423,7 @@ namespace DocFileFormat
|
||||
AnnotationOwners = new AnnotationOwnerList (FIB, TableStream);
|
||||
}
|
||||
|
||||
if (m_pCallFunc)
|
||||
if (m_pCallFunc)
|
||||
{
|
||||
m_pCallFunc->OnProgress(m_pCallFunc->caller, DOC_ONPROGRESSEVENT_ID, 300000 );
|
||||
|
||||
@ -435,24 +441,24 @@ namespace DocFileFormat
|
||||
std::unordered_map<int, int> fonts_charsets;
|
||||
bool bFontsCodePage = false;
|
||||
|
||||
for ( std::vector<ByteStructure*>::iterator iter = FontTable->Data.begin(); !bFontsCodePage && iter != FontTable->Data.end(); iter++ )
|
||||
for ( size_t i = 0; FIB->m_FibWord97.lcbClx > 0 && !bFontsCodePage && i < FontTable->Data.size(); ++i)
|
||||
{
|
||||
FontFamilyName* font = dynamic_cast<FontFamilyName*>( *iter );
|
||||
FontFamilyName* font = dynamic_cast<FontFamilyName*>( FontTable->Data[i]);
|
||||
if (!font) continue;
|
||||
|
||||
if (fonts_charsets.find(font->chs) == fonts_charsets.end())
|
||||
{
|
||||
fonts_charsets.insert(std::make_pair(font->chs, font->ff));
|
||||
|
||||
for (int i = 0 ; i < sizeof(aCodePages) / 2; i++)
|
||||
{
|
||||
if (aCodePages[i][0] == font->chs && font->chs != 0)
|
||||
{
|
||||
nFontsCodePage = aCodePages[i][1];
|
||||
bFontsCodePage = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (size_t j = 0 ; j < 32; j++)
|
||||
{
|
||||
if (aCodePages[j][0] == font->chs && font->chs > 2)
|
||||
{
|
||||
nFontsCodePage = aCodePages[j][1];
|
||||
bFontsCodePage = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -465,7 +471,7 @@ namespace DocFileFormat
|
||||
Text = m_PieceTable->GetAllEncodingText (WordDocumentStream);
|
||||
}
|
||||
|
||||
if (FIB->m_FibWord97.lcbClx < 1 || ((Text) && (Text->empty())))
|
||||
if (FIB->m_FibWord97.lcbClx < 1 || ((Text) && (Text->empty())))
|
||||
{
|
||||
int cb = FIB->m_FibBase.fcMac - FIB->m_FibBase.fcMin;
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
|
||||
#include "../../DesktopEditor/raster/BgraFrame.h"
|
||||
#include "../../DesktopEditor/common/Directory.h"
|
||||
#include "../../DesktopEditor/common/SystemUtils.h"
|
||||
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/App.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Core.h"
|
||||
@ -224,7 +225,10 @@ namespace DocFileFormat
|
||||
OOX::CApp* pApp = new OOX::CApp(NULL);
|
||||
if (pApp)
|
||||
{
|
||||
pApp->SetApplication(L"ONLYOFFICE");
|
||||
std::wstring sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvApplicationName);
|
||||
if (sApplication.empty())
|
||||
sApplication = NSSystemUtils::gc_EnvApplicationNameDefault;
|
||||
pApp->SetApplication(sApplication);
|
||||
#if defined(INTVER)
|
||||
pApp->SetAppVersion(VALUE2STR(INTVER));
|
||||
#endif
|
||||
|
||||
@ -172,7 +172,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;USE_ATL_CSTRINGS;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;PPTX_DEF;PPT_DEF;ENABLE_PPT_TO_PPTX_CONVERT;AVS_USE_CONVERT_PPTX_TOCUSTOM_VML;DONT_WRITE_EMBEDDED_FONTS"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../DesktopEditor/xml/build/vs2005;../../DesktopEditor/xml/libxml2/include;../../DesktopEditor/freetype-2.5.2/include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_ATL_CSTRINGS;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;DONT_WRITE_EMBEDDED_FONTS"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;DONT_WRITE_EMBEDDED_FONTS"
|
||||
MinimalRebuild="false"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
@ -205,7 +205,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\..\..\..\Common\OfficeDrawing;"..\..\..\..\..\DesktopEditor\freetype-2.5.2\include";..\..\..\..\..\Common\OfficeDrawing\Shapes"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;DONT_WRITE_EMBEDDED_FONTS"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
@ -373,6 +373,10 @@
|
||||
RelativePath="..\..\XlsxSerializerCom\Writer\CSVWriter.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ASCOfficeDocxFile2\BinReader\CustormXmlWriter.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\DocxSerializer.cpp"
|
||||
>
|
||||
|
||||
76
ASCOfficeDocxFile2/BinReader/CustormXmlWriter.cpp
Normal file
76
ASCOfficeDocxFile2/BinReader/CustormXmlWriter.cpp
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "CustormXmlWriter.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/CustomXml.h"
|
||||
#include "../../ASCOfficePPTXFile/ASCOfficeDrawingConverter.h"
|
||||
|
||||
namespace Writers
|
||||
{
|
||||
CustomXmlWriter::CustomXmlWriter(std::wstring sDir, NSBinPptxRW::CDrawingConverter* pDrawingConverter):m_sDir(sDir),m_pDrawingConverter(pDrawingConverter)
|
||||
{
|
||||
m_nCount = 0;
|
||||
}
|
||||
std::wstring CustomXmlWriter::WriteCustomXml(const std::wstring& sUrl, const std::wstring& sXml)
|
||||
{
|
||||
m_nCount++;
|
||||
OOX::CCustomXMLProps oCustomXMLProps(NULL);
|
||||
OOX::CCustomXMLProps::CShemaRef* pShemaRef = new OOX::CCustomXMLProps::CShemaRef();
|
||||
pShemaRef->m_sUri = sUrl;
|
||||
//todo guid
|
||||
oCustomXMLProps.m_oItemID.FromString(L"{5D0AEA6B-E499-4EEF-98A3-AFBB261C493E}");
|
||||
oCustomXMLProps.m_oShemaRefs.Init();
|
||||
oCustomXMLProps.m_oShemaRefs->m_arrItems.push_back(pShemaRef);
|
||||
|
||||
std::wstring sCustomXmlPropsDir = m_sDir + FILE_SEPARATOR_STR;
|
||||
sCustomXmlPropsDir += OOX::FileTypes::CustomXmlProps.DefaultDirectory().GetPath();
|
||||
NSDirectory::CreateDirectories(sCustomXmlPropsDir);
|
||||
std::wstring sCustomXMLPropsFilename = OOX::FileTypes::CustomXmlProps.DefaultFileName().GetBasename();
|
||||
sCustomXMLPropsFilename += std::to_wstring(m_nCount) + OOX::FileTypes::CustomXmlProps.DefaultFileName().GetExtention();
|
||||
oCustomXMLProps.write(OOX::CPath(sCustomXmlPropsDir + FILE_SEPARATOR_STR + sCustomXMLPropsFilename), OOX::CPath(sCustomXmlPropsDir), *m_pDrawingConverter->GetContentTypes());
|
||||
|
||||
std::wstring sCustomXmlFilename;
|
||||
sCustomXmlFilename = OOX::FileTypes::CustomXml.DefaultFileName().GetBasename() + std::to_wstring(m_nCount);
|
||||
sCustomXmlFilename += OOX::FileTypes::CustomXml.DefaultFileName().GetExtention();
|
||||
std::wstring sCustomXmlDir = m_sDir + FILE_SEPARATOR_STR + OOX::FileTypes::CustomXml.DefaultDirectory().GetPath();
|
||||
std::wstring sCustomXmlRelsDir = sCustomXmlDir + FILE_SEPARATOR_STR + L"_rels";
|
||||
NSDirectory::CreateDirectories(sCustomXmlRelsDir);
|
||||
|
||||
m_pDrawingConverter->SetDstContentRels();
|
||||
long lId;
|
||||
m_pDrawingConverter->WriteRels(OOX::FileTypes::CustomXmlProps.RelationType(), sCustomXMLPropsFilename, L"", &lId);
|
||||
m_pDrawingConverter->SaveDstContentRels(sCustomXmlRelsDir + FILE_SEPARATOR_STR + sCustomXmlFilename + L".rels");
|
||||
|
||||
NSFile::CFileBinary::SaveToFile(sCustomXmlDir + FILE_SEPARATOR_STR + sCustomXmlFilename, sXml);
|
||||
return sCustomXmlFilename;
|
||||
}
|
||||
}
|
||||
54
ASCOfficeDocxFile2/BinReader/CustormXmlWriter.h
Normal file
54
ASCOfficeDocxFile2/BinReader/CustormXmlWriter.h
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#ifndef CUSTOM_XML_WRITER
|
||||
#define CUSTOM_XML_WRITER
|
||||
|
||||
#include "../../XlsxSerializerCom/Common/Common.h"
|
||||
|
||||
namespace NSBinPptxRW
|
||||
{
|
||||
class CDrawingConverter;
|
||||
}
|
||||
|
||||
namespace Writers
|
||||
{
|
||||
class CustomXmlWriter
|
||||
{
|
||||
int m_nCount;
|
||||
std::wstring m_sDir;
|
||||
NSBinPptxRW::CDrawingConverter* m_pDrawingConverter;
|
||||
public:
|
||||
CustomXmlWriter(std::wstring sDir, NSBinPptxRW::CDrawingConverter* pDrawingConverter);
|
||||
std::wstring WriteCustomXml(const std::wstring& sUrl, const std::wstring& sXml);
|
||||
};
|
||||
}
|
||||
#endif // #ifndef CUSTOM_XML_WRITER
|
||||
@ -66,12 +66,13 @@ xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawin
|
||||
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
|
||||
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
|
||||
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:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
|
||||
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
|
||||
xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" \
|
||||
mc:Ignorable=\"w14 wp14\">")));
|
||||
mc:Ignorable=\"w14 w15 wp14\">")));
|
||||
|
||||
oFile.WriteStringUTF8(m_oBackground.GetData());
|
||||
|
||||
|
||||
@ -47,6 +47,7 @@
|
||||
#include "DocumentRelsWriter.h"
|
||||
#include "webSettingsWriter.h"
|
||||
#include "DefaultThemeWriter.h"
|
||||
#include "CustormXmlWriter.h"
|
||||
|
||||
namespace BinDocxRW
|
||||
{
|
||||
@ -77,6 +78,7 @@ namespace Writers
|
||||
DocumentRelsWriter m_oDocumentRelsWriter;
|
||||
WebSettingsWriter m_oWebSettingsWriter;
|
||||
DefaultThemeWriter m_oTheme;
|
||||
CustomXmlWriter m_oCustomXmlWriter;
|
||||
|
||||
smart_ptr<OOX::VbaProject> m_pVbaProject;
|
||||
|
||||
@ -102,7 +104,8 @@ namespace Writers
|
||||
m_oDocumentRelsWriter (sDirOutput),
|
||||
m_oWebSettingsWriter (sDirOutput),
|
||||
m_nDocPrIndex(0),
|
||||
m_pComments(NULL)
|
||||
m_pComments(NULL),
|
||||
m_oCustomXmlWriter (sDirOutput, pDrawingConverter)
|
||||
{
|
||||
}
|
||||
int getNextDocPr()
|
||||
|
||||
@ -72,12 +72,13 @@ xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawin
|
||||
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
|
||||
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
|
||||
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:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
|
||||
xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" \
|
||||
mc:Ignorable=\"w14 wp14\">");
|
||||
mc:Ignorable=\"w14 w15 wp14\">");
|
||||
static std::wstring g_string_hdr_End = _T("</w:hdr>");
|
||||
|
||||
static std::wstring g_string_ftr_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\
|
||||
@ -92,18 +93,19 @@ xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawin
|
||||
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
|
||||
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
|
||||
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:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
|
||||
xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" \
|
||||
mc:Ignorable=\"w14 wp14\">");
|
||||
mc:Ignorable=\"w14 w15 wp14\">");
|
||||
static std::wstring g_string_ftr_End = _T("</w:ftr>");
|
||||
|
||||
static std::wstring g_string_footnotes_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:footnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/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\" mc:Ignorable=\"w14 wp14\">");
|
||||
static std::wstring g_string_footnotes_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:footnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" 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\" mc:Ignorable=\"w14 w15 wp14\">");
|
||||
static std::wstring g_string_footnotes_End = _T("</w:footnotes>");
|
||||
|
||||
static std::wstring g_string_endnotes_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:endnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/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\" mc:Ignorable=\"w14 wp14\">");
|
||||
static std::wstring g_string_endnotes_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:endnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" 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\" mc:Ignorable=\"w14 w15 wp14\">");
|
||||
static std::wstring g_string_endnotes_End = _T("</w:endnotes>");
|
||||
|
||||
class HeaderFooterWriter
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
namespace Writers
|
||||
{
|
||||
static std::wstring g_string_n_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:numbering xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/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\" mc:Ignorable=\"w14 wp14\">");
|
||||
static std::wstring g_string_n_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:numbering xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" 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\" mc:Ignorable=\"w14 w15 wp14\">");
|
||||
static std::wstring g_string_n_End = _T("</w:numbering>");
|
||||
|
||||
class NumberingWriter
|
||||
|
||||
@ -335,10 +335,48 @@ public:
|
||||
sShd += L"<w:shd";
|
||||
if(bValue)
|
||||
{
|
||||
if(shd_Nil == Value)
|
||||
sShd += L" w:val=\"nil\"";
|
||||
else
|
||||
sShd += L" w:val=\"clear\"";
|
||||
switch(Value)
|
||||
{
|
||||
case SimpleTypes::shdClear : sShd += L" w:val=\"clear\""; break;
|
||||
case SimpleTypes::shdDiagCross : sShd += L" w:val=\"diagCross\""; break;
|
||||
case SimpleTypes::shdDiagStripe : sShd += L" w:val=\"diagStripe\""; break;
|
||||
case SimpleTypes::shdHorzCross : sShd += L" w:val=\"horzCross\""; break;
|
||||
case SimpleTypes::shdHorzStripe : sShd += L" w:val=\"horzStripe\""; break;
|
||||
case SimpleTypes::shdNil : sShd += L" w:val=\"nil\""; break;
|
||||
case SimpleTypes::shdPct10 : sShd += L" w:val=\"pct10\""; break;
|
||||
case SimpleTypes::shdPct12 : sShd += L" w:val=\"pct12\""; break;
|
||||
case SimpleTypes::shdPct15 : sShd += L" w:val=\"pct15\""; break;
|
||||
case SimpleTypes::shdPct20 : sShd += L" w:val=\"pct20\""; break;
|
||||
case SimpleTypes::shdPct25 : sShd += L" w:val=\"pct25\""; break;
|
||||
case SimpleTypes::shdPct30 : sShd += L" w:val=\"pct30\""; break;
|
||||
case SimpleTypes::shdPct35 : sShd += L" w:val=\"pct35\""; break;
|
||||
case SimpleTypes::shdPct37 : sShd += L" w:val=\"pct37\""; break;
|
||||
case SimpleTypes::shdPct40 : sShd += L" w:val=\"pct40\""; break;
|
||||
case SimpleTypes::shdPct45 : sShd += L" w:val=\"pct45\""; break;
|
||||
case SimpleTypes::shdPct5 : sShd += L" w:val=\"pct5\""; break;
|
||||
case SimpleTypes::shdPct50 : sShd += L" w:val=\"pct50\""; break;
|
||||
case SimpleTypes::shdPct55 : sShd += L" w:val=\"pct55\""; break;
|
||||
case SimpleTypes::shdPct60 : sShd += L" w:val=\"pct60\""; break;
|
||||
case SimpleTypes::shdPct62 : sShd += L" w:val=\"pct62\""; break;
|
||||
case SimpleTypes::shdPct65 : sShd += L" w:val=\"pct65\""; break;
|
||||
case SimpleTypes::shdPct70 : sShd += L" w:val=\"pct70\""; break;
|
||||
case SimpleTypes::shdPct75 : sShd += L" w:val=\"pct75\""; break;
|
||||
case SimpleTypes::shdPct80 : sShd += L" w:val=\"pct80\""; break;
|
||||
case SimpleTypes::shdPct85 : sShd += L" w:val=\"pct85\""; break;
|
||||
case SimpleTypes::shdPct87 : sShd += L" w:val=\"pct87\""; break;
|
||||
case SimpleTypes::shdPct90 : sShd += L" w:val=\"pct90\""; break;
|
||||
case SimpleTypes::shdPct95 : sShd += L" w:val=\"pct95\""; break;
|
||||
case SimpleTypes::shdReverseDiagStripe : sShd += L" w:val=\"reverseDiagStripe\""; break;
|
||||
case SimpleTypes::shdSolid : sShd += L" w:val=\"solid\""; break;
|
||||
case SimpleTypes::shdThinDiagCross : sShd += L" w:val=\"thinDiagCross\""; break;
|
||||
case SimpleTypes::shdThinDiagStripe : sShd += L" w:val=\"thinDiagStripe\""; break;
|
||||
case SimpleTypes::shdThinHorzCross : sShd += L" w:val=\"thinHorzCross\""; break;
|
||||
case SimpleTypes::shdThinHorzStripe : sShd += L" w:val=\"thinHorzStripe\""; break;
|
||||
case SimpleTypes::shdThinReverseDiagStripe : sShd += L" w:val=\"thinReverseDiagStripe\""; break;
|
||||
case SimpleTypes::shdThinVertStripe : sShd += L" w:val=\"thinVertStripe\""; break;
|
||||
case SimpleTypes::shdVertStripe : sShd += L" w:val=\"vertStripe\""; break;
|
||||
default : sShd += L" w:val=\"solid\""; break;
|
||||
}
|
||||
}
|
||||
sShd += L" w:color=\"auto\"";
|
||||
if(bColor)
|
||||
@ -1417,7 +1455,7 @@ public:
|
||||
oWriter.WriteString(L"<w:numFmt w:val=\"" + sFormat + L"\"/>");
|
||||
}
|
||||
}
|
||||
if(bRestart && 0 == Restart)
|
||||
if(bRestart)
|
||||
{
|
||||
oWriter.WriteString(L"<w:lvlRestart w:val=\"" + std::to_wstring(Restart) + L"\"/>");
|
||||
}
|
||||
@ -2800,30 +2838,51 @@ public:
|
||||
}
|
||||
void Write(NSStringUtils::CStringBuilder& wr)
|
||||
{
|
||||
if(false == rId.empty())
|
||||
wr.WriteString(L"<w:hyperlink");
|
||||
if(!rId.empty())
|
||||
{
|
||||
std::wstring sCorrect_rId = XmlUtils::EncodeXmlString(rId);
|
||||
std::wstring sCorrect_tooltip = XmlUtils::EncodeXmlString(sTooltip);
|
||||
std::wstring sCorrect_anchor = XmlUtils::EncodeXmlString(sAnchor);
|
||||
|
||||
std::wstring sStart = L"<w:hyperlink r:id=\"" + sCorrect_rId + L"\"";
|
||||
if(false == sTooltip.empty())
|
||||
{
|
||||
sStart += L" w:tooltip=\"";
|
||||
sStart += sCorrect_tooltip;
|
||||
sStart += L"\"";
|
||||
}
|
||||
if(false == sAnchor.empty())
|
||||
{
|
||||
sStart += L" w:anchor=\"";
|
||||
sStart += sCorrect_anchor;
|
||||
sStart += L"\"";
|
||||
}
|
||||
sStart += L" w:history=\"1\">";
|
||||
wr.WriteString(sStart);
|
||||
wr.Write(writer);
|
||||
wr.WriteString(L"</w:hyperlink>");
|
||||
wr.WriteString(L" r:id=\"");
|
||||
wr.WriteEncodeXmlString(rId);
|
||||
wr.WriteString(L"\"");
|
||||
}
|
||||
if(!sTooltip.empty())
|
||||
{
|
||||
wr.WriteString(L" w:tooltip=\"");
|
||||
wr.WriteEncodeXmlString(sTooltip);
|
||||
wr.WriteString(L"\"");
|
||||
}
|
||||
if(!sAnchor.empty())
|
||||
{
|
||||
wr.WriteString(L" w:anchor=\"");
|
||||
wr.WriteEncodeXmlString(sAnchor);
|
||||
wr.WriteString(L"\"");
|
||||
}
|
||||
if (bHistory)
|
||||
{
|
||||
if (History)
|
||||
{
|
||||
wr.WriteString(L" w:history=\"1\"");
|
||||
}
|
||||
else
|
||||
{
|
||||
wr.WriteString(L" w:history=\"0\"");
|
||||
}
|
||||
}
|
||||
if (!sDocLocation.empty())
|
||||
{
|
||||
wr.WriteString(L" w:docLocation=\"");
|
||||
wr.WriteEncodeXmlString(sDocLocation);
|
||||
wr.WriteString(L"\"");
|
||||
}
|
||||
if (!sTgtFrame.empty())
|
||||
{
|
||||
wr.WriteString(L" w:tgtFrame=\"");
|
||||
wr.WriteEncodeXmlString(sTgtFrame);
|
||||
wr.WriteString(L"\"");
|
||||
}
|
||||
wr.WriteString(L">");
|
||||
wr.Write(writer);
|
||||
wr.WriteString(L"</w:hyperlink>");
|
||||
}
|
||||
};
|
||||
class CFldSimple{
|
||||
|
||||
@ -34,6 +34,41 @@
|
||||
|
||||
namespace BinDocxRW {
|
||||
|
||||
void InnerColorToOOX(rPr& oRPr, ComplexTypes::Word::CColor& oColor)
|
||||
{
|
||||
if (oRPr.bColor)
|
||||
{
|
||||
oColor.m_oVal.Init();
|
||||
oColor.m_oVal->SetValue(SimpleTypes::hexcolorRGB);
|
||||
oColor.m_oVal->Set_R(oRPr.Color.R);
|
||||
oColor.m_oVal->Set_G(oRPr.Color.G);
|
||||
oColor.m_oVal->Set_B(oRPr.Color.B);
|
||||
}
|
||||
if (oRPr.bThemeColor && oRPr.ThemeColor.IsNoEmpty())
|
||||
{
|
||||
if(oRPr.ThemeColor.Auto && !oRPr.bColor)
|
||||
{
|
||||
oColor.m_oVal.Init();
|
||||
oColor.m_oVal->SetValue(SimpleTypes::hexcolorAuto);
|
||||
}
|
||||
if(oRPr.ThemeColor.bColor)
|
||||
{
|
||||
oColor.m_oThemeColor.Init();
|
||||
oColor.m_oThemeColor->SetValue((SimpleTypes::EThemeColor)oRPr.ThemeColor.Color);
|
||||
}
|
||||
if(oRPr.ThemeColor.bTint)
|
||||
{
|
||||
oColor.m_oThemeTint.Init();
|
||||
oColor.m_oThemeTint->SetValue(oRPr.ThemeColor.Tint);
|
||||
}
|
||||
if(oRPr.ThemeColor.bShade)
|
||||
{
|
||||
oColor.m_oThemeShade.Init();
|
||||
oColor.m_oThemeShade->SetValue(oRPr.ThemeColor.Shade);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int Binary_VbaProjectTableReader::Read()
|
||||
{
|
||||
m_oFileWriter.m_pVbaProject = new OOX::VbaProject(NULL);
|
||||
|
||||
@ -182,6 +182,8 @@ public:
|
||||
poResult->UserId = m_oBufferedStream.GetString3(length);\
|
||||
}
|
||||
|
||||
void InnerColorToOOX(rPr& oRPr, ComplexTypes::Word::CColor& oColor);
|
||||
|
||||
class Binary_CommonReader
|
||||
{
|
||||
protected:
|
||||
@ -2249,6 +2251,15 @@ public:
|
||||
case vmerge_Continue:pCStringWriter->WriteString(std::wstring(_T("<w:vMerge w:val=\"continue\" />")));break;
|
||||
}
|
||||
}
|
||||
else if( c_oSerProp_cellPrType::HMerge == type )
|
||||
{
|
||||
BYTE HMerge = m_oBufferedStream.GetUChar();
|
||||
switch(HMerge)
|
||||
{
|
||||
case vmerge_Restart:pCStringWriter->WriteString(std::wstring(_T("<w:hMerge w:val=\"restart\" />")));break;
|
||||
case vmerge_Continue:pCStringWriter->WriteString(std::wstring(_T("<w:hMerge w:val=\"continue\" />")));break;
|
||||
}
|
||||
}
|
||||
else if( c_oSerProp_cellPrType::CellDel == type )
|
||||
{
|
||||
TrackRevision Del;
|
||||
@ -3220,11 +3231,13 @@ public:
|
||||
class Binary_SettingsTableReader : public Binary_CommonReader
|
||||
{
|
||||
Binary_pPrReader m_oBinary_pPrReader;
|
||||
Binary_rPrReader m_oBinary_rPrReader;
|
||||
Writers::SettingWriter& m_oSettingWriter;
|
||||
Writers::FileWriter& m_oFileWriter;
|
||||
OOX::CSettingsCustom& m_oSettingsCustom;
|
||||
public:
|
||||
Binary_SettingsTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter):
|
||||
Binary_CommonReader(poBufferedStream),m_oSettingWriter(oFileWriter.m_oSettingWriter),m_oFileWriter(oFileWriter),m_oBinary_pPrReader(poBufferedStream, oFileWriter)
|
||||
Binary_SettingsTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, OOX::CSettingsCustom& oSettingsCustom):
|
||||
Binary_CommonReader(poBufferedStream),m_oSettingWriter(oFileWriter.m_oSettingWriter),m_oFileWriter(oFileWriter),m_oBinary_pPrReader(poBufferedStream, oFileWriter),m_oBinary_rPrReader(poBufferedStream, oFileWriter),m_oSettingsCustom(oSettingsCustom)
|
||||
{
|
||||
}
|
||||
int Read()
|
||||
@ -3316,6 +3329,18 @@ public:
|
||||
READ1_DEF(length, res, this->ReadEndnotePr, &oEdnProps);
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(oEdnProps.toXML());
|
||||
}
|
||||
else if( c_oSer_SettingsType::SdtGlobalColor == type )
|
||||
{
|
||||
rPr oRPr(m_oFileWriter.m_oFontTableWriter.m_mapFonts);
|
||||
res = m_oBinary_rPrReader.Read(length, &oRPr);
|
||||
m_oSettingsCustom.m_oSdtGlobalColor.Init();
|
||||
InnerColorToOOX(oRPr, m_oSettingsCustom.m_oSdtGlobalColor.get2());
|
||||
}
|
||||
else if( c_oSer_SettingsType::SdtGlobalShowHighlight == type )
|
||||
{
|
||||
m_oSettingsCustom.m_oSdtGlobalShowHighlight.Init();
|
||||
m_oSettingsCustom.m_oSdtGlobalShowHighlight->m_oVal.FromBool(m_oBufferedStream.GetBool());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
@ -4493,11 +4518,13 @@ public:
|
||||
NSStringUtils::CStringBuilder* pPrevWriter = m_pCurWriter;
|
||||
m_pCurWriter = &pHyperlink->writer;
|
||||
READ1_DEF(length, res, this->ReadParagraphContent, NULL);
|
||||
long rId;
|
||||
std::wstring sHref = XmlUtils::EncodeXmlString(pHyperlink->sLink);
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink")), sHref, std::wstring(_T("External")), &rId);
|
||||
|
||||
pHyperlink->rId = L"rId" + std::to_wstring(rId);
|
||||
if (!pHyperlink->sLink.empty())
|
||||
{
|
||||
long rId;
|
||||
std::wstring sHref = XmlUtils::EncodeXmlString(pHyperlink->sLink);
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink")), sHref, std::wstring(_T("External")), &rId);
|
||||
pHyperlink->rId = L"rId" + std::to_wstring(rId);
|
||||
}
|
||||
m_pCurWriter = pPrevWriter;
|
||||
}
|
||||
else
|
||||
@ -8002,11 +8029,24 @@ public:
|
||||
pSdtPr->m_oAlias->m_sVal.Init();
|
||||
pSdtPr->m_oAlias->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerSdt::Appearance == type)
|
||||
{
|
||||
pSdtPr->m_oAppearance.Init();
|
||||
pSdtPr->m_oAppearance->m_oVal.Init();
|
||||
pSdtPr->m_oAppearance->m_oVal->SetValue((SimpleTypes::ESdtAppearance)m_oBufferedStream.GetUChar());
|
||||
}
|
||||
else if (c_oSerSdt::ComboBox == type)
|
||||
{
|
||||
pSdtPr->m_oComboBox.Init();
|
||||
READ1_DEF(length, res, this->ReadSdtComboBox, pSdtPr->m_oComboBox.GetPointer());
|
||||
}
|
||||
else if (c_oSerSdt::Color == type)
|
||||
{
|
||||
rPr oRPr(m_oFileWriter.m_oFontTableWriter.m_mapFonts);
|
||||
res = oBinary_rPrReader.Read(length, &oRPr);
|
||||
pSdtPr->m_oColor.Init();
|
||||
InnerColorToOOX(oRPr, pSdtPr->m_oColor.get2());
|
||||
}
|
||||
else if (c_oSerSdt::DataBinding == type)
|
||||
{
|
||||
pSdtPr->m_oDataBinding.Init();
|
||||
@ -8422,11 +8462,12 @@ public:
|
||||
if(c_oSerConstants::ReadOk != res)
|
||||
return res;
|
||||
}
|
||||
OOX::CSettingsCustom oSettingsCustom;
|
||||
if(-1 != nSettingsOffset)
|
||||
{
|
||||
int nOldPos = m_oBufferedStream.GetPos();
|
||||
m_oBufferedStream.Seek(nSettingsOffset);
|
||||
res = Binary_SettingsTableReader(m_oBufferedStream, m_oFileWriter).Read();
|
||||
res = Binary_SettingsTableReader(m_oBufferedStream, m_oFileWriter, oSettingsCustom).Read();
|
||||
if(c_oSerConstants::ReadOk != res)
|
||||
return res;
|
||||
}
|
||||
@ -8573,6 +8614,13 @@ public:
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml", L"/word", pFooter->m_sFilename);
|
||||
}
|
||||
}
|
||||
if(!oSettingsCustom.IsEmpty()){
|
||||
std::wstring sFilename = m_oFileWriter.m_oCustomXmlWriter.WriteCustomXml(oSettingsCustom.GetSchemaUrl(), oSettingsCustom.ToXml());
|
||||
std::wstring sRelsPath = L"../" + OOX::FileTypes::CustomXml.DefaultDirectory().GetPath() + L"/" + sFilename;
|
||||
long rId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(OOX::FileTypes::CustomXml.RelationType(), sRelsPath, L"", &rId);
|
||||
}
|
||||
|
||||
res = Binary_DocumentTableReader(m_oBufferedStream, m_oFileWriter, m_oFileWriter.m_oDocumentWriter, &oBinary_CommentsTableReader.m_oComments).Read();
|
||||
|
||||
OOX::CPath fileRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + L"word"
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -38,7 +38,7 @@
|
||||
|
||||
namespace Writers
|
||||
{
|
||||
static std::wstring g_string_ft_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:fonts xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" mc:Ignorable=\"w14\">");
|
||||
static std::wstring g_string_ft_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:fonts xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" mc:Ignorable=\"w14 w15\">");
|
||||
static std::wstring g_string_ft_End = _T("</w:fonts>");
|
||||
|
||||
class FontTableWriter
|
||||
|
||||
@ -445,7 +445,8 @@ extern int g_nCurFormatVersion;
|
||||
textDirection = 11,
|
||||
hideMark = 12,
|
||||
noWrap = 13,
|
||||
tcFitText = 14
|
||||
tcFitText = 14,
|
||||
HMerge = 15
|
||||
};}
|
||||
namespace c_oSerProp_secPrType{enum c_oSerProp_secPrType
|
||||
{
|
||||
@ -761,7 +762,10 @@ extern int g_nCurFormatVersion;
|
||||
MathPr = 2,
|
||||
TrackRevisions = 3,
|
||||
FootnotePr = 4,
|
||||
EndnotePr = 5
|
||||
EndnotePr = 5,
|
||||
SdtGlobalColor = 6,
|
||||
SdtGlobalShowHighlight = 7,
|
||||
Compat = 8
|
||||
};}
|
||||
namespace c_oSer_MathPrType{enum c_oSer_SettingsType
|
||||
{
|
||||
@ -1096,7 +1100,9 @@ extern int g_nCurFormatVersion;
|
||||
TabIndex = 32,
|
||||
Tag = 33,
|
||||
Temporary = 34,
|
||||
MultiLine = 35
|
||||
MultiLine = 35,
|
||||
Appearance = 36,
|
||||
Color = 37
|
||||
};}
|
||||
namespace c_oSerFFData{enum c_oSerFFData
|
||||
{
|
||||
@ -1145,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
|
||||
|
||||
@ -61,6 +61,7 @@
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/JsaProject.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/HeaderFooter.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/App.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/CustomXml.h"
|
||||
|
||||
namespace BinDocxRW
|
||||
{
|
||||
@ -314,19 +315,19 @@ namespace BinDocxRW
|
||||
void WriteShd(const ComplexTypes::Word::CShading& Shd)
|
||||
{
|
||||
//Type
|
||||
if(false != Shd.m_oVal.IsInit())
|
||||
if (false != Shd.m_oVal.IsInit())
|
||||
{
|
||||
m_oStream.WriteBYTE(c_oSerShdType::Value);
|
||||
m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
switch(Shd.m_oVal.get().GetValue())
|
||||
{
|
||||
case SimpleTypes::shdNil: m_oStream.WriteBYTE(shd_Nil);break;
|
||||
default: m_oStream.WriteBYTE(shd_Clear);break;
|
||||
}
|
||||
m_oStream.WriteBYTE(Shd.m_oVal.get().GetValue()); //Misalignment-footer.doc
|
||||
|
||||
}
|
||||
//Value
|
||||
if(false != Shd.m_oFill.IsInit())
|
||||
if (false != Shd.m_oFill.IsInit())
|
||||
WriteColor(c_oSerShdType::Color, Shd.m_oFill.get());
|
||||
else if (false != Shd.m_oColor.IsInit())
|
||||
WriteColor(c_oSerShdType::Color, Shd.m_oColor.get());
|
||||
|
||||
WriteThemeColor(c_oSerShdType::ColorTheme, Shd.m_oFill, Shd.m_oThemeFill, Shd.m_oThemeFillTint, Shd.m_oThemeFillShade);
|
||||
}
|
||||
void WriteDistance(const NSCommon::nullable<SimpleTypes::CWrapDistance<>>& m_oDistL,
|
||||
@ -2265,6 +2266,24 @@ namespace BinDocxRW
|
||||
m_oBcw.m_oStream.WriteBYTE(vmerge_Continue);
|
||||
}
|
||||
}
|
||||
if(cellPr->m_oHMerge.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_cellPrType::HMerge);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
if(cellPr->m_oHMerge->m_oVal.IsInit())
|
||||
{
|
||||
switch(cellPr->m_oHMerge->m_oVal->GetValue())
|
||||
{
|
||||
case SimpleTypes::mergeContinue: m_oBcw.m_oStream.WriteBYTE(vmerge_Continue); break;
|
||||
case SimpleTypes::mergeRestart: m_oBcw.m_oStream.WriteBYTE(vmerge_Restart); break;
|
||||
default: m_oBcw.m_oStream.WriteBYTE(vmerge_Continue);break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(vmerge_Continue);
|
||||
}
|
||||
}
|
||||
if(cellPr->m_oCellDel.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_cellPrType::CellDel);
|
||||
@ -2915,12 +2934,9 @@ namespace BinDocxRW
|
||||
const ComplexTypes::Word::CDecimalNumber& oVal = lvl.m_oLvlRestart.get();
|
||||
if(oVal.m_oVal.IsInit())
|
||||
{
|
||||
int nVal = oVal.m_oVal.get().GetValue();
|
||||
if(0 != nVal)
|
||||
nVal = -1;
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerNumTypes::lvl_Restart);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(nVal);
|
||||
m_oBcw.m_oStream.WriteLONG(oVal.m_oVal.get().GetValue());
|
||||
}
|
||||
}
|
||||
//Start
|
||||
@ -7077,12 +7093,27 @@ namespace BinDocxRW
|
||||
m_oBcw.m_oStream.WriteStringW3(oStdPr.m_oAlias->m_sVal.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oAppearance.IsInit() && oStdPr.m_oAppearance->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Appearance);
|
||||
m_oBcw.m_oStream.WriteBYTE(oStdPr.m_oAppearance->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oComboBox.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::ComboBox);
|
||||
WriteSdtComboBox(oStdPr.m_oComboBox.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oColor.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Color);
|
||||
if(oStdPr.m_oColor->m_oVal.IsInit())
|
||||
m_oBcw.WriteColor(c_oSerProp_rPrType::Color, oStdPr.m_oColor->m_oVal.get());
|
||||
|
||||
m_oBcw.WriteThemeColor(c_oSerProp_rPrType::ColorTheme, oStdPr.m_oColor->m_oVal, oStdPr.m_oColor->m_oThemeColor, oStdPr.m_oColor->m_oThemeTint, oStdPr.m_oColor->m_oThemeShade);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oStdPr.m_oDataBinding.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::DataBinding);
|
||||
@ -7480,17 +7511,18 @@ namespace BinDocxRW
|
||||
{
|
||||
BinaryCommonWriter m_oBcw;
|
||||
Binary_pPrWriter bpPrs;
|
||||
Binary_rPrWriter brPrs;
|
||||
public:
|
||||
BinarySettingsTableWriter(ParamsWriter& oParamsWriter):m_oBcw(oParamsWriter),bpPrs(oParamsWriter, NULL)
|
||||
BinarySettingsTableWriter(ParamsWriter& oParamsWriter):m_oBcw(oParamsWriter),bpPrs(oParamsWriter, NULL), brPrs(oParamsWriter)
|
||||
{
|
||||
};
|
||||
void Write(OOX::CSettings& oSettings)
|
||||
void Write(OOX::CSettings& oSettings, OOX::CSettingsCustom& oSettingsCustom)
|
||||
{
|
||||
int nStart = m_oBcw.WriteItemWithLengthStart();
|
||||
WriteSettingsContent(oSettings);
|
||||
WriteSettingsContent(oSettings, oSettingsCustom);
|
||||
m_oBcw.WriteItemWithLengthEnd(nStart);
|
||||
}
|
||||
void WriteSettingsContent(OOX::CSettings& oSettings)
|
||||
void WriteSettingsContent(OOX::CSettings& oSettings, OOX::CSettingsCustom& oSettingsCustom)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oSettings.m_oClrSchemeMapping.IsInit())
|
||||
@ -7531,6 +7563,26 @@ 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);
|
||||
OOX::Logic::CRunProperty oRPr;
|
||||
oRPr.m_oColor = oSettingsCustom.m_oSdtGlobalColor;
|
||||
brPrs.Write_rPr(&oRPr);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oSettingsCustom.m_oSdtGlobalShowHighlight.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_SettingsType::SdtGlobalShowHighlight);
|
||||
m_oBcw.m_oStream.WriteBOOL(oSettingsCustom.m_oSdtGlobalShowHighlight->m_oVal.ToBool());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
};
|
||||
void WriteMathPr(const OOX::Logic::CMathPr &pMathPr)
|
||||
{
|
||||
@ -7846,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
|
||||
{
|
||||
@ -8042,9 +8126,16 @@ namespace BinDocxRW
|
||||
//Write Settings
|
||||
if(NULL != oDocx.m_pSettings)
|
||||
{
|
||||
std::wstring sSettings = oDocx.GetCustomSettings();
|
||||
OOX::CSettingsCustom oSettingsCustom;
|
||||
if(!sSettings.empty())
|
||||
{
|
||||
oSettingsCustom.FromXml(sSettings);
|
||||
}
|
||||
|
||||
BinDocxRW::BinarySettingsTableWriter oBinarySettingsTableWriter(m_oParamsWriter);
|
||||
int nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Settings);
|
||||
oBinarySettingsTableWriter.Write(*oDocx.m_pSettings);
|
||||
oBinarySettingsTableWriter.Write(*oDocx.m_pSettings, oSettingsCustom);
|
||||
this->WriteTableEnd(nCurPos);
|
||||
}
|
||||
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
#include "../../DesktopEditor/common/Directory.h"
|
||||
#include "../../DesktopEditor/common/File.h"
|
||||
#include "../../DesktopEditor/common/Path.h"
|
||||
#include "../../DesktopEditor/common/SystemUtils.h"
|
||||
#include "../BinWriter/BinWriters.h"
|
||||
#include "../BinReader/Readers.h"
|
||||
#include "../../ASCOfficePPTXFile/Editor/FontPicker.h"
|
||||
@ -298,7 +299,10 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
|
||||
OOX::CApp* pApp = new OOX::CApp(NULL);
|
||||
if (pApp)
|
||||
{
|
||||
pApp->SetApplication(L"ONLYOFFICE");
|
||||
std::wstring sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvApplicationName);
|
||||
if (sApplication.empty())
|
||||
sApplication = NSSystemUtils::gc_EnvApplicationNameDefault;
|
||||
pApp->SetApplication(sApplication);
|
||||
#if defined(INTVER)
|
||||
pApp->SetAppVersion(VALUE2STR(INTVER));
|
||||
#endif
|
||||
|
||||
@ -34,7 +34,8 @@ SOURCES += \
|
||||
../../XlsxSerializerCom/Writer/CSVWriter.cpp \
|
||||
../../OfficeCryptReader/source/ECMACryptFile.cpp \
|
||||
../../OfficeCryptReader/source/CryptTransform.cpp \
|
||||
../BinReader/Readers.cpp
|
||||
../BinReader/Readers.cpp \
|
||||
../BinReader/CustormXmlWriter.cpp
|
||||
|
||||
HEADERS += ../DocWrapper/DocxSerializer.h \
|
||||
../DocWrapper/FontProcessor.h \
|
||||
@ -69,4 +70,5 @@ HEADERS += ../DocWrapper/DocxSerializer.h \
|
||||
../BinReader/DefaultThemeWriter.h \
|
||||
../DocWrapper/ChartWriter.h \
|
||||
../../OfficeCryptReader/source/ECMACryptFile.h \
|
||||
../../OfficeCryptReader/source/CryptTransform.h
|
||||
../../OfficeCryptReader/source/CryptTransform.h \
|
||||
../BinReader/CustormXmlWriter.h
|
||||
|
||||
@ -53,6 +53,12 @@
|
||||
69F181AF1C77274E00B2952B /* FileDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = 69F181AD1C77274E00B2952B /* FileDownloader.h */; };
|
||||
8A404FD3208A01AF00F2D5CF /* FileDownloader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A404FD2208A01AF00F2D5CF /* FileDownloader.cpp */; };
|
||||
8A404FD5208A01CE00F2D5CF /* FileDownloader_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A404FD4208A01CE00F2D5CF /* FileDownloader_private.h */; };
|
||||
8AB24BFD213004E400E80DDD /* CustormXmlWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AB24BFB213004E300E80DDD /* CustormXmlWriter.cpp */; };
|
||||
8AB24BFE213004E400E80DDD /* CustormXmlWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 8AB24BFC213004E300E80DDD /* CustormXmlWriter.h */; };
|
||||
8AC6D2052130146000D9C0F1 /* xmlutils.h in Headers */ = {isa = PBXBuildFile; fileRef = 8AC6D2042130146000D9C0F1 /* xmlutils.h */; };
|
||||
8AC6D2092130146800D9C0F1 /* xmllight_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 8AC6D2062130146800D9C0F1 /* xmllight_private.h */; };
|
||||
8AC6D20A2130146800D9C0F1 /* xmldom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AC6D2072130146800D9C0F1 /* xmldom.cpp */; };
|
||||
8AC6D20B2130146800D9C0F1 /* xmllight.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AC6D2082130146800D9C0F1 /* xmllight.cpp */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
@ -103,6 +109,12 @@
|
||||
69F181AD1C77274E00B2952B /* FileDownloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileDownloader.h; path = ../../../Common/FileDownloader/FileDownloader.h; sourceTree = "<group>"; };
|
||||
8A404FD2208A01AF00F2D5CF /* FileDownloader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FileDownloader.cpp; path = ../../../Common/FileDownloader/FileDownloader.cpp; sourceTree = "<group>"; };
|
||||
8A404FD4208A01CE00F2D5CF /* FileDownloader_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileDownloader_private.h; path = ../../../Common/FileDownloader/FileDownloader_private.h; sourceTree = "<group>"; };
|
||||
8AB24BFB213004E300E80DDD /* CustormXmlWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CustormXmlWriter.cpp; sourceTree = "<group>"; };
|
||||
8AB24BFC213004E300E80DDD /* CustormXmlWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustormXmlWriter.h; sourceTree = "<group>"; };
|
||||
8AC6D2042130146000D9C0F1 /* xmlutils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = xmlutils.h; path = ../../../DesktopEditor/xml/include/xmlutils.h; sourceTree = "<group>"; };
|
||||
8AC6D2062130146800D9C0F1 /* xmllight_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = xmllight_private.h; path = ../../../DesktopEditor/xml/src/xmllight_private.h; sourceTree = "<group>"; };
|
||||
8AC6D2072130146800D9C0F1 /* xmldom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = xmldom.cpp; path = ../../../DesktopEditor/xml/src/xmldom.cpp; sourceTree = "<group>"; };
|
||||
8AC6D2082130146800D9C0F1 /* xmllight.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = xmllight.cpp; path = ../../../DesktopEditor/xml/src/xmllight.cpp; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -135,6 +147,7 @@
|
||||
17E17EDE1AC453F800BEA2EA /* ASCOfficeDocxFile2Lib */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8AC6D2032130145600D9C0F1 /* XmlUtils */,
|
||||
17E17F4D1AC454E200BEA2EA /* Common */,
|
||||
17E17F1A1AC4549B00BEA2EA /* XlsxSerializerCom */,
|
||||
17E17F0D1AC4546100BEA2EA /* DocWrapper */,
|
||||
@ -149,6 +162,8 @@
|
||||
children = (
|
||||
17E17EEB1AC4544900BEA2EA /* ChartWriter.h */,
|
||||
17E17EEC1AC4544900BEA2EA /* CommentsWriter.h */,
|
||||
8AB24BFB213004E300E80DDD /* CustormXmlWriter.cpp */,
|
||||
8AB24BFC213004E300E80DDD /* CustormXmlWriter.h */,
|
||||
17A765271B0F3DC30046BC0B /* DefaultThemeWriter.h */,
|
||||
17E17EF01AC4544900BEA2EA /* DocumentRelsWriter.h */,
|
||||
17E17EF11AC4544900BEA2EA /* DocumentWriter.h */,
|
||||
@ -252,6 +267,17 @@
|
||||
name = BinWriter;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8AC6D2032130145600D9C0F1 /* XmlUtils */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8AC6D2072130146800D9C0F1 /* xmldom.cpp */,
|
||||
8AC6D2062130146800D9C0F1 /* xmllight_private.h */,
|
||||
8AC6D2082130146800D9C0F1 /* xmllight.cpp */,
|
||||
8AC6D2042130146000D9C0F1 /* xmlutils.h */,
|
||||
);
|
||||
name = XmlUtils;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
@ -276,7 +302,9 @@
|
||||
17C1FEAD1ACC42C4006B99B3 /* ChartWriter.h in Headers */,
|
||||
17C1FEAE1ACC42C4006B99B3 /* DocumentRelsWriter.h in Headers */,
|
||||
17C1FEAF1ACC42C4006B99B3 /* CommentsWriter.h in Headers */,
|
||||
8AC6D2052130146000D9C0F1 /* xmlutils.h in Headers */,
|
||||
69F181AF1C77274E00B2952B /* FileDownloader.h in Headers */,
|
||||
8AC6D2092130146800D9C0F1 /* xmllight_private.h in Headers */,
|
||||
17C1FEB01ACC42C4006B99B3 /* BinaryCommonReader.h in Headers */,
|
||||
17C1FEB11ACC42C4006B99B3 /* Common.h in Headers */,
|
||||
8A404FD5208A01CE00F2D5CF /* FileDownloader_private.h in Headers */,
|
||||
@ -292,6 +320,7 @@
|
||||
17C1FEBC1ACC42C4006B99B3 /* DocxSerializer.h in Headers */,
|
||||
17C1FEBD1ACC42C4006B99B3 /* FileWriter.h in Headers */,
|
||||
17C1FEBE1ACC42C4006B99B3 /* CSVWriter.h in Headers */,
|
||||
8AB24BFE213004E400E80DDD /* CustormXmlWriter.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -346,17 +375,20 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8AB24BFD213004E400E80DDD /* CustormXmlWriter.cpp in Sources */,
|
||||
17C1FE961ACC42C4006B99B3 /* Common.cpp in Sources */,
|
||||
17C1FE971ACC42C4006B99B3 /* ChartFromToBinary.cpp in Sources */,
|
||||
17C1FE981ACC42C4006B99B3 /* CSVReader.cpp in Sources */,
|
||||
17C1FE991ACC42C4006B99B3 /* DocxSerializer.cpp in Sources */,
|
||||
17C1FE9A1ACC42C4006B99B3 /* CommonWriter.cpp in Sources */,
|
||||
8AC6D20B2130146800D9C0F1 /* xmllight.cpp in Sources */,
|
||||
17C1FE9B1ACC42C4006B99B3 /* CSVWriter.cpp in Sources */,
|
||||
69414A301CB51666003E771B /* ChartWriter.cpp in Sources */,
|
||||
6967917E1D9E8AEE002CA4BA /* BinWriters.cpp in Sources */,
|
||||
69BBDF251F0B8AAC00EB1BF7 /* FileDownloader_mac.mm in Sources */,
|
||||
17C1FE9C1ACC42C4006B99B3 /* XlsxSerializer.cpp in Sources */,
|
||||
690FE0851E9BBD68004B26D0 /* Readers.cpp in Sources */,
|
||||
8AC6D20A2130146800D9C0F1 /* xmldom.cpp in Sources */,
|
||||
17C1FE9D1ACC42C4006B99B3 /* FontProcessor.cpp in Sources */,
|
||||
8A404FD3208A01AF00F2D5CF /* FileDownloader.cpp in Sources */,
|
||||
);
|
||||
@ -397,7 +429,7 @@
|
||||
"$(PROJECT_DIR)/../../DesktopEditor/freetype-2.5.2/include",
|
||||
"$(PROJECT_DIR)/../../Common/3dParty/boost/boost_1_58_0",
|
||||
);
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
PRODUCT_NAME = ASCOfficeDocxFile2Lib_ios;
|
||||
SDKROOT = iphoneos;
|
||||
};
|
||||
@ -436,7 +468,7 @@
|
||||
"$(PROJECT_DIR)/../../DesktopEditor/freetype-2.5.2/include",
|
||||
"$(PROJECT_DIR)/../../Common/3dParty/boost/boost_1_58_0",
|
||||
);
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
PRODUCT_NAME = ASCOfficeDocxFile2Lib_ios;
|
||||
SDKROOT = iphoneos;
|
||||
};
|
||||
|
||||
@ -51,6 +51,7 @@ namespace formulasconvert {
|
||||
void replace_cells_range(std::wstring& expr, bool withTableName);
|
||||
bool check_formula(std::wstring& expr);
|
||||
void replace_semicolons(std::wstring& expr);
|
||||
void replace_tilda(std::wstring& expr);
|
||||
void replace_vertical(std::wstring& expr);
|
||||
void replace_space(std::wstring& expr);
|
||||
|
||||
@ -291,7 +292,17 @@ namespace formulasconvert {
|
||||
else
|
||||
return L"";
|
||||
}
|
||||
|
||||
std::wstring replace_tilda_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
return L";";
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
else
|
||||
return L"";
|
||||
}
|
||||
// TODO
|
||||
// заменить точки с запятой во всех вхождениях кроме находящихся в кавычках --*и в фигурных скобках*--
|
||||
void odf2oox_converter::Impl::replace_semicolons(std::wstring& expr)
|
||||
@ -302,9 +313,20 @@ namespace formulasconvert {
|
||||
boost::wregex(L"(;)|(\".*?\")|('.*?')"),
|
||||
&replace_semicolons_formater,
|
||||
boost::match_default | boost::format_all);
|
||||
|
||||
expr = res;
|
||||
}
|
||||
void odf2oox_converter::Impl::replace_tilda(std::wstring& expr)
|
||||
{
|
||||
const std::wstring res = boost::regex_replace(
|
||||
expr,
|
||||
//boost::wregex(L"(;)|(?:\".*?\")|(?:'.*?')"),
|
||||
boost::wregex(L"(~)|(\".*?\")|('.*?')"),
|
||||
&replace_semicolons_formater,
|
||||
boost::match_default | boost::format_all);
|
||||
|
||||
expr = res;
|
||||
}
|
||||
std::wstring replace_vertical_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
@ -462,6 +484,7 @@ namespace formulasconvert {
|
||||
|
||||
replace_cells_range (workstr, true);
|
||||
replace_semicolons (workstr);
|
||||
replace_tilda (workstr);
|
||||
replace_vertical (workstr);
|
||||
|
||||
if (isFormula)
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
#include "formulasconvert.h"
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include"../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
@ -221,6 +220,20 @@ void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr)
|
||||
|
||||
namespace
|
||||
{
|
||||
std::wstring replace_tilda_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
return L";";
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
//else if (what[4].matched)
|
||||
// return what[4].str();
|
||||
else
|
||||
return L"";
|
||||
}
|
||||
|
||||
|
||||
std::wstring replace_semicolons_formater(boost::wsmatch const & what)
|
||||
{
|
||||
@ -251,7 +264,6 @@ void oox2odf_converter::Impl::replace_semicolons(std::wstring& expr)
|
||||
boost::match_default | boost::format_all);
|
||||
expr = res;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
@ -306,9 +318,9 @@ std::wstring forbidden_formulas1[] =
|
||||
|
||||
bool is_forbidden1(const std::wstring & formula)
|
||||
{
|
||||
BOOST_FOREACH(const std::wstring & s, forbidden_formulas1)
|
||||
{
|
||||
if (boost::algorithm::contains(formula, s))
|
||||
for (size_t i = 0; i < 1; i++)
|
||||
{
|
||||
if (boost::algorithm::contains(formula, forbidden_formulas1[i]))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -669,9 +681,10 @@ size_t getColAddressInv(const std::wstring & a_)
|
||||
size_t mul = 1;
|
||||
bool f = true;
|
||||
size_t res = 0;
|
||||
BOOST_REVERSE_FOREACH(const wchar_t c, a)
|
||||
|
||||
for (int i = a.length() - 1; i >= 0; i--)
|
||||
{
|
||||
size_t v = c - L'A';
|
||||
size_t v = a[i] - L'A';
|
||||
if (f)
|
||||
f = false;
|
||||
else
|
||||
@ -700,14 +713,13 @@ void splitCellAddress(const std::wstring & a_, std::wstring & col, std::wstring
|
||||
::XmlUtils::replace_all( a, L"$", L"");
|
||||
//::XmlUtils::replace_all( a, L"'", L"");
|
||||
::boost::algorithm::to_upper(a);
|
||||
|
||||
|
||||
BOOST_FOREACH(wchar_t c, a)
|
||||
for (size_t i = 0; i < a.length(); i++)
|
||||
{
|
||||
if (c >= L'0' && c <= L'9')
|
||||
row +=c;
|
||||
if (a[i] >= L'0' && a[i] <= L'9')
|
||||
row += a[i];
|
||||
else
|
||||
col += c;
|
||||
col += a[i];
|
||||
}
|
||||
std::reverse(col.begin(), col.end());
|
||||
std::reverse(row.begin(), row.end());
|
||||
|
||||
@ -52,8 +52,10 @@ enum ElementType
|
||||
typeTextReferenceMarkEnd,
|
||||
typeTextReferenceRef,
|
||||
|
||||
typeTextFieldFieldmarkStart,
|
||||
typeTextFieldFieldmarkEnd,
|
||||
typeFieldFieldmarkStart,
|
||||
typeFieldFieldmarkEnd,
|
||||
typeFieldFieldmark,
|
||||
typeFieldParam,
|
||||
|
||||
typeTextSpan,
|
||||
typeTextA,
|
||||
@ -501,6 +503,7 @@ enum ElementType
|
||||
typeFormTextarea,
|
||||
typeFormTime,
|
||||
typeFormValueRange,
|
||||
typeFormItem,
|
||||
|
||||
typeDrawPage,
|
||||
typePresentationFooterDecl,
|
||||
|
||||
@ -45,7 +45,7 @@ namespace utils {
|
||||
std::wstring replace_xml_to_text_ImplRegEx(const std::wstring & Text);
|
||||
std::string replace_xml_to_text_ImplRegEx(const std::string & Text);
|
||||
|
||||
std::wstring replace_text_to_xml_ImplReplace(const std::wstring & Text);
|
||||
std::wstring replace_text_to_xml_ImplReplace(const std::wstring & Text, bool dDeleteUnicode = false);
|
||||
std::string replace_text_to_xml_ImplReplace(const std::string & Text);
|
||||
|
||||
std::wstring replace_amp_text_to_xml_ImplReplace(const std::wstring & Text);
|
||||
@ -55,7 +55,7 @@ namespace utils {
|
||||
std::string replace_xml_to_text_ImplReplace(const std::string & Text);
|
||||
}
|
||||
|
||||
std::wstring replace_text_to_xml(const std::wstring & Text);
|
||||
std::wstring replace_text_to_xml(const std::wstring & Text, bool dDeleteUnicode = false);
|
||||
std::string replace_text_to_xml(const std::string & Text);
|
||||
|
||||
std::wstring replace_amp_text_to_xml(const std::wstring & Text);
|
||||
|
||||
@ -214,8 +214,8 @@ SOURCES += \
|
||||
../src/odf/datatypes/tablefunction.cpp \
|
||||
../src/odf/datatypes/tableorder.cpp \
|
||||
../src/odf/datatypes/dategroup.cpp \
|
||||
../src/odf/datatypes/bibliography \
|
||||
../src/odfcommandtype.cpp \
|
||||
../src/odf/datatypes/bibliography.cpp \
|
||||
../src/odf/datatypes/commandtype.cpp \
|
||||
../src/docx/xlsx_conditionalFormatting.cpp \
|
||||
../src/docx/xlsx_dxfs.cpp \
|
||||
../src/docx/docx_content_type.cpp \
|
||||
|
||||
@ -31,7 +31,6 @@
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <cmath>
|
||||
|
||||
#include <boost/optional/optional_io.hpp>
|
||||
@ -78,14 +77,13 @@ std::wstring RGBToString(int r, int g, int b)
|
||||
color v(r, g, b);
|
||||
double minDist = (std::numeric_limits<double>::max)();
|
||||
|
||||
|
||||
BOOST_FOREACH(color const & c, colors)
|
||||
for (size_t i = 0; i < 6; i++)
|
||||
{
|
||||
double dist = color_dist(v, c);
|
||||
double dist = color_dist(v, colors[i]);
|
||||
if (dist < minDist)
|
||||
{
|
||||
minDist = dist;
|
||||
result = c.name_;
|
||||
result = colors[i].name_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -30,9 +30,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <xml/utils.h>
|
||||
@ -131,63 +128,14 @@ 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),
|
||||
page_break_ (false),
|
||||
page_break_after_ (false),
|
||||
page_break_before_ (false),
|
||||
in_run_ (false),
|
||||
in_automatic_style_ (false),
|
||||
in_paragraph_ (false),
|
||||
in_header_ (false),
|
||||
in_drawing_content_ (false),
|
||||
in_table_content_ (false),
|
||||
@ -198,7 +146,6 @@ docx_conversion_context::docx_conversion_context(odf_reader::odf_document * OdfD
|
||||
new_list_style_number_ (0),
|
||||
current_margin_left_ (0),
|
||||
is_rtl_ (false),
|
||||
is_paragraph_keep_ (false),
|
||||
is_delete_text_ (false),
|
||||
delayed_converting_ (false),
|
||||
process_headers_footers_ (false),
|
||||
@ -250,14 +197,14 @@ std::wstring styles_map::name(const std::wstring & Name, odf_types::style_family
|
||||
}
|
||||
void docx_conversion_context::add_element_to_run(std::wstring parenStyleId)
|
||||
{
|
||||
if (!in_run_)
|
||||
if (!state_.in_run_)
|
||||
{
|
||||
in_run_ = true;
|
||||
state_.in_run_ = true;
|
||||
output_stream() << L"<w:r>";
|
||||
|
||||
if (!text_properties_stack_.empty() || parenStyleId.length() > 0)
|
||||
if (!state_.text_properties_stack_.empty() || parenStyleId.length() > 0)
|
||||
{
|
||||
if (!text_properties_stack_.empty())
|
||||
if (!state_.text_properties_stack_.empty())
|
||||
{
|
||||
odf_reader::style_text_properties_ptr textProp = this->current_text_properties();
|
||||
get_styles_context().start();
|
||||
@ -275,41 +222,46 @@ void docx_conversion_context::add_element_to_run(std::wstring parenStyleId)
|
||||
|
||||
void docx_conversion_context::start_paragraph(bool is_header)
|
||||
{
|
||||
if (in_paragraph_)
|
||||
if (state_.in_paragraph_)
|
||||
finish_paragraph();
|
||||
|
||||
output_stream() << L"<w:p>";
|
||||
|
||||
in_header_ = is_header;
|
||||
in_paragraph_ = true;
|
||||
is_rtl_ = false;
|
||||
|
||||
state_.in_paragraph_ = true;
|
||||
start_changes();
|
||||
}
|
||||
|
||||
void docx_conversion_context::finish_paragraph()
|
||||
{
|
||||
if (in_paragraph_)
|
||||
if (state_.in_paragraph_)
|
||||
{
|
||||
end_changes();
|
||||
|
||||
output_stream() << L"</w:p>";
|
||||
}
|
||||
|
||||
in_paragraph_ = false;
|
||||
in_header_ = false;
|
||||
is_paragraph_keep_ = false;
|
||||
in_header_ = false;
|
||||
state_.is_paragraph_keep_ = false;
|
||||
state_.in_paragraph_ = false;
|
||||
}
|
||||
|
||||
|
||||
void docx_conversion_context::finish_run()
|
||||
{
|
||||
if (false == in_run_) return;
|
||||
if (false == state_.in_run_) return;
|
||||
|
||||
if (get_comments_context().state() == 4)
|
||||
{
|
||||
output_stream()<< L"<w:commentReference w:id=\"" << get_comments_context().current_id() << L"\"/>";
|
||||
get_comments_context().state(0);
|
||||
}
|
||||
output_stream() << L"</w:r>";
|
||||
in_run_ = false;
|
||||
state_.in_run_ = false;
|
||||
|
||||
if (get_comments_context().state()==2)
|
||||
if (get_comments_context().state() == 2)
|
||||
{
|
||||
output_stream()<< L"<w:commentRangeEnd w:id=\"" << get_comments_context().current_id() << L"\"/>";
|
||||
|
||||
@ -318,7 +270,6 @@ void docx_conversion_context::finish_run()
|
||||
get_comments_context().state(0);
|
||||
finish_run();
|
||||
}
|
||||
|
||||
}
|
||||
void docx_conversion_context::start_math_formula()
|
||||
{
|
||||
@ -369,57 +320,77 @@ void docx_conversion_context::start_index_content()
|
||||
|
||||
std::wstring sInstrText;
|
||||
|
||||
switch(table_content_context_.type_table_content)
|
||||
if (table_content_context_.type_table_content == 3)
|
||||
{
|
||||
case 1: sInstrText += L" TOC \\f \\h \\u"; break;
|
||||
case 2:
|
||||
case 4:
|
||||
case 6:
|
||||
case 7: sInstrText += L" TOC \\h \\z"; break;
|
||||
case 5: sInstrText += L" INDEX \\z"; break;
|
||||
case 3: sInstrText += L" BIBLIOGRAPHY"; break;
|
||||
sInstrText = L" BIBLIOGRAPHY ";
|
||||
}
|
||||
if (table_content_context_.min_outline_level > 0)
|
||||
else if (table_content_context_.type_table_content == 5)
|
||||
{
|
||||
if (table_content_context_.max_outline_level > 9)
|
||||
table_content_context_.max_outline_level = 9;
|
||||
|
||||
sInstrText += L" \\o \"" + std::to_wstring(table_content_context_.min_outline_level) + L"-" +
|
||||
std::to_wstring(table_content_context_.max_outline_level) + L"\"";
|
||||
sInstrText = L" INDEX";
|
||||
if (table_content_context_.bSeparators)
|
||||
sInstrText += L" \\h \"A\"";
|
||||
}
|
||||
if (false == table_content_context_.outline_level_styles.empty())
|
||||
else
|
||||
{
|
||||
sInstrText += L"\\t \"";
|
||||
sInstrText += L" TOC";
|
||||
|
||||
bool bLink = false, bPages = false;
|
||||
|
||||
for (std::map<int, std::wstring>::iterator it = table_content_context_.outline_level_styles.begin();
|
||||
it != table_content_context_.outline_level_styles.end(); ++it)
|
||||
if (table_content_context_.current_template.empty())
|
||||
{
|
||||
sInstrText += it->second + L";" + std::to_wstring(it->first) + L";";
|
||||
bLink = true;
|
||||
bPages = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t i = 0; i < table_content_context_.current_template.size(); i++)
|
||||
{
|
||||
for (size_t j = 0; j < table_content_context_.current_template[i].content.size(); j++)
|
||||
{
|
||||
if (table_content_context_.current_template[i].content[j] == 3) bLink = true;
|
||||
if (table_content_context_.current_template[i].content[j] == 6) bPages = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sInstrText += L"\"";
|
||||
}
|
||||
if (bLink)
|
||||
sInstrText += L" \\h";
|
||||
|
||||
if (!table_content_context_.caption_sequence_name.empty())
|
||||
{
|
||||
sInstrText += L" \\c \"" + table_content_context_.caption_sequence_name + L"\"";
|
||||
}
|
||||
if (table_content_context_.type_table_content == 1)
|
||||
sInstrText += L" \\f \\u";
|
||||
else
|
||||
sInstrText += L" \\z";
|
||||
|
||||
output_stream() << L"<w:r>";
|
||||
output_stream() << L"<w:fldChar w:fldCharType=\"begin\"/>";
|
||||
output_stream() << L"</w:r>";
|
||||
output_stream() << L"<w:r>";
|
||||
output_stream() << L"<w:instrText xml:space=\"preserve\">" << sInstrText << L" </w:instrText>";
|
||||
output_stream() << L"</w:r>";
|
||||
output_stream() << L"<w:r>";
|
||||
//output_stream() << L"<w:rPr>
|
||||
//output_stream() << L"<w:rFonts w:ascii="Minion Pro" w:eastAsia="DejaVuSans" w:hAnsi="Minion Pro"/>
|
||||
//output_stream() << L"<w:bCs w:val="0"/>
|
||||
//output_stream() << L"<w:sz w:val="21"/>
|
||||
//output_stream() << L"<w:szCs w:val="24"/>
|
||||
//output_stream() << L"</w:rPr>
|
||||
output_stream() << L"<w:fldChar w:fldCharType=\"separate\"/>";
|
||||
output_stream() << L"</w:r>";
|
||||
if (table_content_context_.min_outline_level > 0)
|
||||
{
|
||||
if (table_content_context_.max_outline_level > 9)
|
||||
table_content_context_.max_outline_level = 9;
|
||||
|
||||
sInstrText += L" \\o \"" + std::to_wstring(table_content_context_.min_outline_level) + L"-" +
|
||||
std::to_wstring(table_content_context_.max_outline_level) + L"\"";
|
||||
if (!bPages)
|
||||
sInstrText += L" \\n "+ std::to_wstring(table_content_context_.min_outline_level) + L"-" +
|
||||
std::to_wstring(table_content_context_.max_outline_level);
|
||||
}
|
||||
if (false == table_content_context_.outline_level_styles.empty())
|
||||
{
|
||||
sInstrText += L" \\t \"";
|
||||
|
||||
for (std::map<int, std::wstring>::iterator it = table_content_context_.outline_level_styles.begin();
|
||||
it != table_content_context_.outline_level_styles.end(); ++it)
|
||||
{
|
||||
sInstrText += it->second + L";" + std::to_wstring(it->first) + L";";
|
||||
}
|
||||
|
||||
sInstrText += L"\"";
|
||||
}
|
||||
|
||||
if (!table_content_context_.caption_sequence_name.empty())
|
||||
{
|
||||
sInstrText += L" \\c \"" + table_content_context_.caption_sequence_name + L"\"";
|
||||
}
|
||||
}
|
||||
start_field(sInstrText, L"");
|
||||
|
||||
finish_paragraph();
|
||||
}
|
||||
@ -428,16 +399,51 @@ void docx_conversion_context::end_index_content()
|
||||
if (!in_table_content_) return;
|
||||
|
||||
start_paragraph(false);
|
||||
output_stream() << L"<w:r>";
|
||||
//output_stream() << L"<w:rPr>";
|
||||
//output_stream() << L"<w:rFonts w:ascii="Minion Pro" w:hAnsi="Minion Pro"/>";
|
||||
//output_stream() << L"<w:sz w:val="20"/>
|
||||
//output_stream() << L"</w:rPr>";
|
||||
output_stream() << L"<w:fldChar w:fldCharType=\"end\"/>";
|
||||
output_stream() << L"</w:r>";
|
||||
end_field();
|
||||
|
||||
finish_paragraph();
|
||||
}
|
||||
void docx_conversion_context::start_field(const std::wstring & sInstrText, const std::wstring & sName)
|
||||
{
|
||||
output_stream() << L"<w:r>";
|
||||
output_stream() << L"<w:fldChar w:fldCharType=\"begin\">";
|
||||
|
||||
if (!sName.empty())
|
||||
{
|
||||
output_stream() << L"<w:ffData><w:name w:val=\"" << sName << L"\"/><w:enabled/><w:calcOnExit w:val=\"0\"/></w:ffData>";
|
||||
}
|
||||
output_stream() << L"</w:fldChar>";
|
||||
output_stream() << L"</w:r>";
|
||||
output_stream() << L"<w:r>";
|
||||
output_stream() << L"<w:instrText xml:space=\"preserve\">" << XmlUtils::EncodeXmlString(sInstrText) << L" </w:instrText>";
|
||||
output_stream() << L"</w:r>";
|
||||
output_stream() << L"<w:r>";
|
||||
|
||||
output_stream() << L"<w:fldChar w:fldCharType=\"separate\"/>";
|
||||
output_stream() << L"</w:r>";
|
||||
|
||||
if (!sName.empty())
|
||||
{
|
||||
start_bookmark(sName);
|
||||
}
|
||||
fields_names_stack_.push_back(sName);
|
||||
}
|
||||
void docx_conversion_context::end_field()
|
||||
{
|
||||
if (fields_names_stack_.empty()) return;
|
||||
|
||||
output_stream() << L"<w:r>";
|
||||
output_stream() << L"<w:fldChar w:fldCharType=\"end\"/>";
|
||||
output_stream() << L"</w:r>";
|
||||
|
||||
std::wstring sName = fields_names_stack_.back();
|
||||
fields_names_stack_.pop_back();
|
||||
|
||||
if (!sName.empty())
|
||||
{
|
||||
end_bookmark(sName);
|
||||
}
|
||||
}
|
||||
void docx_conversion_context::end_sdt()
|
||||
{
|
||||
if (!in_table_content_) return;
|
||||
@ -477,7 +483,7 @@ void docx_conversion_context::start_bookmark (const std::wstring &name)
|
||||
}
|
||||
|
||||
finish_run();
|
||||
output_stream() << L"<w:bookmarkStart w:id=\"" << std::to_wstring(id) << L"\" w:name=\"" << name << L"\"/>";
|
||||
output_stream() << L"<w:bookmarkStart w:id=\"" << std::to_wstring(id) << L"\" w:name=\"" << XmlUtils::EncodeXmlString(name) << L"\"/>";
|
||||
}
|
||||
|
||||
void docx_conversion_context::end_bookmark (const std::wstring &name)
|
||||
@ -575,10 +581,27 @@ oox_chart_context & docx_conversion_context::current_chart()
|
||||
throw std::runtime_error("internal error");
|
||||
}
|
||||
}
|
||||
void docx_conversion_context::reset_context_state()
|
||||
{
|
||||
keep_state_.push_back(state_);
|
||||
|
||||
state_.in_paragraph_ = false;
|
||||
state_.in_run_ = false;
|
||||
state_.is_paragraph_keep_ = false;
|
||||
|
||||
state_.text_properties_stack_.clear();
|
||||
}
|
||||
void docx_conversion_context::back_context_state()
|
||||
{
|
||||
state_ = keep_state_.back();
|
||||
keep_state_.pop_back();
|
||||
}
|
||||
|
||||
void docx_conversion_context::add_new_run(std::wstring parentStyleId)
|
||||
{
|
||||
finish_run();
|
||||
if (get_comments_context().state()==1)
|
||||
if (get_comments_context().state() == 1 ||
|
||||
get_comments_context().state() == 4)//??? comment in run
|
||||
{
|
||||
output_stream() << L"<w:commentRangeStart w:id=\"" << get_comments_context().current_id() << L"\" />";
|
||||
get_comments_context().state(2);//active
|
||||
@ -878,22 +901,24 @@ xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\"
|
||||
mc:Ignorable=\"w14 wp14\">";
|
||||
|
||||
std::vector<int> numIds;
|
||||
BOOST_FOREACH(odf_reader::list_style_instance_ptr & inst, list_styles.instances())
|
||||
{
|
||||
odf_reader::office_element_ptr_array & content = inst->get_text_list_style()->get_content();
|
||||
|
||||
odf_reader::list_style_container::instances_array & arListStyles = list_styles.instances();
|
||||
for (size_t i = 0; i < arListStyles.size(); i++)
|
||||
{
|
||||
odf_reader::office_element_ptr_array & content = arListStyles[i]->get_text_list_style()->get_content();
|
||||
|
||||
if (content.size() < 1)
|
||||
continue;
|
||||
|
||||
const int abstractNumId = list_styles.id_by_name(inst->get_style_name());
|
||||
const int abstractNumId = list_styles.id_by_name(arListStyles[i]->get_style_name());
|
||||
|
||||
strm << L"<w:abstractNum w:abstractNumId=\"" << abstractNumId << "\">";
|
||||
numIds.push_back(abstractNumId);
|
||||
|
||||
for (size_t i = 0; i < (std::min)( content.size(), (size_t)9); i++)
|
||||
for (size_t j = 0; j < (std::min)( content.size(), (size_t)9); j++)
|
||||
{
|
||||
start_text_list_style(inst->get_text_list_style()->get_style_name());
|
||||
content[i]->docx_convert(*this);
|
||||
start_text_list_style(arListStyles[i]->get_text_list_style()->get_style_name());
|
||||
content[j]->docx_convert(*this);
|
||||
// TODO
|
||||
end_text_list_style();
|
||||
}
|
||||
@ -924,21 +949,25 @@ void docx_conversion_context::process_fonts()
|
||||
odf_reader::odf_read_context & context = doc->odf_context();
|
||||
odf_reader::fonts_container & fonts = context.fontContainer();
|
||||
|
||||
BOOST_FOREACH(odf_reader::font_instance_ptr & inst, fonts.instances())
|
||||
odf_reader::fonts_container::instances_array &arFonts = fonts.instances();
|
||||
for (size_t i = 0; i < arFonts.size(); i++)
|
||||
{
|
||||
strm << L"<w:font w:name=\"" << inst->name() << L"\" >";
|
||||
if (!arFonts[i]) continue;
|
||||
if (arFonts[i]->name().empty()) continue;
|
||||
|
||||
if (!inst->charset().empty())
|
||||
strm << L"<w:charset w:val=\"" << inst->charset() <<"\" />";
|
||||
strm << L"<w:font w:name=\"" << arFonts[i]->name() << L"\" >";
|
||||
|
||||
if (!inst->family().empty())
|
||||
strm << L"<w:family w:val=\"" << inst->family() << "\" />";
|
||||
if (!arFonts[i]->charset().empty())
|
||||
strm << L"<w:charset w:val=\"" << arFonts[i]->charset() <<"\" />";
|
||||
|
||||
if (!inst->pitch().empty())
|
||||
strm << L"<w:pitch w:val=\"" << inst->pitch() << "\" />";
|
||||
if (!arFonts[i]->family().empty())
|
||||
strm << L"<w:family w:val=\"" << arFonts[i]->family() << "\" />";
|
||||
|
||||
if (!inst->alt_name().empty())
|
||||
strm << L"<w:altName w:val=\"" << inst->alt_name() << "\" />";
|
||||
if (!arFonts[i]->pitch().empty())
|
||||
strm << L"<w:pitch w:val=\"" << arFonts[i]->pitch() << "\" />";
|
||||
|
||||
if (!arFonts[i]->alt_name().empty())
|
||||
strm << L"<w:altName w:val=\"" << arFonts[i]->alt_name() << "\" />";
|
||||
|
||||
strm << L"</w:font>";
|
||||
}
|
||||
@ -969,9 +998,11 @@ void docx_conversion_context::process_styles()
|
||||
odf_reader::styles_container & styles = context.styleContainer();
|
||||
|
||||
// add all styles to the map
|
||||
BOOST_FOREACH(odf_reader::style_instance_ptr & inst, styles.instances())
|
||||
odf_reader::styles_container::instances_array &arStyles = styles.instances();
|
||||
for (size_t i = 0; i < arStyles.size(); i++)
|
||||
{
|
||||
styles_map_.get(inst->name(), inst->type());
|
||||
if (!arStyles[i]) continue;
|
||||
styles_map_.get(arStyles[i]->name(), arStyles[i]->type());
|
||||
}
|
||||
|
||||
_Wostream << L"<w:docDefaults>";
|
||||
@ -981,60 +1012,86 @@ void docx_conversion_context::process_styles()
|
||||
_Wostream << L"<w:pPrDefault>";
|
||||
if ( odf_reader::style_content * content = defaultParStyle->content())
|
||||
{
|
||||
if (content->get_style_paragraph_properties())
|
||||
{
|
||||
if(content->get_style_paragraph_properties()->content_.fo_background_color_)
|
||||
{
|
||||
odf_types::background_color color = *content->get_style_paragraph_properties()->content_.fo_background_color_;
|
||||
if ((color.get_type() != odf_types::background_color::Transparent &&
|
||||
color.get_color() == odf_types::color(L"ffffff")) ||
|
||||
(color.get_type() == odf_types::background_color::Transparent))
|
||||
{
|
||||
content->get_style_paragraph_properties()->content_.fo_background_color_ = boost::none;
|
||||
}
|
||||
}
|
||||
}
|
||||
get_styles_context().start_process_style(defaultParStyle);
|
||||
content->docx_convert(*this);
|
||||
get_styles_context().end_process_style();
|
||||
}
|
||||
_Wostream << L"</w:pPrDefault>";
|
||||
}
|
||||
|
||||
if (odf_reader::style_instance * defaultParStyle = styles.style_default_by_type(odf_types::style_family::Text))
|
||||
{
|
||||
_Wostream << L"<w:rPrDefault>";
|
||||
if ( odf_reader::style_content * content = defaultParStyle->content())
|
||||
{
|
||||
get_styles_context().start_process_style(defaultParStyle);
|
||||
content->docx_convert(*this);
|
||||
get_styles_context().end_process_style();
|
||||
}
|
||||
_Wostream << L"</w:rPrDefault>";
|
||||
}
|
||||
_Wostream << L"</w:docDefaults>";
|
||||
|
||||
BOOST_FOREACH(odf_reader::style_instance_ptr & inst, styles.instances())
|
||||
{
|
||||
if (!inst->is_automatic() &&
|
||||
for (size_t i = 0; i < arStyles.size(); i++)
|
||||
{
|
||||
if (!arStyles[i]->is_automatic() &&
|
||||
(
|
||||
inst->type() == odf_types::style_family::Paragraph ||
|
||||
inst->type() == odf_types::style_family::Text
|
||||
arStyles[i]->type() == odf_types::style_family::Paragraph ||
|
||||
arStyles[i]->type() == odf_types::style_family::Text
|
||||
))
|
||||
{
|
||||
const std::wstring id = styles_map_.get(inst->name(), inst->type());
|
||||
_Wostream << L"<w:style w:styleId=\"" << id << L"\" w:type=\"" << StyleTypeOdf2Docx(inst->type()) << L"\"";
|
||||
if (!inst->is_default())
|
||||
const std::wstring id = styles_map_.get(arStyles[i]->name(), arStyles[i]->type());
|
||||
_Wostream << L"<w:style w:styleId=\"" << id << L"\" w:type=\"" << StyleTypeOdf2Docx(arStyles[i]->type()) << L"\"";
|
||||
if (!arStyles[i]->is_default())
|
||||
{
|
||||
_Wostream << L" w:customStyle=\"1\"";
|
||||
}
|
||||
_Wostream << L">";
|
||||
|
||||
const std::wstring displayName = StyleDisplayName(inst->name(), inst->type());
|
||||
const std::wstring displayName = StyleDisplayName(arStyles[i]->name(), arStyles[i]->type());
|
||||
|
||||
_Wostream << L"<w:name w:val=\"" << displayName << L"\" />";
|
||||
|
||||
if (odf_reader::style_instance * baseOn = inst->parent())
|
||||
if (odf_reader::style_instance * baseOn = arStyles[i]->parent())
|
||||
{
|
||||
const std::wstring basedOnId = styles_map_.get(baseOn->name(), baseOn->type());
|
||||
_Wostream << L"<w:basedOn w:val=\"" << basedOnId << "\" />";
|
||||
}
|
||||
else if (!inst->is_default() && styles_map_.check(L"", inst->type()))
|
||||
else if (!arStyles[i]->is_default() && styles_map_.check(L"", arStyles[i]->type()))
|
||||
{
|
||||
const std::wstring basedOnId = styles_map_.get(L"", inst->type());
|
||||
const std::wstring basedOnId = styles_map_.get(L"", arStyles[i]->type());
|
||||
_Wostream << L"<w:basedOn w:val=\"" << basedOnId << "\" />";
|
||||
}
|
||||
|
||||
if (odf_reader::style_instance * next = inst->next())
|
||||
if (odf_reader::style_instance * next = arStyles[i]->next())
|
||||
{
|
||||
const std::wstring nextId = styles_map_.get(next->name(), next->type());
|
||||
_Wostream << L"<w:next w:val=\"" << nextId << "\" />";
|
||||
}
|
||||
else if (inst->is_default())
|
||||
else if (arStyles[i]->is_default())
|
||||
{
|
||||
// self
|
||||
_Wostream << L"<w:next w:val=\"" << id << "\" />";
|
||||
}
|
||||
|
||||
if (odf_reader::style_content * content = inst->content())
|
||||
if (odf_reader::style_content * content = arStyles[i]->content())
|
||||
{
|
||||
get_styles_context().start_process_style(inst.get());
|
||||
get_tabs_context().clear();
|
||||
calc_tab_stops(arStyles[i].get(), get_tabs_context());
|
||||
|
||||
get_styles_context().start_process_style(arStyles[i].get());
|
||||
content->docx_convert(*this, true);
|
||||
get_styles_context().end_process_style();
|
||||
}
|
||||
@ -1284,21 +1341,22 @@ bool docx_conversion_context::in_automatic_style()
|
||||
|
||||
void docx_conversion_context::push_text_properties(const odf_reader::style_text_properties * TextProperties)
|
||||
{
|
||||
text_properties_stack_.push_back(TextProperties);
|
||||
state_.text_properties_stack_.push_back(TextProperties);
|
||||
}
|
||||
|
||||
void docx_conversion_context::pop_text_properties()
|
||||
{
|
||||
text_properties_stack_.pop_back();
|
||||
state_.text_properties_stack_.pop_back();
|
||||
}
|
||||
|
||||
odf_reader::style_text_properties_ptr docx_conversion_context::current_text_properties()
|
||||
{
|
||||
odf_reader::style_text_properties_ptr cur = boost::make_shared<odf_reader::style_text_properties>();
|
||||
BOOST_FOREACH(const odf_reader::style_text_properties * prop, text_properties_stack_)
|
||||
|
||||
for (size_t i = 0; i < state_.text_properties_stack_.size(); i++)
|
||||
{
|
||||
if (prop)
|
||||
cur->content().apply_from( prop->content() );
|
||||
if (state_.text_properties_stack_[i])
|
||||
cur->content().apply_from( state_.text_properties_stack_[i]->content() );
|
||||
}
|
||||
return cur;
|
||||
}
|
||||
@ -1506,7 +1564,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);
|
||||
@ -1545,15 +1603,31 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
|
||||
|
||||
output_stream() << L"</w:pPr>";
|
||||
finish_paragraph();
|
||||
start_paragraph();
|
||||
start_paragraph();
|
||||
if ((Attr->outline_level_) && (*Attr->outline_level_ > 0))
|
||||
{
|
||||
output_stream() << L"<w:pPr>";
|
||||
output_stream() << L"<w:outlineLvl w:val=\"" << *Attr->outline_level_ - 1 << L"\"/>";
|
||||
output_stream() << L"</w:pPr>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
output_stream() << get_section_context().dump_;
|
||||
get_section_context().dump_.clear();
|
||||
if ((Attr->outline_level_) && (*Attr->outline_level_ > 0))
|
||||
{
|
||||
output_stream() << L"<w:outlineLvl w:val=\"" << *Attr->outline_level_ - 1 << L"\"/>";
|
||||
}
|
||||
output_stream() << L"</w:pPr>";
|
||||
}
|
||||
}
|
||||
else if ((Attr->outline_level_) && (*Attr->outline_level_ > 0))
|
||||
{
|
||||
output_stream() << L"<w:pPr>";
|
||||
output_stream() << L"<w:outlineLvl w:val=\"" << *Attr->outline_level_ - 1 << L"\"/>";
|
||||
output_stream() << L"</w:pPr>";
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -1715,10 +1789,7 @@ namespace
|
||||
{
|
||||
// обработка Header/Footer
|
||||
// конвертируем содержимое header/footer и сохраняем результат в виде строки
|
||||
void process_one_header_footer(docx_conversion_context & Context,
|
||||
const std::wstring & styleName,
|
||||
odf_reader::office_element * elm,
|
||||
headers_footers::Type type)
|
||||
void process_one_header_footer(docx_conversion_context & Context, const std::wstring & styleName, odf_reader::office_element *elm, headers_footers::Type type)
|
||||
{
|
||||
if (!elm) return;
|
||||
|
||||
@ -1736,13 +1807,7 @@ namespace
|
||||
Context.dump_hyperlinks(internal_rels, hyperlinks::document_place);
|
||||
|
||||
Context.get_headers_footers().add(styleName, dbgStr, type, internal_rels);
|
||||
|
||||
if (type == headers_footers::headerLeft || type == headers_footers::footerLeft)
|
||||
{
|
||||
Context.set_settings_property(odf_reader::_property(L"evenAndOddHeaders",true));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
void docx_conversion_context::set_settings_property(const odf_reader::_property & prop)
|
||||
{
|
||||
@ -1764,21 +1829,39 @@ void docx_conversion_context::process_headers_footers()
|
||||
odf_reader::page_layout_container & pageLayouts = context.pageLayoutContainer();
|
||||
|
||||
// проходим по всем page layout
|
||||
BOOST_FOREACH(const odf_reader::style_master_page* page, pageLayouts.master_pages())
|
||||
{
|
||||
const std::wstring & styleName = page->attlist_.style_name_.get_value_or( L"" );
|
||||
const std::wstring masterPageNameLayout =context.pageLayoutContainer().page_layout_name_by_style(styleName);
|
||||
add_page_properties(masterPageNameLayout);
|
||||
|
||||
process_one_header_footer(*this, styleName, page->style_header_.get(), headers_footers::header);
|
||||
process_one_header_footer(*this, styleName, page->style_footer_.get(), headers_footers::footer );
|
||||
process_one_header_footer(*this, styleName, page->style_header_first_.get(), headers_footers::headerFirst);
|
||||
process_one_header_footer(*this, styleName, page->style_footer_first_.get(), headers_footers::footerFirst );
|
||||
process_one_header_footer(*this, styleName, page->style_header_left_.get(), headers_footers::headerLeft );
|
||||
process_one_header_footer(*this, styleName, page->style_footer_left_.get(), headers_footers::footerLeft );
|
||||
std::vector<odf_reader::style_master_page*> & master_pages = pageLayouts.master_pages();
|
||||
|
||||
if (!page->style_header_ && !page->style_footer_ && !page->style_header_first_ && !page->style_footer_first_
|
||||
&& !page->style_header_left_ && !page->style_footer_left_)
|
||||
bool bOddEvenPages = false;
|
||||
for (size_t i = 0; i < master_pages.size(); i++)
|
||||
{
|
||||
if (master_pages[i]->style_header_left_ || master_pages[i]->style_footer_left_)
|
||||
bOddEvenPages = true;
|
||||
}
|
||||
if (bOddEvenPages)
|
||||
{
|
||||
set_settings_property(odf_reader::_property(L"evenAndOddHeaders", true));
|
||||
}
|
||||
for (size_t i = 0; i < master_pages.size(); i++)
|
||||
{
|
||||
const std::wstring & styleName = master_pages[i]->attlist_.style_name_.get_value_or( L"" );
|
||||
const std::wstring masterPageNameLayout =context.pageLayoutContainer().page_layout_name_by_style(styleName);
|
||||
|
||||
add_page_properties(masterPageNameLayout);
|
||||
|
||||
process_one_header_footer(*this, styleName, master_pages[i]->style_header_.get(), headers_footers::header);
|
||||
process_one_header_footer(*this, styleName, master_pages[i]->style_footer_.get(), headers_footers::footer );
|
||||
process_one_header_footer(*this, styleName, master_pages[i]->style_header_first_.get(), headers_footers::headerFirst);
|
||||
process_one_header_footer(*this, styleName, master_pages[i]->style_footer_first_.get(), headers_footers::footerFirst );
|
||||
process_one_header_footer(*this, styleName, master_pages[i]->style_header_left_.get(), headers_footers::headerLeft );
|
||||
process_one_header_footer(*this, styleName, master_pages[i]->style_footer_left_.get(), headers_footers::footerLeft );
|
||||
|
||||
if (bOddEvenPages && !master_pages[i]->style_header_left_)
|
||||
process_one_header_footer(*this, styleName, master_pages[i]->style_header_.get(), headers_footers::headerLeft);
|
||||
if (bOddEvenPages && !master_pages[i]->style_footer_left_)
|
||||
process_one_header_footer(*this, styleName, master_pages[i]->style_footer_.get(), headers_footers::footerLeft );
|
||||
|
||||
if (!master_pages[i]->style_header_ && !master_pages[i]->style_footer_ && !master_pages[i]->style_header_first_ && !master_pages[i]->style_footer_first_
|
||||
&& !master_pages[i]->style_header_left_ && !master_pages[i]->style_footer_left_)
|
||||
{
|
||||
//отключенные колонтитулы
|
||||
rels rels_;
|
||||
@ -1848,7 +1931,7 @@ void docx_conversion_context::start_text_changes (const std::wstring &id)
|
||||
|
||||
map_current_changes_.insert(std::pair<std::wstring, text_tracked_context::_state> (id, state_add));
|
||||
|
||||
if (in_paragraph_ && ( state_add.type == 1 || state_add.type == 2 ))
|
||||
if (state_.in_paragraph_ && ( state_add.type == 1 || state_add.type == 2 ))
|
||||
{
|
||||
map_changes_iterator it = map_current_changes_.find(id);
|
||||
text_tracked_context::_state &state = it->second;
|
||||
@ -2020,7 +2103,7 @@ void docx_conversion_context::end_text_changes (const std::wstring &id)
|
||||
|
||||
if (state.active)
|
||||
{
|
||||
if (in_paragraph_)
|
||||
if (state_.in_paragraph_)
|
||||
finish_run();
|
||||
|
||||
if (state.type == 1) output_stream() << L"</w:ins>";
|
||||
@ -2041,5 +2124,13 @@ std::wstring docx_conversion_context::get_user_field(const std::wstring & name)
|
||||
return pFind != map_user_fields.end() ? pFind->second : L"";
|
||||
}
|
||||
|
||||
void docx_conversion_context::add_jsaProject(const std::string &content)
|
||||
{
|
||||
if (content.empty()) return;
|
||||
|
||||
output_document_->get_word_files().add_jsaProject(content);
|
||||
output_document_->get_content_types_file().add_or_find_default(L"bin");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -486,14 +486,14 @@ public:
|
||||
std::wstring author;
|
||||
std::wstring initials;
|
||||
};
|
||||
void start_comment(const std::wstring & content, const std::wstring & author, const std::wstring & date)
|
||||
void start_comment(const std::wstring & content, const std::wstring & author, const std::wstring & date, bool inRun = false)
|
||||
{
|
||||
int id = comments_.size()+1;
|
||||
_comment_desc new_comment={content,id,date,author};
|
||||
int id = comments_.size() + 1;
|
||||
_comment_desc new_comment={content, id, date, author};
|
||||
|
||||
comments_.push_back(new_comment);
|
||||
|
||||
state_ = 1;
|
||||
state_ = inRun ? 4 : 1;
|
||||
}
|
||||
int current_id()
|
||||
{
|
||||
@ -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:
|
||||
@ -668,7 +627,7 @@ public:
|
||||
{
|
||||
current_state.content.push_back(type);
|
||||
}
|
||||
void add_outline_level_style(int level, const std::wstring& style_name)
|
||||
void add_outline_level_style(const std::wstring& style_name, int level)
|
||||
{
|
||||
if (min_outline_level == -1 || min_outline_level > level)
|
||||
min_outline_level = level;
|
||||
@ -683,17 +642,20 @@ public:
|
||||
}
|
||||
void end_level()
|
||||
{
|
||||
current_template.insert(std::make_pair(current_state.name, current_state));
|
||||
current_template.push_back(current_state);
|
||||
|
||||
map_current_template.insert(std::make_pair(current_state.name, current_state));
|
||||
current_state.clear();
|
||||
}
|
||||
void set_current_level(const std::wstring &name)
|
||||
{
|
||||
std::map<std::wstring, _state>::iterator pFind = current_template.find(name);
|
||||
if (pFind == current_template.end())
|
||||
std::map<std::wstring, _state>::iterator pFind = map_current_template.find(name);
|
||||
if (pFind == map_current_template.end())
|
||||
{
|
||||
current_content_template_.clear();
|
||||
}
|
||||
current_content_template_ = pFind->second.content;
|
||||
else
|
||||
current_content_template_ = pFind->second.content;
|
||||
current_content_template_index_ = 0;
|
||||
}
|
||||
|
||||
@ -725,11 +687,13 @@ public:
|
||||
current_content_template_index_ = 0;
|
||||
current_content_template_.clear();
|
||||
current_template.clear();
|
||||
map_current_template.clear();
|
||||
current_state.clear();
|
||||
caption_sequence_name.clear();
|
||||
min_outline_level = -1;
|
||||
max_outline_level = -1;
|
||||
outline_level_styles.clear();
|
||||
bSeparators = false;
|
||||
}
|
||||
void add_sequence(const std::wstring & name, int outline_level)
|
||||
{
|
||||
@ -754,12 +718,14 @@ public:
|
||||
int min_outline_level;
|
||||
int max_outline_level;
|
||||
std::map<int, std::wstring> outline_level_styles;
|
||||
bool bSeparators;
|
||||
std::vector<_state> current_template;
|
||||
|
||||
private:
|
||||
std::vector<int> current_content_template_;
|
||||
int current_content_template_index_;
|
||||
|
||||
std::map<std::wstring, _state> current_template;
|
||||
std::map<std::wstring, _state> map_current_template;
|
||||
_state current_state;
|
||||
//std::map<std::wstring, int> sequences;
|
||||
std::vector<std::wstring> sequences;
|
||||
@ -790,9 +756,7 @@ public:
|
||||
|
||||
void add_element_to_run (std::wstring parenStyleId = _T(""));
|
||||
void finish_run ();
|
||||
void add_new_run (std::wstring parentStyleId = _T(""));
|
||||
bool get_run_state () { return in_run_; }
|
||||
void set_run_state (bool Val) { in_run_ = Val; }
|
||||
void add_new_run (std::wstring parentStyleId = _T(""));
|
||||
|
||||
void start_paragraph (bool is_header = false);
|
||||
void finish_paragraph ();
|
||||
@ -800,10 +764,18 @@ public:
|
||||
bool is_alphabetical_index () { return false == mapAlphabeticals.empty();}
|
||||
bool is_table_content () { return in_table_content_; }
|
||||
bool is_paragraph_header () { return in_header_; }
|
||||
bool get_paragraph_state () { return in_paragraph_; }
|
||||
void set_paragraph_state (bool val) { in_paragraph_ = val; }
|
||||
bool get_paragraph_keep () { return is_paragraph_keep_;}
|
||||
void set_paragraph_keep (bool val) { is_paragraph_keep_ = val; }
|
||||
|
||||
void reset_context_state();
|
||||
void back_context_state();
|
||||
|
||||
bool get_run_state () { return state_.in_run_; }
|
||||
void set_run_state (bool Val) { state_.in_run_ = Val; }
|
||||
|
||||
bool get_paragraph_state () { return state_.in_paragraph_; }
|
||||
void set_paragraph_state (bool val) { state_.in_paragraph_ = val; }
|
||||
|
||||
bool get_paragraph_keep () { return state_.is_paragraph_keep_;}
|
||||
void set_paragraph_keep (bool val) { state_.is_paragraph_keep_ = val; }
|
||||
|
||||
bool get_delete_text_state () { return is_delete_text_; }
|
||||
void set_delete_text_state (bool Val) { is_delete_text_ = Val; }
|
||||
@ -835,8 +807,8 @@ public:
|
||||
void start_body ();
|
||||
void end_body ();
|
||||
|
||||
void start_office_text ();
|
||||
void end_office_text ();
|
||||
void start_office_text ();
|
||||
void end_office_text ();
|
||||
|
||||
void start_sdt (int type);
|
||||
void end_sdt ();
|
||||
@ -847,6 +819,9 @@ public:
|
||||
void start_index_element();
|
||||
void end_index_element();
|
||||
|
||||
void start_field(const std::wstring & sInstrText, const std::wstring & sName);
|
||||
void end_field();
|
||||
|
||||
void process_styles ();
|
||||
void process_fonts ();
|
||||
|
||||
@ -920,7 +895,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_;}
|
||||
@ -970,15 +945,27 @@ public:
|
||||
|
||||
drop_cap_context & get_drop_cap_context(){return drop_cap_context_;}
|
||||
|
||||
styles_map styles_map_;
|
||||
bool process_headers_footers_;
|
||||
bool delayed_converting_;
|
||||
bool convert_delayed_enabled_;
|
||||
styles_map styles_map_;
|
||||
bool process_headers_footers_;
|
||||
bool delayed_converting_;
|
||||
bool convert_delayed_enabled_;
|
||||
|
||||
void start_changes();
|
||||
void end_changes();
|
||||
void start_changes();
|
||||
void end_changes();
|
||||
|
||||
void add_jsaProject(const std::string &content);
|
||||
private:
|
||||
|
||||
struct _context_state
|
||||
{
|
||||
bool in_paragraph_ = false;
|
||||
bool in_run_ = false;
|
||||
bool is_paragraph_keep_ = false;
|
||||
|
||||
std::vector< const odf_reader::style_text_properties*> text_properties_stack_;
|
||||
}state_;
|
||||
std::vector<_context_state> keep_state_;
|
||||
|
||||
std::wstringstream document_xml_;
|
||||
std::wstringstream styles_xml_;
|
||||
std::wstringstream fontTable_xml_;
|
||||
@ -1001,7 +988,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_;
|
||||
|
||||
@ -1021,8 +1008,11 @@ private:
|
||||
std::wstring automatic_parent_style_;
|
||||
std::wstring current_master_page_name_;
|
||||
std::wstring text_list_style_name_;
|
||||
|
||||
std::vector<std::wstring> list_style_stack_;
|
||||
bool first_element_list_item_;
|
||||
std::vector<std::wstring> fields_names_stack_;
|
||||
|
||||
bool first_element_list_item_;
|
||||
|
||||
bool page_break_after_;
|
||||
bool page_break_before_;
|
||||
@ -1031,12 +1021,10 @@ private:
|
||||
bool in_automatic_style_;
|
||||
bool in_drawing_content_;
|
||||
bool in_table_content_;
|
||||
bool in_paragraph_;
|
||||
bool in_run_;
|
||||
|
||||
bool in_header_;
|
||||
bool is_delete_text_;
|
||||
bool is_rtl_; // right-to-left
|
||||
bool is_paragraph_keep_;
|
||||
|
||||
std::wstring current_alphabetic_index_;
|
||||
int current_margin_left_;
|
||||
@ -1045,7 +1033,6 @@ private:
|
||||
|
||||
std::vector<odf_reader::office_element*> delayed_elements_;
|
||||
|
||||
std::vector< const odf_reader::style_text_properties*> text_properties_stack_;
|
||||
std::map<std::wstring, text_tracked_context::_state> map_current_changes_;
|
||||
boost::unordered_map<std::wstring, std::wstring> list_style_renames_;// цепочки переименований нумераций
|
||||
|
||||
|
||||
@ -124,6 +124,12 @@ void word_files::write(const std::wstring & RootPath)
|
||||
charts_files_.set_main_document(get_main_document());
|
||||
charts_files_.write(path);
|
||||
}
|
||||
|
||||
if (jsaProject_)
|
||||
{
|
||||
rels_files_.add( relationship(L"jsaId", L"http://schemas.onlyoffice.com/jsaProject", L"jsaProject.bin" ) );
|
||||
jsaProject_->write( path );
|
||||
}
|
||||
|
||||
if (notes_)
|
||||
{
|
||||
@ -185,7 +191,10 @@ bool word_files::has_numbering()
|
||||
{
|
||||
return numbering_ ? true : false;
|
||||
}
|
||||
|
||||
void word_files::add_jsaProject(const std::string &content)
|
||||
{
|
||||
jsaProject_ = package::simple_element::create(L"jsaProject.bin", content);
|
||||
}
|
||||
void word_files::set_headers_footers(headers_footers & HeadersFooters)
|
||||
{
|
||||
headers_footers_elements * elm = new headers_footers_elements(HeadersFooters);
|
||||
@ -234,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");
|
||||
|
||||
@ -271,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);
|
||||
|
||||
@ -145,6 +145,7 @@ public:
|
||||
void set_comments (comments_context & commentsContext);
|
||||
|
||||
void add_charts(chart_content_ptr chart);
|
||||
void add_jsaProject(const std::string &content);
|
||||
|
||||
void add_rels(relationship const & r);
|
||||
|
||||
@ -163,6 +164,7 @@ private:
|
||||
element_ptr notes_;
|
||||
element_ptr settings_;
|
||||
element_ptr comments_;
|
||||
element_ptr jsaProject_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -94,8 +94,16 @@ std::wstring docx_table_state::current_row_style() const
|
||||
|
||||
double docx_table_state::get_current_cell_width()
|
||||
{
|
||||
if (current_table_column_ < columns_width_.size())
|
||||
return columns_width_[current_table_column_];
|
||||
if (current_table_column_ + columns_spanned_num_ < columns_width_.size())
|
||||
{
|
||||
//return columns_width_[current_table_column_];
|
||||
double res = 0;
|
||||
for (int i = 0; i < columns_spanned_num_ + 1; i++)
|
||||
{
|
||||
res += columns_width_[current_table_column_ + i];
|
||||
}
|
||||
return res;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -31,7 +31,6 @@
|
||||
*/
|
||||
|
||||
#include "headers_footers.h"
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
namespace cpdoccore {
|
||||
@ -88,12 +87,12 @@ std::wstring get_rel_type(headers_footers::Type _Type)
|
||||
|
||||
void headers_footers::dump_rels(rels & Rels) const//внешние релсы
|
||||
{
|
||||
BOOST_FOREACH(const instances_map::value_type & instAr, instances_)
|
||||
for (boost::unordered_map<std::wstring, instances_array>::const_iterator it = instances_.begin(); it != instances_.end(); ++it)
|
||||
{
|
||||
BOOST_FOREACH(const instance_ptr & inst, instAr.second)
|
||||
for (size_t i = 0; i < it->second.size(); i++)
|
||||
{
|
||||
if (inst->type_ == none) continue;
|
||||
Rels.add( relationship( inst->id_, get_rel_type(inst->type_), inst->name_, L"" ) );
|
||||
if (it->second[i]->type_ == none) continue;
|
||||
Rels.add( relationship( it->second[i]->id_, get_rel_type(it->second[i]->type_), it->second[i]->name_, L"" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -107,9 +106,13 @@ bool headers_footers::write_sectPr(const std::wstring & StyleName, bool next_pag
|
||||
|
||||
bool first = false, left = false;
|
||||
bool res = false;
|
||||
|
||||
instances_array & pFind = instances_.at(StyleName);
|
||||
|
||||
BOOST_FOREACH(const instance_ptr & inst, instances_.at(StyleName))
|
||||
for (size_t i = 0; i < pFind.size(); i++)
|
||||
{
|
||||
instance_ptr & inst = pFind[i];
|
||||
|
||||
std::wstring type = L"default";
|
||||
|
||||
if ( inst->type_ == headerFirst || inst->type_ == footerFirst )
|
||||
|
||||
@ -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"";
|
||||
}
|
||||
|
||||
@ -318,7 +318,7 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (values_[i].strRef_.present > 0 && !bLocalTable_)
|
||||
else if (values_[i].strRef_.present && !bLocalTable_)
|
||||
{
|
||||
CP_XML_NODE(L"c:strRef")
|
||||
{
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -317,8 +317,8 @@ void _oox_drawing::serialize_bodyPr(std::wostream & strm, const std::wstring & n
|
||||
if ((iWrap) && (*iWrap == 0)) CP_XML_ATTR(L"wrap", L"none");
|
||||
}
|
||||
|
||||
_CP_OPT(int) iAlign;
|
||||
odf_reader::GetProperty(prop,L"textarea-vertical_align",iAlign);
|
||||
_CP_OPT(int) iAlign, iVert;
|
||||
odf_reader::GetProperty(prop, L"textarea-vertical_align", iAlign);
|
||||
if (iAlign)
|
||||
{
|
||||
switch (iAlign.get())
|
||||
@ -336,6 +336,16 @@ void _oox_drawing::serialize_bodyPr(std::wostream & strm, const std::wstring & n
|
||||
CP_XML_ATTR(L"anchor", L"just");break;
|
||||
}
|
||||
}
|
||||
odf_reader::GetProperty(prop, L"text_vert", iVert);
|
||||
if (iVert)
|
||||
{
|
||||
switch (iVert.get())
|
||||
{
|
||||
case 1: CP_XML_ATTR(L"vert", L"vert"); break;
|
||||
case 2: CP_XML_ATTR(L"vert", L"vert270"); break;
|
||||
|
||||
}
|
||||
}
|
||||
_CP_OPT(bool) bAutoGrowHeight;
|
||||
_CP_OPT(bool) bFitToSize;
|
||||
odf_reader::GetProperty(prop,L"fit-to-size", bFitToSize);
|
||||
@ -357,7 +367,7 @@ void _oox_drawing::serialize_bodyPr(std::wostream & strm, const std::wstring & n
|
||||
if (bWordArt)
|
||||
{
|
||||
_CP_OPT(int) iVal;
|
||||
odf_reader::GetProperty(prop, L"odf-custom-draw-index",iVal);
|
||||
odf_reader::GetProperty(prop, L"oox-geom-index", iVal);
|
||||
if (iVal)
|
||||
{
|
||||
std::wstring shapeType = _OO_OOX_wordart[*iVal].oox;
|
||||
|
||||
@ -38,6 +38,7 @@
|
||||
|
||||
#include "mediaitems.h"
|
||||
#include "../../DesktopEditor/common/File.h"
|
||||
#include "../../DesktopEditor/common/SystemUtils.h"
|
||||
#include "../../DesktopEditor/graphics/pro/Image.h"
|
||||
#include "../../DesktopEditor/raster/ImageFileFormatChecker.h"
|
||||
#include "../../Common/DocxFormat/Source/Base/Base.h"
|
||||
@ -122,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_;
|
||||
}
|
||||
@ -131,7 +132,7 @@ bool content_types_file::add_or_find_default(const std::wstring & extension)
|
||||
{
|
||||
std::vector<default_content_type> & defaults = content_type_content_.get_default();
|
||||
|
||||
for (int i = 0 ; i < defaults.size(); i++)
|
||||
for (size_t i = 0 ; i < defaults.size(); i++)
|
||||
{
|
||||
if (defaults[i].extension() == extension)
|
||||
return true;
|
||||
@ -193,20 +194,25 @@ void content_types_file::set_media(mediaitems & _Mediaitems)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
simple_element::simple_element(const std::wstring & FileName, const std::wstring & Content) : file_name_(FileName)
|
||||
simple_element::simple_element(const std::wstring & FileName, const std::wstring & Content) : file_name_(FileName), bXml(true)
|
||||
{
|
||||
utf8::utf16to8(Content.begin(), Content.end(), std::back_inserter(content_utf8_));
|
||||
}
|
||||
|
||||
simple_element::simple_element(const std::wstring & FileName, const std::string & Content) : file_name_(FileName), content_utf8_(Content), bXml(false)
|
||||
{
|
||||
}
|
||||
void simple_element::write(const std::wstring & RootPath)
|
||||
{
|
||||
std::wstring name_ = RootPath + FILE_SEPARATOR_STR + file_name_;
|
||||
std::wstring name_ = RootPath + FILE_SEPARATOR_STR + file_name_;
|
||||
|
||||
NSFile::CFileBinary file;
|
||||
if ( file.CreateFileW(name_) == true)
|
||||
{
|
||||
std::string root = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
|
||||
file.WriteFile((BYTE*)root.c_str(), root.length());
|
||||
if (bXml)
|
||||
{
|
||||
std::string root = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
|
||||
file.WriteFile((BYTE*)root.c_str(), root.length());
|
||||
}
|
||||
file.WriteFile((BYTE*)content_utf8_.c_str(), content_utf8_.length());
|
||||
file.CloseFile();
|
||||
}
|
||||
@ -273,11 +279,14 @@ _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);
|
||||
}
|
||||
simple_element_ptr simple_element::create(const std::wstring & FileName, const std::string & Content)
|
||||
{
|
||||
return boost::make_shared<simple_element>(FileName, Content);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
|
||||
void core_file::write(const std::wstring & RootPath)
|
||||
@ -304,7 +313,11 @@ void app_file::write(const std::wstring & RootPath)
|
||||
resStream << L"<Properties xmlns=\"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties\" "
|
||||
L"xmlns:vt=\"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes\" >";
|
||||
|
||||
resStream << L"<Application>ONLYOFFICE";
|
||||
resStream << L"<Application>";
|
||||
std::wstring sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvApplicationName);
|
||||
if (sApplication.empty())
|
||||
sApplication = NSSystemUtils::gc_EnvApplicationNameDefault;
|
||||
resStream << sApplication;
|
||||
#if defined(INTVER)
|
||||
std::string s = VALUE2STR(INTVER);
|
||||
resStream << L"/" << std::wstring(s.begin(), s.end()) ;
|
||||
|
||||
@ -86,28 +86,35 @@ 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);
|
||||
|
||||
public:
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
simple_element(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_;
|
||||
std::string content_utf8_;
|
||||
|
||||
};
|
||||
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
|
||||
|
||||
@ -694,12 +694,17 @@ void pptx_conversion_context::start_chart(std::wstring name)
|
||||
//этот контекст нужно передавать в файл
|
||||
|
||||
}
|
||||
|
||||
void pptx_conversion_context::end_chart()
|
||||
{
|
||||
//current_chart().set_drawing_link(current_sheet().get_drawing_link());
|
||||
//излишняя инфа
|
||||
}
|
||||
|
||||
void pptx_conversion_context::add_jsaProject(const std::string &content)
|
||||
{
|
||||
if (content.empty()) return;
|
||||
|
||||
output_document_->get_ppt_files().add_jsaProject(content);
|
||||
output_document_->get_content_types_file().add_or_find_default(L"bin");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,6 +106,8 @@ public:
|
||||
void start_theme(std::wstring & name);
|
||||
void end_theme();
|
||||
|
||||
void add_jsaProject(const std::string &content);
|
||||
|
||||
std::pair<int,int> add_author_comments(std::wstring author);
|
||||
|
||||
pptx_slide_context & get_slide_context() { return pptx_slide_context_; }
|
||||
|
||||
@ -55,7 +55,7 @@ public:
|
||||
pptx_drawings_.push_back(d);
|
||||
|
||||
bool present = false;
|
||||
for (int i = 0; i < pptx_drawing_rels_.size(); i++)
|
||||
for (size_t i = 0; i < pptx_drawing_rels_.size(); i++)
|
||||
{
|
||||
if (pptx_drawing_rels_[i].rid == rid && pptx_drawing_rels_[i].ref == ref)
|
||||
present = true;
|
||||
@ -83,7 +83,7 @@ public:
|
||||
{
|
||||
|
||||
bool present = false;
|
||||
for (int i = 0; i < pptx_drawing_rels_.size(); i++)
|
||||
for (size_t i = 0; i < pptx_drawing_rels_.size(); i++)
|
||||
{
|
||||
if (pptx_drawing_rels_[i].rid == rid && pptx_drawing_rels_[i].ref == ref)
|
||||
present = true;
|
||||
@ -96,7 +96,7 @@ public:
|
||||
}
|
||||
void serialize(std::wostream & strm)
|
||||
{
|
||||
for (int i = 0; i < pptx_drawings_.size(); i++)
|
||||
for (size_t i = 0; i < pptx_drawings_.size(); i++)
|
||||
{
|
||||
pptx_drawings_[i].serialize(strm);
|
||||
}
|
||||
@ -109,7 +109,7 @@ public:
|
||||
|
||||
void dump_rels(rels & Rels)
|
||||
{
|
||||
for (int i = 0; i < pptx_drawing_rels_.size(); i++)
|
||||
for (size_t i = 0; i < pptx_drawing_rels_.size(); i++)
|
||||
{
|
||||
if (pptx_drawing_rels_[i].type == typeUnknown ||
|
||||
pptx_drawing_rels_[i].type == typeTable ||
|
||||
|
||||
@ -352,7 +352,7 @@ std::pair<int,int> pptx_xml_authors_comments::add_or_find(std::wstring author)
|
||||
int last_id=0;
|
||||
|
||||
bool find = false;
|
||||
for (long i=0;i<list_.size();i++)
|
||||
for (size_t i=0;i<list_.size();i++)
|
||||
{
|
||||
if (author == list_[i].name)
|
||||
{
|
||||
|
||||
@ -121,10 +121,10 @@ 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++)
|
||||
for (size_t i = 0; i < slides_.size(); i++)
|
||||
{
|
||||
if (!slides_[i]) continue;
|
||||
|
||||
@ -156,10 +156,10 @@ 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++)
|
||||
for (size_t i = 0; i < slides_.size(); i++)
|
||||
{
|
||||
if (!slides_[i]) continue;
|
||||
|
||||
@ -199,10 +199,10 @@ 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++)
|
||||
for (size_t i = 0; i < slides_.size(); i++)
|
||||
{
|
||||
if (!slides_[i]) continue;
|
||||
|
||||
@ -233,10 +233,10 @@ 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++)
|
||||
for (size_t i = 0; i < slides_.size(); i++)
|
||||
{
|
||||
if (!slides_[i]) continue;
|
||||
|
||||
@ -275,14 +275,14 @@ void slideLayouts_files::write(const std::wstring & RootPath)
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"slideLayouts" ;
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
for (int i = 0; i < slides_.size(); i++)
|
||||
for (size_t i = 0; i < slides_.size(); i++)
|
||||
{
|
||||
if (!slides_[i]) continue;
|
||||
|
||||
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");//внитренние релсы
|
||||
@ -327,12 +327,12 @@ void ppt_charts_files::write(const std::wstring & RootPath)
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"charts";
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
for (int i = 0; i < charts_.size(); i++)
|
||||
for (size_t i = 0; i < charts_.size(); i++)
|
||||
{
|
||||
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);
|
||||
@ -357,14 +357,14 @@ void ppt_themes_files::write(const std::wstring & RootPath)
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"theme" ;
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
for (int i = 0; i < themes_.size(); i++)
|
||||
for (size_t i = 0; i < themes_.size(); i++)
|
||||
{
|
||||
if (!themes_[i]) continue;
|
||||
|
||||
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;
|
||||
@ -383,9 +383,9 @@ void ppt_comments_files::write(const std::wstring & RootPath)
|
||||
std::wstring comm_path = RootPath + FILE_SEPARATOR_STR + L"comments";
|
||||
NSDirectory::CreateDirectory(comm_path.c_str());
|
||||
|
||||
for (int i = 0; i < comments_.size(); i++)
|
||||
for (size_t 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);
|
||||
@ -455,13 +455,18 @@ void ppt_files::write(const std::wstring & RootPath)
|
||||
}
|
||||
{
|
||||
comments_->set_main_document(get_main_document());
|
||||
comments_->write(path);
|
||||
comments_->write( path );
|
||||
}
|
||||
if (authors_comments_)
|
||||
{
|
||||
rels_files_.add( relationship( L"auId1", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors", L"commentAuthors.xml" ) );
|
||||
authors_comments_->write(path);
|
||||
authors_comments_->write( path );
|
||||
}
|
||||
if (jsaProject_)
|
||||
{
|
||||
rels_files_.add( relationship(L"jsaId", L"http://schemas.onlyoffice.com/jsaProject", L"jsaProject.bin" ) );
|
||||
jsaProject_->write( path );
|
||||
}
|
||||
rels_files_.write(path);
|
||||
}
|
||||
|
||||
@ -532,6 +537,10 @@ void ppt_files::add_theme(pptx_xml_theme_ptr theme)
|
||||
{
|
||||
themes_files_.add_theme(theme);
|
||||
}
|
||||
void ppt_files::add_jsaProject(const std::string &content)
|
||||
{
|
||||
jsaProject_ = package::simple_element::create(L"jsaProject.bin", content);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -222,7 +222,8 @@ public:
|
||||
void add_theme (pptx_xml_theme_ptr theme);
|
||||
|
||||
void set_authors_comments(pptx_xml_authors_comments_ptr & authors_comments);
|
||||
|
||||
|
||||
void add_jsaProject (const std::string &content);
|
||||
private:
|
||||
rels_files rels_files_;
|
||||
|
||||
@ -242,6 +243,7 @@ private:
|
||||
element_ptr comments_;
|
||||
element_ptr media_;
|
||||
element_ptr embeddings_;
|
||||
element_ptr jsaProject_;
|
||||
};
|
||||
|
||||
// xlsx_document
|
||||
|
||||
@ -282,7 +282,7 @@ void pptx_text_context::Impl::ApplyListProperties(odf_reader::paragraph_format_p
|
||||
|
||||
odf_reader::text_list_style * text_list_style = odf_context_.listStyleContainer().list_style_by_name(list_style_stack_.back());
|
||||
|
||||
if ((text_list_style) && (Level < text_list_style->get_content().size()))
|
||||
if ((text_list_style) && (Level < (int)text_list_style->get_content().size()))
|
||||
{
|
||||
odf_reader::office_element_ptr elm = text_list_style->get_content()[Level];
|
||||
odf_reader::office_element_ptr elm_list;
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
|
||||
#include "xlsx_borders.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/functional.hpp>
|
||||
#include <boost/unordered_set.hpp>
|
||||
#include <xml/simple_xml_writer.h>
|
||||
@ -203,9 +202,9 @@ public:
|
||||
{
|
||||
std::vector<xlsx_border> inst_array;
|
||||
|
||||
BOOST_FOREACH(const xlsx_border & inst, borders_)
|
||||
for (boost::unordered_set<xlsx_border, boost::hash<xlsx_border>>::iterator it = borders_.begin(); it != borders_.end(); ++it)
|
||||
{
|
||||
inst_array.push_back(inst);
|
||||
inst_array.push_back(*it);
|
||||
}
|
||||
|
||||
std::sort(inst_array.begin(), inst_array.end(), compare_());
|
||||
@ -215,9 +214,10 @@ public:
|
||||
CP_XML_NODE(L"borders")
|
||||
{
|
||||
CP_XML_ATTR(L"count", inst_array.size());
|
||||
BOOST_FOREACH( xlsx_border & border, inst_array)
|
||||
|
||||
for (size_t i = 0; i < inst_array.size(); i++)
|
||||
{
|
||||
cpdoccore::oox::xlsx_serialize(CP_XML_STREAM(), border);
|
||||
cpdoccore::oox::xlsx_serialize(CP_XML_STREAM(), inst_array[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,7 +61,9 @@ namespace oox {
|
||||
case 3: CP_XML_ATTR(L"type", L"min"); break;
|
||||
case 4: CP_XML_ATTR(L"type", L"max"); break; //todooo ext - autoMax
|
||||
case 5: CP_XML_ATTR(L"type", L"min"); break;
|
||||
case 6: CP_XML_ATTR(L"type", L"formula"); break;
|
||||
case 6: CP_XML_ATTR(L"type", L"formula"); break;
|
||||
case 7: CP_XML_ATTR(L"type", L"percentile");break;//BOA PARA ESTUDAR - JOGAR LOTOFACIL minha predileta 1.ods
|
||||
|
||||
}
|
||||
if (val)
|
||||
{
|
||||
|
||||
@ -45,21 +45,20 @@
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
class xlsx_dataValidation
|
||||
struct xlsx_dataValidation
|
||||
{
|
||||
public:
|
||||
xlsx_dataValidation() : showErrorMessage(false), showInputMessage(false), showDropDown(false), allowBlank(false) {}
|
||||
|
||||
std::wstring ref;
|
||||
std::wstring activate_ref;
|
||||
//std::wstring activate_ref;
|
||||
std::map<int, std::vector<int>> mapCells;
|
||||
|
||||
std::wstring type;
|
||||
std::wstring formula1;
|
||||
std::wstring formula2;
|
||||
std::wstring operator_;
|
||||
bool showErrorMessage;
|
||||
bool showInputMessage;
|
||||
bool showDropDown;
|
||||
bool allowBlank;
|
||||
bool showErrorMessage = false;
|
||||
bool showInputMessage = false;
|
||||
bool showDropDown = false;
|
||||
bool allowBlank = false;
|
||||
};
|
||||
typedef shared_ptr<xlsx_dataValidation>::Type xlsx_dataValidation_ptr;
|
||||
|
||||
@ -80,9 +79,61 @@ public:
|
||||
for (std::map<std::wstring, xlsx_dataValidation_ptr>::iterator it = mapActivateDataValidations.begin();
|
||||
it != mapActivateDataValidations.end(); ++it)
|
||||
{
|
||||
//prepare
|
||||
std::map<int, std::vector<std::pair<int, int>>> mapCells;
|
||||
for (std::map<int, std::vector<int>>::iterator jt = it->second->mapCells.begin(); jt != it->second->mapCells.end(); ++jt)
|
||||
{
|
||||
std::sort(jt->second.begin(), jt->second.end());
|
||||
std::vector<std::pair<int, int>> arr;
|
||||
MakePairVector(jt->second, arr);
|
||||
|
||||
mapCells.insert(std::make_pair(jt->first, arr));
|
||||
}
|
||||
std::wstring activate_ref;
|
||||
|
||||
std::map<int, std::vector<std::pair<int, int>>>::iterator jt1 = mapCells.begin();
|
||||
while ( jt1 != mapCells.end() )
|
||||
{
|
||||
for (size_t i = 0; i < jt1->second.size(); i++)
|
||||
{
|
||||
std::map<int, std::vector<std::pair<int, int>>>::iterator jt2 = jt1;
|
||||
while(jt2 != mapCells.end())
|
||||
{
|
||||
std::map<int, std::vector<std::pair<int, int>>>::iterator jt2_next = jt2; ++jt2_next;
|
||||
if (jt2_next == mapCells.end() || jt2->first + 1 != jt2_next->first)
|
||||
break;
|
||||
|
||||
size_t j = 0; bool bFound = false;
|
||||
for (size_t j = 0; j < jt2_next->second.size(); j++)
|
||||
{
|
||||
if (jt1->second[i].first == jt2_next->second[j].first ||
|
||||
jt1->second[i].second == jt2_next->second[j].second)
|
||||
{
|
||||
bFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (bFound)
|
||||
{
|
||||
jt2_next->second.erase(jt2_next->second.begin() + j, jt2_next->second.begin() + j + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
jt2 = jt2_next;
|
||||
}
|
||||
if (!activate_ref.empty()) activate_ref += L" ";
|
||||
activate_ref += oox::getCellAddress(jt1->first, jt1->second[i].first);
|
||||
|
||||
if (jt1->first != jt2->first || jt1->second[i].first != jt1->second[i].second)
|
||||
activate_ref += L":" + oox::getCellAddress(jt2->first, jt1->second[i].second);
|
||||
}
|
||||
++jt1;
|
||||
}
|
||||
CP_XML_NODE(L"dataValidation")
|
||||
{
|
||||
CP_XML_ATTR(L"sqref", it->second->activate_ref);
|
||||
CP_XML_ATTR(L"sqref", activate_ref);
|
||||
CP_XML_ATTR(L"allowBlank", it->second->allowBlank);
|
||||
CP_XML_ATTR(L"operator", it->second->operator_);
|
||||
CP_XML_ATTR(L"showDropDown", it->second->showDropDown);
|
||||
@ -115,6 +166,21 @@ public:
|
||||
|
||||
std::map<std::wstring, xlsx_dataValidation_ptr> mapDataValidations; //for all tables
|
||||
std::map<std::wstring, xlsx_dataValidation_ptr> mapActivateDataValidations; //in current table
|
||||
|
||||
private:
|
||||
void MakePairVector(std::vector<int> & arInput, std::vector<std::pair<int, int>> &arOutput)
|
||||
{
|
||||
int pos = arInput[0];
|
||||
for (size_t i = 1; i < arInput.size(); i++)
|
||||
{
|
||||
if (arInput[i-1] + 1 != arInput[i])
|
||||
{
|
||||
arOutput.push_back(std::make_pair(pos, arInput[i - 1]));
|
||||
pos = arInput[i];
|
||||
}
|
||||
}
|
||||
arOutput.push_back(std::make_pair(pos, arInput[arInput.size() - 1]));
|
||||
}
|
||||
};
|
||||
|
||||
xlsx_dataValidations_context::xlsx_dataValidations_context() :
|
||||
@ -128,24 +194,48 @@ void xlsx_dataValidations_context::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
return impl_->serialize(_Wostream);
|
||||
}
|
||||
void xlsx_dataValidations_context::activate(const std::wstring & name, const std::wstring & ref)
|
||||
void xlsx_dataValidations_context::activate(const std::wstring & name, int col, int row/*const std::wstring & ref*/)
|
||||
{
|
||||
std::map<std::wstring, xlsx_dataValidation_ptr>::iterator pFindActivate = impl_->mapActivateDataValidations.find(name);
|
||||
|
||||
if (pFindActivate != impl_->mapActivateDataValidations.end())
|
||||
{
|
||||
pFindActivate->second->activate_ref += L" " + ref;
|
||||
}
|
||||
else
|
||||
|
||||
if (pFindActivate == impl_->mapActivateDataValidations.end())
|
||||
{
|
||||
std::map<std::wstring, xlsx_dataValidation_ptr>::iterator pFind = impl_->mapDataValidations.find(name);
|
||||
|
||||
xlsx_dataValidation_ptr _new;
|
||||
if (pFind != impl_->mapDataValidations.end())
|
||||
{
|
||||
pFind->second->activate_ref = ref;
|
||||
impl_->mapActivateDataValidations.insert(std::make_pair(name, pFind->second));
|
||||
_new = pFind->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
_new = xlsx_dataValidation_ptr(new xlsx_dataValidation);
|
||||
}
|
||||
impl_->mapActivateDataValidations.insert(std::make_pair(name, _new));
|
||||
|
||||
pFindActivate = impl_->mapActivateDataValidations.find(name);
|
||||
}
|
||||
|
||||
std::map<int, std::vector<int>>::iterator pFindCol = pFindActivate->second->mapCells.find(col);
|
||||
|
||||
if (pFindCol == pFindActivate->second->mapCells.end())
|
||||
{
|
||||
std::vector<int> rows; rows.push_back(row);
|
||||
pFindActivate->second->mapCells.insert(std::make_pair(col, rows));
|
||||
}
|
||||
else
|
||||
{
|
||||
pFindCol->second.push_back(row);
|
||||
}
|
||||
}
|
||||
void xlsx_dataValidations_context::add(const std::wstring & name, const std::wstring &ref)
|
||||
{
|
||||
xlsx_dataValidation_ptr _new = xlsx_dataValidation_ptr(new xlsx_dataValidation);
|
||||
|
||||
formulasconvert::odf2oox_converter converter;
|
||||
_new->ref = converter.convert_named_ref(ref, false, L";");
|
||||
|
||||
impl_->mapDataValidations.insert(std::make_pair(name, _new));
|
||||
}
|
||||
void xlsx_dataValidations_context::add_help_msg(const std::wstring & name, bool val)
|
||||
{
|
||||
@ -164,17 +254,6 @@ void xlsx_dataValidations_context::add_error_msg(const std::wstring & name, bool
|
||||
|
||||
pFind->second->showErrorMessage = val;
|
||||
}
|
||||
|
||||
void xlsx_dataValidations_context::add(const std::wstring & name, const std::wstring &ref)
|
||||
{
|
||||
xlsx_dataValidation_ptr _new = xlsx_dataValidation_ptr(new xlsx_dataValidation());
|
||||
|
||||
formulasconvert::odf2oox_converter converter;
|
||||
_new->ref = converter.convert_named_ref(ref, false, L";");
|
||||
|
||||
impl_->mapDataValidations.insert(std::make_pair(name, _new));
|
||||
}
|
||||
|
||||
void xlsx_dataValidations_context::add_formula(const std::wstring & name, const std::wstring & f) // todooo пооптимальней
|
||||
{
|
||||
std::map<std::wstring, xlsx_dataValidation_ptr>::iterator pFind = impl_->mapDataValidations.find(name);
|
||||
@ -192,11 +271,13 @@ void xlsx_dataValidations_context::add_formula(const std::wstring & name, const
|
||||
|
||||
if ( val.substr(0, 1) == L"\"")
|
||||
{
|
||||
std::wstring keep = val;
|
||||
XmlUtils::replace_all(val, L"\"", L"");
|
||||
|
||||
pFind->second->formula1 = converter.convert(val);
|
||||
|
||||
if ( std::wstring::npos != val.find(L";") )//convert formula replacing ; on ,
|
||||
if ( (std::wstring::npos != val.find(L";")) || //convert formula replacing ; on ,
|
||||
L"\"" + pFind->second->formula1 + L"\"" == keep)
|
||||
{
|
||||
pFind->second->formula1 = L"\"" + pFind->second->formula1 + L"\"";
|
||||
}
|
||||
|
||||
@ -44,12 +44,12 @@ public:
|
||||
xlsx_dataValidations_context();
|
||||
~xlsx_dataValidations_context();
|
||||
|
||||
void add(const std::wstring & name, const std::wstring & ref);
|
||||
void add(const std::wstring & name, /*int col, int row*/const std::wstring & ref);
|
||||
void add_formula(const std::wstring & name, const std::wstring & f);
|
||||
void add_help_msg(const std::wstring & name, bool val);
|
||||
void add_error_msg(const std::wstring & name, bool val);
|
||||
|
||||
void activate(const std::wstring & name, const std::wstring & ref);
|
||||
void activate(const std::wstring & name, int col, int row/*const std::wstring & ref*/);
|
||||
|
||||
void serialize(std::wostream & _Wostream);
|
||||
private:
|
||||
|
||||
@ -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_;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user