mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Compare commits
45 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 332348ef5b | |||
| 69d2b12f53 | |||
| f2260748c8 | |||
| b59f84b262 | |||
| 3e5fed8482 | |||
| dd40e3e53c | |||
| d657ece017 | |||
| b21b1b8aaf | |||
| 09fb980060 | |||
| 274c000ce7 | |||
| 9e6dd1fbb1 | |||
| de51052f6a | |||
| 2c8efcb183 | |||
| 9c2a717870 | |||
| 185dc3064f | |||
| c6f8a1cde8 | |||
| 3fb166f99a | |||
| fb34d57ee6 | |||
| da2d997838 | |||
| 76d68fa70f | |||
| b59908e4c2 | |||
| 04e6b642f4 | |||
| c9ddd5b7b5 | |||
| 53a75261e3 | |||
| e1e788b768 | |||
| a74c927e7e | |||
| c94e1e3223 | |||
| 4afe985955 | |||
| a232fcd9e1 | |||
| 5bc537749e | |||
| 6e7f6cf204 | |||
| b0c10403c5 | |||
| 5f516f0c56 | |||
| bfe8abb847 | |||
| d765a7590b | |||
| dac34c32c0 | |||
| 599bf9654d | |||
| fbd55ca485 | |||
| 68bb25301d | |||
| 2390e5bffe | |||
| 01c9c018af | |||
| 53ed94dbbe | |||
| e1fa9b5c46 | |||
| 6341cdbbdb | |||
| 94548131a1 |
@ -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" );
|
||||
|
||||
@ -61,7 +61,7 @@ namespace DocFileFormat
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
long Converter::Convert(WordDocument* doc, WordprocessingDocument* docx, const ProgressCallback* progress)
|
||||
_UINT32 Converter::Convert(WordDocument* doc, WordprocessingDocument* docx, const ProgressCallback* progress)
|
||||
{
|
||||
if (!doc || !docx) return S_FALSE;
|
||||
|
||||
@ -202,20 +202,18 @@ namespace DocFileFormat
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
long Converter::LoadAndConvert(const std::wstring& strSrcFile, const std::wstring& strDstDirectory, const std::wstring& password, const ProgressCallback* progress, bool &bMacros)
|
||||
_UINT32 Converter::LoadAndConvert(const std::wstring& strSrcFile, const std::wstring& strDstDirectory, const std::wstring& password, const ProgressCallback* progress, bool &bMacros)
|
||||
{
|
||||
long result = S_FALSE;
|
||||
|
||||
WordDocument doc(progress, m_sTempFolder);
|
||||
WordprocessingDocument docx(strDstDirectory, &doc);
|
||||
|
||||
result = doc.LoadDocument(strSrcFile, password);
|
||||
_UINT32 result = doc.LoadDocument(strSrcFile, password);
|
||||
|
||||
if (result == S_OK)
|
||||
if (result == 0)
|
||||
{
|
||||
result = Convert(&doc, &docx, progress);
|
||||
|
||||
if (result == S_OK)
|
||||
if (result == 0)
|
||||
{
|
||||
docx.SaveDocument(bMacros);
|
||||
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "../../Common/DocxFormat/Source/Base/Types_32.h"
|
||||
|
||||
struct ProgressCallback;
|
||||
|
||||
@ -48,9 +49,9 @@ namespace DocFileFormat
|
||||
|
||||
std::wstring m_sTempFolder;
|
||||
|
||||
long LoadAndConvert(const std::wstring & strSrcFile, const std::wstring & strDstDirectory, const std::wstring & password, const ProgressCallback* progress, bool &bMacros);
|
||||
_UINT32 LoadAndConvert(const std::wstring & strSrcFile, const std::wstring & strDstDirectory, const std::wstring & password, const ProgressCallback* progress, bool &bMacros);
|
||||
|
||||
private:
|
||||
long Convert(WordDocument* doc, WordprocessingDocument* docx, const ProgressCallback* progress);
|
||||
_UINT32 Convert(WordDocument* doc, WordprocessingDocument* docx, const ProgressCallback* progress);
|
||||
};
|
||||
}
|
||||
|
||||
@ -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()))
|
||||
{
|
||||
|
||||
@ -72,33 +72,42 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:o", OpenXmlNamespaces::Office );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:w10", OpenXmlNamespaces::OfficeWord );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:r", OpenXmlNamespaces::Relationships );
|
||||
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wpc", L"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:mc", L"http://schemas.openxmlformats.org/markup-compatibility/2006");
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wp14", L"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:w14", L"http://schemas.microsoft.com/office/word/2010/wordml" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wpg", L"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wpi", L"http://schemas.microsoft.com/office/word/2010/wordprocessingInk" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wne", L"http://schemas.microsoft.com/office/word/2006/wordml" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wps", L"http://schemas.microsoft.com/office/word/2010/wordprocessingShape" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:m", L"http://schemas.openxmlformats.org/officeDocument/2006/math" );
|
||||
m_pXmlWriter->WriteAttribute( L"mc:Ignorable", L"w14 wp14" );
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
PictureBulletsMapping();
|
||||
|
||||
int i = 0;
|
||||
|
||||
for (std::list<ListData*>::iterator iter = rglst->listData.begin(); iter != rglst->listData.end(); ++iter, ++i)
|
||||
for (size_t i = 0; i < rglst->listData.size(); ++i)
|
||||
{
|
||||
//start abstractNum
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:abstractNum", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::IntToWideString( i ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::IntToWideString( i /*+ 1 */));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
//nsid
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:nsid", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToFormattedWideString( (*iter)->lsid, L"%08x" ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToFormattedWideString( rglst->listData[i]->lsid, L"%08x" ));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
|
||||
//multiLevelType
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:multiLevelType", TRUE );
|
||||
|
||||
if ( (*iter)->fHybrid )
|
||||
if ( rglst->listData[i]->fHybrid )
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", L"hybridMultilevel" );
|
||||
}
|
||||
else if ( (*iter)->fSimpleList )
|
||||
else if ( rglst->listData[i]->fSimpleList )
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", L"singleLevel" );
|
||||
}
|
||||
@ -111,32 +120,32 @@ namespace DocFileFormat
|
||||
|
||||
//template
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:tmpl", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToFormattedWideString( (*iter)->tplc, L"%08x"));
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToFormattedWideString( rglst->listData[i]->tplc, L"%08x"));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
|
||||
// writes the levels
|
||||
size_t length = (*iter)->rglvl->size();
|
||||
size_t length = rglst->listData[i]->rglvl->size();
|
||||
|
||||
for (size_t j = 0; j < length; ++j)
|
||||
{
|
||||
ListLevel* lvl = (*iter)->rglvl->at(j);
|
||||
LevelMapping(lvl, j, (*iter)->rgistd[j]);
|
||||
ListLevel* lvl = rglst->listData[i]->rglvl->at(j);
|
||||
LevelMapping(lvl, j, rglst->listData[i]->rgistd[j]);
|
||||
}
|
||||
|
||||
//end abstractNum
|
||||
m_pXmlWriter->WriteNodeEnd( L"w:abstractNum" );
|
||||
}
|
||||
//write old style numbering (сложносоставных не сущестует)
|
||||
for (std::list<NumberingDescriptor>::iterator iter = rglst->listNumbering.begin(); iter != rglst->listNumbering.end(); ++iter, ++i)
|
||||
for (size_t i = 0; i < rglst->listNumbering.size(); ++i)
|
||||
{
|
||||
//start abstractNum
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:abstractNum", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::IntToWideString( i ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::IntToWideString( rglst->listNumbering[i]->id ));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
////nsid
|
||||
//m_pXmlWriter->WriteNodeBegin( L"w:nsid", TRUE );
|
||||
//m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToFormattedWideString( (*iter)->lsid, L"%08x" ) ));
|
||||
//m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToFormattedWideString( rglst->listNumbering[i]->lsid, L"%08x" ) ));
|
||||
//m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
|
||||
//multiLevelType
|
||||
@ -147,14 +156,14 @@ namespace DocFileFormat
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
|
||||
LevelMapping(*iter, 0);
|
||||
LevelMapping(rglst->listNumbering[i], 0);
|
||||
|
||||
//end abstractNum
|
||||
m_pXmlWriter->WriteNodeEnd( L"w:abstractNum" );
|
||||
}
|
||||
|
||||
//write the overrides
|
||||
for (unsigned int i = 0; i < m_document->listFormatOverrideTable->size(); ++i)
|
||||
for (size_t i = 0; i < m_document->listFormatOverrideTable->size(); ++i)
|
||||
{
|
||||
ListFormatOverride* lfo = m_document->listFormatOverrideTable->at(i);
|
||||
|
||||
@ -193,16 +202,15 @@ namespace DocFileFormat
|
||||
|
||||
if (m_document->listFormatOverrideTable->empty() && !rglst->listNumbering.empty())
|
||||
{
|
||||
i = 0;
|
||||
for (std::list<NumberingDescriptor>::iterator iter = rglst->listNumbering.begin(); iter != rglst->listNumbering.end(); ++iter, ++i)
|
||||
for (size_t i = 0; i < rglst->listNumbering.size(); ++i)
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:num", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:numId", FormatUtils::IntToWideString(i+1));
|
||||
m_pXmlWriter->WriteAttribute( L"w:numId", FormatUtils::IntToWideString(rglst->listNumbering[i]->id));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:abstractNumId", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToWideString( i ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToWideString( rglst->listNumbering[i]->id ));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd(L"w:num");
|
||||
@ -215,21 +223,20 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
int NumberingMapping::FindIndexbyId(const std::list<ListData*>& listData, int id)
|
||||
int NumberingMapping::FindIndexbyId(std::vector<ListDataPtr>& listData, int lsid)
|
||||
{
|
||||
int ret = -1;
|
||||
int i = 0;
|
||||
|
||||
for (std::list<ListData*>::const_iterator iter = listData.begin(); iter != listData.end(); ++iter, ++i)
|
||||
for (size_t i = 0; i < listData.size(); ++i)
|
||||
{
|
||||
if ((*iter)->lsid == id)
|
||||
if (listData[i]->lsid == lsid)
|
||||
{
|
||||
ret = i;
|
||||
break;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Converts the number text of the binary format to the number text of OOXML.
|
||||
@ -288,15 +295,17 @@ namespace DocFileFormat
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::wstring NumberingMapping::GetLvlText(const NumberingDescriptor& lvl, bool bIsSymbol, int Before, int After) const
|
||||
std::wstring NumberingMapping::GetLvlText(NumberingDescriptorPtr& lvl, bool bIsSymbol, int Before, int After) const
|
||||
{
|
||||
if (!lvl)return L"";
|
||||
|
||||
std::wstring ret;
|
||||
|
||||
if (lvl.nfc == 0xff)
|
||||
if (lvl->nfc == 0xff)
|
||||
{
|
||||
if (!lvl.xst.empty())
|
||||
if (!lvl->xst.empty())
|
||||
{
|
||||
wchar_t xchBullet = lvl.xst[0];
|
||||
wchar_t xchBullet = lvl->xst[0];
|
||||
|
||||
// В символьном шрифте обрезать надо, в других случаях - нет
|
||||
if (bIsSymbol && (xchBullet & 0xF000) != 0)
|
||||
@ -306,7 +315,7 @@ namespace DocFileFormat
|
||||
|
||||
if (!FormatUtils::IsControlSymbol(xchBullet))
|
||||
{
|
||||
ret.push_back(lvl.xst[0]);
|
||||
ret.push_back(lvl->xst[0]);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -316,8 +325,8 @@ namespace DocFileFormat
|
||||
}
|
||||
else
|
||||
{
|
||||
std::wstring strBefore = lvl.xst.substr(0, Before);
|
||||
std::wstring strAfter = lvl.xst.substr(Before, After);
|
||||
std::wstring strBefore = lvl->xst.substr(0, Before);
|
||||
std::wstring strAfter = lvl->xst.substr(Before, After);
|
||||
|
||||
ret = strBefore + L"%1" + strAfter ;
|
||||
}
|
||||
@ -473,14 +482,16 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
void NumberingMapping::LevelMapping(const NumberingDescriptor& lvl, unsigned int level)
|
||||
void NumberingMapping::LevelMapping(NumberingDescriptorPtr & lvl, unsigned int level)
|
||||
{
|
||||
if (!lvl) return;
|
||||
|
||||
std::wstring fontFamily;
|
||||
bool isSymbol = false;
|
||||
|
||||
if( lvl.ftc < m_document->FontTable->Data.size() )
|
||||
if( lvl->ftc < m_document->FontTable->Data.size() )
|
||||
{
|
||||
FontFamilyName* ffn = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( lvl.ftc ) );
|
||||
FontFamilyName* ffn = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( lvl->ftc ) );
|
||||
isSymbol = (ffn->chs == 2);
|
||||
fontFamily = FormatUtils::XmlEncode(ffn->xszFtn);
|
||||
}
|
||||
@ -491,22 +502,22 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:start", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToWideString(lvl.iStartAt));
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToWideString(lvl->iStartAt));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:numFmt", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", GetNumberFormatWideString(lvl.nfc, true));
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", GetNumberFormatWideString(lvl->nfc, true));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
|
||||
//// suffix
|
||||
// m_pXmlWriter->WriteNodeBegin( L"w:suff", TRUE );
|
||||
// m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::MapValueToWideString(lvl.ixchFollow, &FollowingCharMap[0][0], 3, 8));
|
||||
// m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::MapValueToWideString(lvl->ixchFollow, &FollowingCharMap[0][0], 3, 8));
|
||||
// m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
|
||||
// Number level text
|
||||
std::wstring lvlText = GetLvlText(lvl, isSymbol, lvl.cbTextBefore, lvl.cbTextAfter);
|
||||
std::wstring lvlText = GetLvlText(lvl, isSymbol, lvl->cbTextBefore, lvl->cbTextAfter);
|
||||
|
||||
//if (lvlText.empty() && lvl.ftc == 0)//auto
|
||||
//if (lvlText.empty() && lvl->ftc == 0)//auto
|
||||
//{
|
||||
// lvlText.push_back(L'\xF0B7');
|
||||
// lvlText.push_back(L'\0');
|
||||
@ -522,7 +533,7 @@ namespace DocFileFormat
|
||||
|
||||
// jc
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:lvlJc", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::MapValueToWideString(lvl.jc, &LevelJustificationMap[0][0], 3, 7));
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::MapValueToWideString(lvl->jc, &LevelJustificationMap[0][0], 3, 7));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
// pPr
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:pPr", FALSE );
|
||||
|
||||
@ -63,7 +63,7 @@ namespace DocFileFormat
|
||||
NumberingMapping(ConversionContext* ctx);
|
||||
void Apply(IVisitable* visited);
|
||||
|
||||
static int FindIndexbyId(const std::list<ListData*>& listData, int id);
|
||||
static int FindIndexbyId(std::vector<ListDataPtr>& listData, int id);
|
||||
/// Converts the number format code of the binary format.
|
||||
static std::wstring GetNumberFormatWideString(int nfc, int nWordVersion = 0);
|
||||
|
||||
@ -73,12 +73,12 @@ namespace DocFileFormat
|
||||
// Converts the number text of the binary format to the number text of OOXML.
|
||||
// OOXML uses different placeholders for the numbers.
|
||||
std::wstring GetLvlText(const ListLevel* lvl, bool bIsSymbol) const;
|
||||
std::wstring GetLvlText(const NumberingDescriptor& lvl, bool bIsSymbol, int Before, int After) const;
|
||||
std::wstring GetLvlText(NumberingDescriptorPtr& lvl, bool bIsSymbol, int Before, int After) const;
|
||||
|
||||
static bool IsPlaceholder(wchar_t symbol);
|
||||
|
||||
void LevelMapping(const ListLevel* lvl, unsigned int level, short styleIndex);
|
||||
void LevelMapping(const NumberingDescriptor& lvl, unsigned int level);
|
||||
void LevelMapping(NumberingDescriptorPtr & lvl, unsigned int level);
|
||||
|
||||
void PictureBulletsMapping();
|
||||
void WriteLevelPictureBullet(const CharacterPropertyExceptions* grpprlChpx);
|
||||
|
||||
@ -58,7 +58,7 @@ namespace DocFileFormat
|
||||
|
||||
public:
|
||||
|
||||
OfficeArtContent (const FileInformationBlock* pFIB, POLE::Stream* pStream): m_pDrawingGroupData(NULL), m_pBackgroud(NULL)
|
||||
OfficeArtContent (const FileInformationBlock* pFIB, POLE::Stream* pStream): m_pDrawingGroupData(NULL), m_pBackgroud(NULL), m_uLastShapeId(1024)
|
||||
{
|
||||
VirtualStreamReader oStearmReader(pStream, 0 , pFIB->m_nWordVersion);
|
||||
|
||||
@ -79,14 +79,13 @@ namespace DocFileFormat
|
||||
drawing.dgglbl = (DrawingType)oStearmReader.ReadByte();
|
||||
drawing.container = static_cast<DrawingContainer*>(RecordFactory::ReadRecord (&oStearmReader, 0));
|
||||
|
||||
for (unsigned int i = 0; i < drawing.container->Children.size(); ++i)
|
||||
for (size_t i = 0; i < drawing.container->Children.size(); ++i)
|
||||
{
|
||||
Record* groupChild = drawing.container->Children[i];
|
||||
if (groupChild)
|
||||
{
|
||||
if (GroupContainer::TYPE_CODE_0xF003 == groupChild->TypeCode)
|
||||
{
|
||||
// the child is a subgroup
|
||||
GroupContainer* group = static_cast<GroupContainer*>(groupChild);
|
||||
if (group)
|
||||
{
|
||||
@ -95,17 +94,24 @@ namespace DocFileFormat
|
||||
}
|
||||
else if (ShapeContainer::TYPE_CODE_0xF004 == groupChild->TypeCode)
|
||||
{
|
||||
// the child is a shape
|
||||
ShapeContainer* shape = static_cast<ShapeContainer*>(groupChild);
|
||||
if (shape)
|
||||
{
|
||||
shape->Index = i;
|
||||
if (shape->isBackground())
|
||||
shape->m_nIndex = i;
|
||||
if (shape->m_bBackground)
|
||||
{
|
||||
m_pBackgroud = shape;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (DrawingRecord::TYPE_CODE_0xF008 == groupChild->TypeCode)
|
||||
{
|
||||
DrawingRecord* dr = static_cast<DrawingRecord*>(groupChild);
|
||||
if (dr)
|
||||
{
|
||||
m_uLastShapeId = dr->spidCur;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,7 +140,7 @@ namespace DocFileFormat
|
||||
GroupContainer* group = iter->container->FirstChildWithType<GroupContainer>();
|
||||
if (group)
|
||||
{
|
||||
for (unsigned int i = 1; i < group->Children.size(); ++i)
|
||||
for (size_t i = 1; i < group->Children.size(); ++i)
|
||||
{
|
||||
Record* groupChild = group->Children[i];
|
||||
|
||||
@ -183,7 +189,7 @@ namespace DocFileFormat
|
||||
{
|
||||
return m_pDrawingGroupData;
|
||||
}
|
||||
|
||||
unsigned int m_uLastShapeId;
|
||||
private:
|
||||
ShapeContainer* m_pBackgroud;
|
||||
DrawingGroup* m_pDrawingGroupData;
|
||||
|
||||
@ -40,13 +40,13 @@ namespace DocFileFormat
|
||||
public:
|
||||
static const unsigned short TYPE_CODE_0xF010 = 0xF010;
|
||||
|
||||
ClientAnchor() : Record(), clientanchor(0)
|
||||
ClientAnchor() : Record(), value(0)
|
||||
{
|
||||
}
|
||||
|
||||
ClientAnchor (IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance) : Record (_reader, size, typeCode, version, instance), clientanchor(0)
|
||||
ClientAnchor (IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance) : Record (_reader, size, typeCode, version, instance), value(0)
|
||||
{
|
||||
clientanchor = Reader->ReadInt32();
|
||||
value = Reader->ReadInt32(); //index PlcfSpa
|
||||
}
|
||||
|
||||
virtual ~ClientAnchor()
|
||||
@ -58,8 +58,6 @@ namespace DocFileFormat
|
||||
return new ClientAnchor (_reader, bodySize, typeCode, version, instance);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
int clientanchor;
|
||||
unsigned int value;
|
||||
};
|
||||
}
|
||||
@ -38,30 +38,30 @@ namespace DocFileFormat
|
||||
class DrawingRecord: public Record
|
||||
{
|
||||
public:
|
||||
static const unsigned short TYPE_CODE_0xF008 = 0xF008;
|
||||
static const unsigned short TYPE_CODE_0xF008 = 0xF008;
|
||||
|
||||
unsigned int csp; // The number of shapes in this drawing
|
||||
int spidCur; // The last MSOSPID given to an SP in this DG
|
||||
unsigned int csp; // The number of shapes in this drawing
|
||||
unsigned int spidCur; // The last MSOSPID given to an SP in this DG
|
||||
|
||||
DrawingRecord():
|
||||
Record(), csp(0), spidCur(0)
|
||||
{
|
||||
}
|
||||
DrawingRecord():
|
||||
Record(), csp(0), spidCur(0)
|
||||
{
|
||||
}
|
||||
|
||||
DrawingRecord( IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance ):
|
||||
Record( _reader, size, typeCode, version, instance )
|
||||
{
|
||||
DrawingRecord( IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance ):
|
||||
Record( _reader, size, typeCode, version, instance )
|
||||
{
|
||||
csp = Reader->ReadUInt32();
|
||||
spidCur = Reader->ReadInt32();
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~DrawingRecord()
|
||||
{
|
||||
}
|
||||
virtual ~DrawingRecord()
|
||||
{
|
||||
}
|
||||
|
||||
virtual Record* NewObject( IBinaryReader* _reader, unsigned int bodySize, unsigned int typeCode, unsigned int version, unsigned int instance )
|
||||
{
|
||||
return new DrawingRecord( _reader, bodySize, typeCode, version, instance );
|
||||
}
|
||||
virtual Record* NewObject( IBinaryReader* _reader, unsigned int bodySize, unsigned int typeCode, unsigned int version, unsigned int instance )
|
||||
{
|
||||
return new DrawingRecord( _reader, bodySize, typeCode, version, instance );
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -65,7 +65,7 @@ namespace DocFileFormat
|
||||
{
|
||||
// the child is a shape
|
||||
ShapeContainer* shape = static_cast<ShapeContainer*>(groupChild);
|
||||
shape->Index = i;
|
||||
shape->m_nIndex = i;
|
||||
this->Children[i] = shape;
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,13 +50,9 @@ namespace DocFileFormat
|
||||
/*========================================================================================================*/
|
||||
|
||||
Record::Record( IBinaryReader* _reader, unsigned int bodySize, unsigned int typeCode, unsigned int version, unsigned int instance ):
|
||||
HeaderSize(0), BodySize(0), RawData(NULL), SiblingIdx(0), TypeCode(0), Version(0), Instance(0), Reader(NULL),
|
||||
HeaderSize(Record::HEADER_SIZE_IN_BYTES), BodySize(bodySize), RawData(NULL), SiblingIdx(0), TypeCode(typeCode), Version(version), Instance(instance), Reader(NULL),
|
||||
_ParentRecord(NULL)
|
||||
{
|
||||
BodySize = bodySize;
|
||||
TypeCode = typeCode;
|
||||
Version = version;
|
||||
Instance = instance;
|
||||
HeaderSize = Record::HEADER_SIZE_IN_BYTES;
|
||||
|
||||
int real_size = _reader->GetSize() - _reader->GetPosition();
|
||||
|
||||
@ -76,7 +76,7 @@ namespace DocFileFormat
|
||||
{
|
||||
result = pRecord->NewObject (reader, size, typeCode, version, instance);
|
||||
if (result)
|
||||
result->SiblingIdx = siblingIdx;
|
||||
result->SiblingIdx = siblingIdx;
|
||||
RELEASEOBJECT(pRecord);
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,11 +84,11 @@ namespace DocFileFormat
|
||||
{
|
||||
T* firstChildWithType = NULL;
|
||||
|
||||
for ( std::vector<Record*>::const_iterator iter = this->Children.begin(); iter != this->Children.end(); iter++ )
|
||||
for ( size_t i = 0; i < this->Children.size(); ++i )
|
||||
{
|
||||
if ( (*iter != NULL) && (typeid(T) == typeid(**iter)) )
|
||||
if ( (this->Children[i] != NULL) && (typeid(T) == typeid(*(this->Children[i]))) )
|
||||
{
|
||||
firstChildWithType = static_cast<T*>(*iter);
|
||||
firstChildWithType = static_cast<T*>(this->Children[i]);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
#include "RegularContainer.h"
|
||||
#include "ShapeOptions.h"
|
||||
#include "Shape.h"
|
||||
#include "ClientAnchor.h"
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
@ -42,30 +43,35 @@ namespace DocFileFormat
|
||||
public:
|
||||
static const unsigned short TYPE_CODE_0xF004 = 0xF004;
|
||||
|
||||
int Index;
|
||||
int m_nIndex;
|
||||
unsigned int m_nShapeType;
|
||||
bool m_bBackground;
|
||||
bool m_bOLE;
|
||||
bool m_bSkip;
|
||||
|
||||
ShapeContainer():
|
||||
RegularContainer(), Index(0)
|
||||
RegularContainer(), m_nIndex(0), m_nShapeType(0), m_bSkip(false), m_bBackground(false), m_bOLE(false)
|
||||
{
|
||||
}
|
||||
|
||||
ShapeContainer( IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance ):
|
||||
RegularContainer( _reader, size, typeCode, version, instance ), Index(0)
|
||||
ShapeContainer( IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance ) :
|
||||
m_bSkip(false), m_bBackground(false), m_bOLE(false), m_nIndex(0), m_nShapeType(0), RegularContainer( _reader, size, typeCode, version, instance )
|
||||
{
|
||||
}
|
||||
|
||||
int getShapeType()
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
for ( std::vector<Record*>::const_iterator iter = this->Children.begin(); iter != this->Children.end(); iter++ )
|
||||
for ( size_t i = 0; i < this->Children.size(); ++i )
|
||||
{
|
||||
Shape* sh = dynamic_cast<Shape*>( *iter );
|
||||
ClientAnchor *clientAnchor = dynamic_cast<ClientAnchor*>( this->Children[i] );
|
||||
if ( (clientAnchor) && (clientAnchor->value == 0x80000000))
|
||||
m_bSkip = true;
|
||||
|
||||
Shape* sh = dynamic_cast<Shape*>( this->Children[i] );
|
||||
if (sh)
|
||||
{
|
||||
m_bBackground = sh->fBackground;
|
||||
m_bOLE = sh->fOleShape;
|
||||
|
||||
if (sh->shapeType)
|
||||
{
|
||||
return sh->shapeType->GetTypeCode();
|
||||
m_nShapeType = sh->shapeType->GetTypeCode();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -76,44 +82,16 @@ namespace DocFileFormat
|
||||
{
|
||||
if (sh_options->OptionsByID.end() != sh_options->OptionsByID.find(Pib))
|
||||
{
|
||||
return msosptPictureFrame;
|
||||
m_nShapeType = msosptPictureFrame;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
bool isBackground()
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
for ( std::vector<Record*>::const_iterator iter = this->Children.begin(); iter != this->Children.end(); iter++ )
|
||||
{
|
||||
Shape* sh = dynamic_cast<Shape*>( *iter );
|
||||
if (sh)
|
||||
{
|
||||
return sh->fBackground;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool isOLE()
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
for ( std::vector<Record*>::const_iterator iter = this->Children.begin(); iter != this->Children.end(); iter++ )
|
||||
{
|
||||
Shape* sh = dynamic_cast<Shape*>( *iter );
|
||||
if (sh)
|
||||
{
|
||||
return sh->fOleShape;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
virtual ~ShapeContainer()
|
||||
{
|
||||
}
|
||||
@ -128,9 +106,9 @@ namespace DocFileFormat
|
||||
std::vector<OptionEntryPtr> ret;
|
||||
|
||||
//build the list of all option entries of this shape
|
||||
for ( std::vector<Record*>::const_iterator iter = this->Children.begin(); iter != this->Children.end(); iter++ )
|
||||
for ( size_t i = 0; i < this->Children.size(); ++i )
|
||||
{
|
||||
ShapeOptions* opt = dynamic_cast<ShapeOptions*>( *iter );
|
||||
ShapeOptions* opt = dynamic_cast<ShapeOptions*>( this->Children[i] );
|
||||
|
||||
if ( opt == NULL ) continue;
|
||||
|
||||
|
||||
@ -422,12 +422,11 @@ namespace DocFileFormat
|
||||
//numbering
|
||||
case sprmOldPAnld:
|
||||
{
|
||||
NumberingDescriptor desc( iter->Arguments, iter->argumentsSize );
|
||||
NumberingDescriptorPtr desc = NumberingDescriptor::create( iter->Arguments, iter->argumentsSize );
|
||||
|
||||
if (m_document->listTable)
|
||||
{
|
||||
m_document->listTable->appendNumbering( desc );
|
||||
short numId = static_cast<short>(m_document->listTable->listNumbering.size());
|
||||
unsigned short numId = m_document->listTable->appendNumbering( desc );
|
||||
appendValueElement( &numPr, L"numId", numId, true );
|
||||
}
|
||||
}break;
|
||||
@ -460,7 +459,8 @@ namespace DocFileFormat
|
||||
//Todo разобраться с закоментированным кодом
|
||||
if (NULL != m_document->listTable && false == m_document->listTable->listData.empty())
|
||||
{
|
||||
appendValueElement( &numPr, L"numId", FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize ), true );
|
||||
unsigned short numId = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
appendValueElement( &numPr, L"numId", numId, true );
|
||||
}
|
||||
|
||||
//check if there is a ilvl reference, if not, check the count of LVLs.
|
||||
@ -566,14 +566,35 @@ namespace DocFileFormat
|
||||
|
||||
case sprmOldPDxaAbs:
|
||||
case sprmPDxaAbs:
|
||||
appendValueAttribute( _framePr, L"w:x", FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
break;
|
||||
|
||||
{
|
||||
unsigned short val = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
switch (val)
|
||||
{
|
||||
case 0x0000: break; //left
|
||||
case 0xfffc: appendValueAttribute( _framePr, L"w:xAlign", L"center"); break;
|
||||
case 0xfff8: appendValueAttribute( _framePr, L"w:xAlign", L"right"); break;
|
||||
case 0xfff4: appendValueAttribute( _framePr, L"w:xAlign", L"inside"); break;
|
||||
case 0xfff0: appendValueAttribute( _framePr, L"w:xAlign", L"outside"); break;
|
||||
default:
|
||||
appendValueAttribute( _framePr, L"w:x", (short)val);
|
||||
}
|
||||
}break;
|
||||
case sprmOldPDyaAbs:
|
||||
case sprmPDyaAbs:
|
||||
appendValueAttribute( _framePr, L"w:y", FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
break;
|
||||
|
||||
{
|
||||
unsigned short val = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
switch (val)
|
||||
{
|
||||
case 0x0000: break; //inline
|
||||
case 0xfffc: appendValueAttribute( _framePr, L"w:yAlign", L"top"); break;
|
||||
case 0xfff8: appendValueAttribute( _framePr, L"w:yAlign", L"center"); break;
|
||||
case 0xfff4: appendValueAttribute( _framePr, L"w:yAlign", L"bottom"); break;
|
||||
case 0xfff0: appendValueAttribute( _framePr, L"w:yAlign", L"inside"); break;
|
||||
case 0xffec: appendValueAttribute( _framePr, L"w:yAlign", L"outside"); break;
|
||||
default:
|
||||
appendValueAttribute( _framePr, L"w:y", (short)val );
|
||||
}
|
||||
}break;
|
||||
case sprmPWHeightAbs:
|
||||
appendValueAttribute( _framePr, L"w:h", FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
break;
|
||||
|
||||
@ -48,6 +48,7 @@ namespace DocFileFormat
|
||||
std::vector<ByteStructure*> Elements;
|
||||
bool m_bIsValid;
|
||||
|
||||
std::map<int, int> mapCP;
|
||||
public:
|
||||
Plex(int structureLength, POLE::Stream* stream, unsigned int fc, unsigned int lcb, int nWordVersion)
|
||||
: m_bIsValid(false), CP_LENGTH(/*nWordVersion == 2 ? 2 :*/ 4)
|
||||
@ -77,7 +78,10 @@ namespace DocFileFormat
|
||||
|
||||
for (int i = 0; i < (n + 1); ++i)
|
||||
{
|
||||
CharacterPositions.push_back(reader.ReadInt32());
|
||||
int val = reader.ReadInt32();
|
||||
|
||||
mapCP.insert(std::make_pair(val, (int)CharacterPositions.size()));
|
||||
CharacterPositions.push_back(val);
|
||||
}
|
||||
|
||||
// read the n structs
|
||||
@ -96,9 +100,9 @@ namespace DocFileFormat
|
||||
|
||||
~Plex()
|
||||
{
|
||||
for (std::vector<ByteStructure*>::iterator iter = Elements.begin(); iter != Elements.end(); ++iter)
|
||||
for (size_t i = 0; i < Elements.size(); ++i)
|
||||
{
|
||||
RELEASEOBJECT(*iter);
|
||||
RELEASEOBJECT(Elements[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,15 +113,14 @@ namespace DocFileFormat
|
||||
{
|
||||
int index = -1;
|
||||
|
||||
for (int i = 0; i < (int)CharacterPositions.size(); ++i)
|
||||
std::map<int, int>::iterator pFind = mapCP.find(cp);
|
||||
|
||||
if (pFind != mapCP.end())
|
||||
{
|
||||
if (CharacterPositions[i] == cp)
|
||||
{
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
index = pFind->second;
|
||||
}
|
||||
|
||||
|
||||
if ((index >= 0) && (index < (int)Elements.size()))
|
||||
return this->Elements[index];
|
||||
|
||||
@ -128,13 +131,11 @@ namespace DocFileFormat
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
for (int i = 0; i < (int)CharacterPositions.size(); ++i)
|
||||
std::map<int, int>::const_iterator pFind = mapCP.find(cp);
|
||||
|
||||
if (pFind != mapCP.end())
|
||||
{
|
||||
if (CharacterPositions[i] == cp)
|
||||
{
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -142,7 +143,7 @@ namespace DocFileFormat
|
||||
|
||||
inline int operator [] (unsigned int index) const
|
||||
{
|
||||
if (index < CharacterPositions.size())
|
||||
if (index < (unsigned int)CharacterPositions.size())
|
||||
return CharacterPositions[index];
|
||||
|
||||
return -1;
|
||||
|
||||
@ -345,22 +345,23 @@ namespace DocFileFormat
|
||||
_tcPr->AppendChild( tcW );
|
||||
|
||||
|
||||
//if ( ( _gridIndex < (int)_grid->size() ) && ( nComputedCellWidth > _grid->at( _gridIndex ) ) )
|
||||
//{
|
||||
// //check the number of merged cells
|
||||
// int w = _grid->at( _gridIndex );
|
||||
if ( _gridSpan == 1 && ( _gridIndex < (int)_grid->size() ) && ( nComputedCellWidth > _grid->at( _gridIndex ) ) )
|
||||
{
|
||||
//check the number of merged cells
|
||||
int w = _grid->at( _gridIndex );
|
||||
|
||||
// for ( size_t i = _gridIndex + 1; i < _grid->size(); i++ )
|
||||
// {
|
||||
// _gridSpan++;
|
||||
for ( size_t i = _gridIndex + 1; i < _grid->size(); i++ )
|
||||
{
|
||||
_gridSpan++;
|
||||
|
||||
// w += _grid->at( i );
|
||||
w += _grid->at( i );
|
||||
|
||||
// if ( w >= nComputedCellWidth )
|
||||
// {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
if ( w >= nComputedCellWidth )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_gridSpan > 1)
|
||||
{
|
||||
appendValueElement( _tcPr, L"gridSpan", FormatUtils::IntToWideString( _gridSpan ), true );
|
||||
|
||||
@ -156,9 +156,8 @@ namespace DocFileFormat
|
||||
}break;
|
||||
|
||||
//div id
|
||||
case sprmTIpgp:
|
||||
case sprmTIpgp:// = PGPInfo.ipgpSelf (PGPInfo structure describes the border and margin properties)
|
||||
{
|
||||
appendValueElement( _trPr, L"divId", FormatUtils::IntToWideString( FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize ) ), true );
|
||||
}break;
|
||||
|
||||
//borders 80 exceptions
|
||||
|
||||
@ -142,7 +142,7 @@ namespace DocFileFormat
|
||||
{
|
||||
newXmlString.clear();
|
||||
|
||||
std::wstring sTempFolder = m_ctx->_doc->m_sTempFolder;
|
||||
std::wstring sTempFolder = m_context->_doc->m_sTempFolder;
|
||||
if (sTempFolder.empty())
|
||||
{
|
||||
sTempFolder = NSFile::CFileBinary::GetTempPath();
|
||||
@ -211,7 +211,7 @@ namespace DocFileFormat
|
||||
|
||||
VMLPictureMapping::VMLPictureMapping(ConversionContext* ctx, XMLTools::CStringXmlWriter* writer, bool olePreview, IMapping* caller, bool isInlinePicture) : PropertiesMapping(writer)
|
||||
{
|
||||
m_ctx = ctx;
|
||||
m_context = ctx;
|
||||
m_isOlePreview = olePreview;
|
||||
m_imageData = NULL;
|
||||
m_nImageId = 0;
|
||||
@ -229,7 +229,18 @@ namespace DocFileFormat
|
||||
{
|
||||
RELEASEOBJECT(m_imageData);
|
||||
}
|
||||
std::wstring VMLPictureMapping::GetShapeID(const Shape* pShape) const
|
||||
{
|
||||
std::wstring strXmlAttr;
|
||||
|
||||
if (NULL != pShape)
|
||||
{
|
||||
strXmlAttr += std::wstring(L"_x0000_i");
|
||||
strXmlAttr += FormatUtils::IntToWideString(pShape->GetShapeID());
|
||||
}
|
||||
|
||||
return strXmlAttr;
|
||||
}
|
||||
void VMLPictureMapping::Apply( IVisitable* visited )
|
||||
{
|
||||
PictureDescriptor* pict = dynamic_cast<PictureDescriptor*>(visited);
|
||||
@ -248,13 +259,14 @@ namespace DocFileFormat
|
||||
std::vector<OptionEntryPtr> options;
|
||||
|
||||
PictureFrameType type;
|
||||
Shape* pShape = NULL;
|
||||
if ((pict->shapeContainer || pict->blipStoreEntry) && pict->shapeContainer->Children.size() > 0)
|
||||
{
|
||||
Shape* shape = static_cast<Shape*>(*(pict->shapeContainer->Children.begin()));
|
||||
options = pict->shapeContainer->ExtractOptions();
|
||||
pShape = static_cast<Shape*>(*(pict->shapeContainer->Children.begin()));
|
||||
options = pict->shapeContainer->ExtractOptions();
|
||||
|
||||
//v:shapetype
|
||||
type.SetType(shape->Instance);
|
||||
type.SetType(pShape->Instance);
|
||||
|
||||
VMLShapeTypeMapping* vmlShapeTypeMapping = new VMLShapeTypeMapping( m_pXmlWriter, m_isInlinePicture );
|
||||
|
||||
@ -265,13 +277,16 @@ namespace DocFileFormat
|
||||
{
|
||||
type.SetType(msosptPictureFrame);
|
||||
}
|
||||
m_pXmlWriter->WriteNodeBegin( L"v:shape", true );
|
||||
m_pXmlWriter->WriteNodeBegin( L"v:shape", true );
|
||||
|
||||
//m_shapeId = GetShapeID(pShape); - todooo одинаковые картинки (одинаковый spid) - Anexo№3.doc
|
||||
|
||||
|
||||
count_vml_objects++;
|
||||
|
||||
if (m_shapeId.empty())
|
||||
m_shapeId = L"_x0000_s" + FormatUtils::IntToWideString(1024 + count_vml_objects);
|
||||
{
|
||||
m_context->_doc->GetOfficeArt()->m_uLastShapeId++;
|
||||
m_shapeId = L"_x0000_i" + FormatUtils::IntToWideString(m_context->_doc->GetOfficeArt()->m_uLastShapeId);
|
||||
}
|
||||
|
||||
m_pXmlWriter->WriteAttribute( L"id", m_shapeId);
|
||||
|
||||
@ -309,24 +324,28 @@ namespace DocFileFormat
|
||||
}break;
|
||||
//BORDERS
|
||||
case borderBottomColor:
|
||||
if (!pict->brcBottom)
|
||||
{
|
||||
RGBColor bottomColor( (int)iter->op, RedFirst );
|
||||
m_pXmlWriter->WriteAttribute( L"o:borderbottomcolor", L"#" + bottomColor.SixDigitHexCode);
|
||||
}
|
||||
break;
|
||||
case borderLeftColor:
|
||||
if (!pict->brcLeft)
|
||||
{
|
||||
RGBColor leftColor( (int)iter->op, RedFirst );
|
||||
m_pXmlWriter->WriteAttribute( L"o:borderleftcolor", L"#" + leftColor.SixDigitHexCode);
|
||||
}
|
||||
break;
|
||||
case borderRightColor:
|
||||
if (!pict->brcRight)
|
||||
{
|
||||
RGBColor rightColor( (int)iter->op, RedFirst );
|
||||
m_pXmlWriter->WriteAttribute( L"o:borderrightcolor", L"#" + rightColor.SixDigitHexCode);
|
||||
}
|
||||
break;
|
||||
case borderTopColor:
|
||||
if (!pict->brcTop)
|
||||
{
|
||||
RGBColor topColor( (int)iter->op, RedFirst );
|
||||
m_pXmlWriter->WriteAttribute( L"o:bordertopcolor", L"#" + topColor.SixDigitHexCode);
|
||||
@ -443,14 +462,15 @@ namespace DocFileFormat
|
||||
}
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
//v:imageData
|
||||
if (CopyPicture(pict))
|
||||
{
|
||||
//v:imageData
|
||||
appendValueAttribute(m_imageData, L"r:id", L"rId" + FormatUtils::IntToWideString(m_nImageId));
|
||||
appendValueAttribute(m_imageData, L"o:title", L"" );
|
||||
m_pXmlWriter->WriteString(m_imageData->GetXMLString());
|
||||
}
|
||||
|
||||
|
||||
{//borders
|
||||
writePictureBorder( L"bordertop", pict->brcTop );
|
||||
writePictureBorder( L"borderleft", pict->brcLeft );
|
||||
@ -510,10 +530,10 @@ namespace DocFileFormat
|
||||
pict->embeddedData = newData;
|
||||
|
||||
}
|
||||
m_ctx->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(Global::msoblipDIB),
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(Global::msoblipDIB),
|
||||
std::vector<unsigned char>(pict->embeddedData, (pict->embeddedData + pict->embeddedDataSize)), Global::msoblipDIB));
|
||||
|
||||
m_nImageId = m_ctx->_docx->RegisterImage(m_caller, btWin32);
|
||||
m_nImageId = m_context->_docx->RegisterImage(m_caller, btWin32);
|
||||
result = true;
|
||||
}
|
||||
else if ((oBlipEntry != NULL) && (oBlipEntry->Blip != NULL))
|
||||
@ -530,7 +550,7 @@ namespace DocFileFormat
|
||||
unsigned char *newData = NULL;
|
||||
int newDataSize = metaBlip->oMetaFile.ToBuffer(newData);
|
||||
|
||||
m_ctx->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlipEntry->btWin32), std::vector<unsigned char>(newData, (newData + newDataSize))));
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlipEntry->btWin32), std::vector<unsigned char>(newData, (newData + newDataSize))));
|
||||
|
||||
RELEASEARRAYOBJECTS(newData);
|
||||
}
|
||||
@ -546,7 +566,7 @@ namespace DocFileFormat
|
||||
BitmapBlip* bitBlip = static_cast<BitmapBlip*>(oBlipEntry->Blip);
|
||||
if (bitBlip)
|
||||
{
|
||||
m_ctx->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlipEntry->btWin32),
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlipEntry->btWin32),
|
||||
std::vector<unsigned char>(bitBlip->m_pvBits, (bitBlip->m_pvBits + bitBlip->pvBitsSize)), oBlipEntry->btWin32));
|
||||
}
|
||||
}break;
|
||||
@ -557,7 +577,7 @@ namespace DocFileFormat
|
||||
}break;
|
||||
}
|
||||
|
||||
m_nImageId = m_ctx->_docx->RegisterImage(m_caller, oBlipEntry->btWin32);
|
||||
m_nImageId = m_context->_docx->RegisterImage(m_caller, oBlipEntry->btWin32);
|
||||
result = true;
|
||||
}
|
||||
|
||||
|
||||
@ -58,6 +58,7 @@ namespace DocFileFormat
|
||||
void writePictureBorder (const std::wstring & name, const BorderCode* brc);
|
||||
void appendStyleProperty( std::wstring* b, const std::wstring& propName, const std::wstring& propValue ) const;
|
||||
bool ParseEmbeddedEquation( const std::string & xmlString, std::wstring & newXmlString );
|
||||
std::wstring GetShapeID(const Shape* pShape) const;
|
||||
protected:
|
||||
/// Copies the picture from the binary stream to the zip archive
|
||||
/// and creates the relationships for the image.
|
||||
@ -77,7 +78,7 @@ namespace DocFileFormat
|
||||
std::wstring m_shapeId;
|
||||
private:
|
||||
|
||||
ConversionContext* m_ctx;
|
||||
ConversionContext* m_context;
|
||||
IMapping* m_caller;
|
||||
int m_nImageId;
|
||||
|
||||
|
||||
@ -235,10 +235,11 @@ namespace DocFileFormat
|
||||
|
||||
m_shapeId = GetShapeID(pShape);
|
||||
|
||||
count_vml_objects++;
|
||||
|
||||
if (m_shapeId.empty())
|
||||
m_shapeId = std::wstring(L"_x0000_s") + FormatUtils::IntToWideString(1024 + count_vml_objects);
|
||||
{
|
||||
m_context->_doc->GetOfficeArt()->m_uLastShapeId++;
|
||||
m_shapeId = std::wstring(L"_x0000_s") + FormatUtils::IntToWideString(m_context->_doc->GetOfficeArt()->m_uLastShapeId);
|
||||
}
|
||||
|
||||
m_pXmlWriter->WriteAttribute ( L"id", m_shapeId );
|
||||
|
||||
@ -249,7 +250,7 @@ namespace DocFileFormat
|
||||
freeform = false;
|
||||
m_pXmlWriter->WriteAttribute( L"type", (std::wstring(L"#") + VMLShapeTypeMapping::GenerateTypeId(pShape->GetShapeType())));
|
||||
}
|
||||
m_pXmlWriter->WriteAttribute( L"style", FormatUtils::XmlEncode(buildStyle(pShape, pAnchor, options, pContainer->Index)));
|
||||
m_pXmlWriter->WriteAttribute( L"style", FormatUtils::XmlEncode(buildStyle(pShape, pAnchor, options, pContainer->m_nIndex)));
|
||||
|
||||
if (pShape->is<LineType>())
|
||||
{
|
||||
@ -2265,9 +2266,10 @@ namespace DocFileFormat
|
||||
TwipsValue w( primitive->dxa );
|
||||
TwipsValue h( primitive->dya );
|
||||
|
||||
std::wstring strId = std::wstring(L"_x0000_s") + FormatUtils::IntToWideString(1024 + count_vml_objects);
|
||||
m_context->_doc->GetOfficeArt()->m_uLastShapeId++;
|
||||
|
||||
std::wstring strId = std::wstring(L"_x0000_s") + FormatUtils::IntToWideString(m_context->_doc->GetOfficeArt()->m_uLastShapeId);
|
||||
|
||||
count_vml_objects++;
|
||||
//m_pXmlWriter->WriteAttribute ( L"id") , strId);
|
||||
m_pXmlWriter->WriteAttribute ( L"o:spid", strId);
|
||||
|
||||
|
||||
@ -124,12 +124,12 @@ namespace DocFileFormat
|
||||
else if (_isInlineShape)
|
||||
{
|
||||
m_pXmlWriter->WriteString(L"<v:formulas><v:f eqn=\"if lineDrawn pixelLineWidth 0\"/>\
|
||||
<v:f eqn=\"sum @0 1 0\"/><v:f eqn=\"sum 0 0 @1\"/>\
|
||||
<v:f eqn=\"prod @2 1 2\"/><v:f eqn=\"prod @3 21600 pixelWidth\"/>\
|
||||
<v:f eqn=\"prod @3 21600 pixelHeight\"/><v:f eqn=\"sum @0 0 1\"/>\
|
||||
<v:f eqn=\"prod @6 1 2\"/><v:f eqn=\"prod @7 21600 pixelWidth\"/>\
|
||||
<v:f eqn=\"sum @8 21600 0\"/><v:f eqn=\"prod @7 21600 pixelHeight\"/>\
|
||||
<v:f eqn=\"sum @10 21600 0\"/></v:formulas>");
|
||||
<v:f eqn=\"sum @0 1 0\"/><v:f eqn=\"sum 0 0 @1\"/>\
|
||||
<v:f eqn=\"prod @2 1 2\"/><v:f eqn=\"prod @3 21600 pixelWidth\"/>\
|
||||
<v:f eqn=\"prod @3 21600 pixelHeight\"/><v:f eqn=\"sum @0 0 1\"/>\
|
||||
<v:f eqn=\"prod @6 1 2\"/><v:f eqn=\"prod @7 21600 pixelWidth\"/>\
|
||||
<v:f eqn=\"sum @8 21600 0\"/><v:f eqn=\"prod @7 21600 pixelHeight\"/>\
|
||||
<v:f eqn=\"sum @10 21600 0\"/></v:formulas>");
|
||||
}
|
||||
|
||||
// Path
|
||||
|
||||
@ -37,8 +37,6 @@
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
static int count_vml_objects = 0;
|
||||
|
||||
class VMLShapeTypeMapping: public PropertiesMapping, public IMapping
|
||||
{
|
||||
private:
|
||||
|
||||
@ -85,7 +85,7 @@ namespace DocFileFormat
|
||||
IndividualFootnotesPlex(NULL), FootnoteReferenceCharactersPlex(NULL), IndividualEndnotesPlex(NULL),
|
||||
EndnoteReferenceCharactersPlex(NULL), FieldsPlex(NULL), FootnoteDocumentFieldsPlex(NULL),
|
||||
EndnoteDocumentFieldsPlex(NULL), HeadersAndFootersDocumentFieldsPlex(NULL), HeaderStoriesPlex(NULL),
|
||||
AnnotationsReferencePlex(NULL), IndividualCommentsPlex(NULL), TextboxBreakPlex(NULL), TextboxBreakPlexHeader(NULL),
|
||||
AnnotationsReferencePlex(NULL), AnnotationsReferenceExPlex(NULL), IndividualCommentsPlex(NULL), TextboxBreakPlex(NULL), TextboxBreakPlexHeader(NULL),
|
||||
TextboxIndividualPlex(NULL),AssocNames(NULL), BookmarkAnnotNames(NULL), Captions(NULL), AutoCaptions(NULL), ListPlex(NULL),
|
||||
OfficeDrawingPlex(NULL), OfficeDrawingPlexHeader(NULL), SectionPlex(NULL), BookmarkStartPlex(NULL), BookmarkEndPlex(NULL),
|
||||
AutoTextPlex(NULL), AllPapxFkps(NULL), AllChpxFkps(NULL), AllPapx(NULL), AllPapxVector(NULL), AllSepx(NULL), Styles(NULL), listTable(NULL),
|
||||
@ -117,7 +117,7 @@ namespace DocFileFormat
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
int WordDocument::LoadDocument(const std::wstring & fileName, const std::wstring & password)
|
||||
_UINT32 WordDocument::LoadDocument(const std::wstring & fileName, const std::wstring & password)
|
||||
{
|
||||
m_sFileName = fileName;
|
||||
m_sPassword = password;
|
||||
@ -318,8 +318,8 @@ namespace DocFileFormat
|
||||
// Read all needed PLCFs
|
||||
if (FIB->m_RgLw97.ccpFtn > 0)
|
||||
{
|
||||
IndividualFootnotesPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcffndTxt, FIB->m_FibWord97.lcbPlcffndTxt, nWordVersion);
|
||||
FootnoteReferenceCharactersPlex = new Plex<FootnoteDescriptor>(FootnoteDescriptor::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcffndRef, FIB->m_FibWord97.lcbPlcffndRef, nWordVersion);
|
||||
IndividualFootnotesPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcffndTxt, FIB->m_FibWord97.lcbPlcffndTxt, nWordVersion);
|
||||
}
|
||||
|
||||
if (nWordVersion > 0 && FIB->m_FibWord97.lcbPlcPad > 0)
|
||||
@ -329,8 +329,8 @@ namespace DocFileFormat
|
||||
|
||||
if (FIB->m_RgLw97.ccpEdn > 0)
|
||||
{
|
||||
IndividualEndnotesPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfendTxt, FIB->m_FibWord97.lcbPlcfendTxt, nWordVersion);
|
||||
EndnoteReferenceCharactersPlex = new Plex<EndnoteDescriptor>(EndnoteDescriptor::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfendRef, FIB->m_FibWord97.lcbPlcfendRef, nWordVersion);
|
||||
IndividualEndnotesPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfendTxt, FIB->m_FibWord97.lcbPlcfendTxt, nWordVersion);
|
||||
}
|
||||
|
||||
if (FIB->m_RgLw97.ccpHdr > 0)
|
||||
@ -343,6 +343,11 @@ namespace DocFileFormat
|
||||
AnnotationsReferencePlex = new Plex<AnnotationReferenceDescriptor>(AnnotationReferenceDescriptor::GetSize(nWordVersion), TableStream, FIB->m_FibWord97.fcPlcfandRef, FIB->m_FibWord97.lcbPlcfandRef, nWordVersion);
|
||||
IndividualCommentsPlex = new Plex<EmptyStructure> (EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfandTxt, FIB->m_FibWord97.lcbPlcfandTxt, nWordVersion);
|
||||
}
|
||||
|
||||
if (FIB->m_FibWord2002.lcbAtrdExtra > 0)
|
||||
{
|
||||
AnnotationsReferenceExPlex = new Plex<AnnotationReferenceExDescriptor>(AnnotationReferenceExDescriptor::GetSize(nWordVersion), TableStream, FIB->m_FibWord2002.fcAtrdExtra, FIB->m_FibWord2002.lcbAtrdExtra, nWordVersion);
|
||||
}
|
||||
OfficeDrawingPlex = new Plex<Spa> (Spa::GetSize(nWordVersion), TableStream, FIB->m_FibWord97.fcPlcSpaMom, FIB->m_FibWord97.lcbPlcSpaMom, nWordVersion);
|
||||
OfficeDrawingPlexHeader = new Plex<Spa> (Spa::GetSize(nWordVersion), TableStream, FIB->m_FibWord97.fcPlcSpaHdr, FIB->m_FibWord97.lcbPlcSpaHdr, nWordVersion);
|
||||
|
||||
@ -356,7 +361,7 @@ namespace DocFileFormat
|
||||
TextboxBreakPlex = new Plex<Tbkd> (Tbkd::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfTxbxBkd, FIB->m_FibWord97.lcbPlcfTxbxBkd, nWordVersion);
|
||||
TextboxBreakPlexHeader = new Plex<Tbkd> (Tbkd::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfTxbxHdrBkd, FIB->m_FibWord97.lcbPlcfTxbxHdrBkd, nWordVersion);
|
||||
|
||||
AnnotStartPlex = new Plex<BookmarkFirst> (BookmarkFirst::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfAtnBkf, FIB->m_FibWord97.lcbPlcfAtnBkf, nWordVersion);
|
||||
AnnotStartPlex = new Plex<BookmarkFirst> (BookmarkFirst::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfAtnBkf, FIB->m_FibWord97.lcbPlcfAtnBkf, nWordVersion);
|
||||
AnnotEndPlex = new Plex<EmptyStructure> (EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfAtnBkl, FIB->m_FibWord97.lcbPlcfAtnBkl, nWordVersion);
|
||||
|
||||
|
||||
@ -368,18 +373,19 @@ namespace DocFileFormat
|
||||
BookmarkStartEndCPs.push_back(std::make_pair(BookmarkStartPlex->CharacterPositions[i], BookmarkEndPlex->CharacterPositions[pBookmark->GetIndex()]));
|
||||
}
|
||||
}
|
||||
for (size_t i = 0; i < AnnotStartPlex->Elements.size(); ++i)
|
||||
for (size_t i = 0; AnnotStartPlex && i < AnnotStartPlex->Elements.size(); ++i)
|
||||
{
|
||||
BookmarkFirst* pBookmark = static_cast<BookmarkFirst*>(AnnotStartPlex->Elements[i]);
|
||||
BookmarkFirst* pBookmark = static_cast<BookmarkFirst*>(AnnotStartPlex->Elements[i]);
|
||||
if (pBookmark)
|
||||
{
|
||||
short end = pBookmark->GetIndex();
|
||||
if (i < AnnotStartPlex->CharacterPositions.size() && end < AnnotEndPlex->CharacterPositions.size())
|
||||
short ind = pBookmark->GetIndex();
|
||||
if (i < AnnotStartPlex->CharacterPositions.size() -1 )
|
||||
{
|
||||
AnnotStartEndCPs.push_back(std::make_pair(AnnotStartPlex->CharacterPositions[i], AnnotEndPlex->CharacterPositions[end]));
|
||||
AnnotStartEndCPs.push_back(std::make_pair(AnnotStartPlex->CharacterPositions[i], AnnotEndPlex->CharacterPositions[i + 1]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AutoTextPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfGlsy, FIB->m_FibWord97.lcbPlcfGlsy, nWordVersion);
|
||||
FieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldMom, FIB->m_FibWord97.lcbPlcfFldMom, nWordVersion);
|
||||
FootnoteDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldFtn, FIB->m_FibWord97.lcbPlcfFldFtn, nWordVersion);
|
||||
@ -435,7 +441,7 @@ namespace DocFileFormat
|
||||
std::unordered_map<int, int> fonts_charsets;
|
||||
bool bFontsCodePage = false;
|
||||
|
||||
for ( size_t i = 0; !bFontsCodePage && i < FontTable->Data.size(); ++i)
|
||||
for ( size_t i = 0; FIB->m_FibWord97.lcbClx > 0 && !bFontsCodePage && i < FontTable->Data.size(); ++i)
|
||||
{
|
||||
FontFamilyName* font = dynamic_cast<FontFamilyName*>( FontTable->Data[i]);
|
||||
if (!font) continue;
|
||||
@ -446,7 +452,7 @@ namespace DocFileFormat
|
||||
|
||||
for (size_t j = 0 ; j < 32; j++)
|
||||
{
|
||||
if (aCodePages[j][0] == font->chs && font->chs != 0)
|
||||
if (aCodePages[j][0] == font->chs && font->chs > 2)
|
||||
{
|
||||
nFontsCodePage = aCodePages[j][1];
|
||||
bFontsCodePage = true;
|
||||
@ -488,13 +494,13 @@ namespace DocFileFormat
|
||||
|
||||
if (BookmarkNames)
|
||||
{
|
||||
for (unsigned int i = 0; i < BookmarkStartEndCPs.size(); ++i)
|
||||
for (size_t i = 0; i < BookmarkStartEndCPs.size(); ++i)
|
||||
{
|
||||
WideString* bookmarkName = static_cast<WideString*>(BookmarkNames->operator[]( i ));
|
||||
|
||||
if ( ( bookmarkName != NULL ) && ( *bookmarkName == L"_PictureBullets" ) )
|
||||
{
|
||||
for (unsigned int j = BookmarkStartEndCPs[i].first, k = 0; j < Text->size(); ++j, ++k )
|
||||
for (size_t j = BookmarkStartEndCPs[i].first, k = 0; j < Text->size(); ++j, ++k )
|
||||
{
|
||||
if ( Text->at( j ) == 1 )
|
||||
{
|
||||
@ -540,7 +546,7 @@ namespace DocFileFormat
|
||||
{
|
||||
AllSepx = new std::map<int, SectionPropertyExceptions*>();
|
||||
|
||||
for (unsigned int i = 0; i < SectionPlex->Elements.size(); ++i)
|
||||
for (size_t i = 0; i < SectionPlex->Elements.size(); ++i)
|
||||
{
|
||||
//Read the SED
|
||||
SectionDescriptor* sed = static_cast<SectionDescriptor*>(SectionPlex->Elements.at(i));
|
||||
@ -869,6 +875,7 @@ namespace DocFileFormat
|
||||
RELEASEOBJECT(HeaderStoriesPlex);
|
||||
RELEASEOBJECT(IndividualCommentsPlex);
|
||||
RELEASEOBJECT(AnnotationsReferencePlex);
|
||||
RELEASEOBJECT(AnnotationsReferenceExPlex);
|
||||
RELEASEOBJECT(TextboxBreakPlex);
|
||||
RELEASEOBJECT(TextboxBreakPlexHeader);
|
||||
RELEASEOBJECT(OfficeDrawingPlex);
|
||||
|
||||
@ -94,7 +94,7 @@ namespace DocFileFormat
|
||||
WordDocument (const ProgressCallback* pCallFunc, const std::wstring & tempFolder );
|
||||
virtual ~WordDocument();
|
||||
|
||||
int LoadDocument(const std::wstring & fileName, const std::wstring & password);
|
||||
_UINT32 LoadDocument(const std::wstring & fileName, const std::wstring & password);
|
||||
|
||||
int nWordVersion;
|
||||
int nDocumentCodePage;
|
||||
@ -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
|
||||
|
||||
@ -34,9 +34,9 @@
|
||||
#include "../DocDocxConverter/Converter.h"
|
||||
#include "../../OfficeUtils/src/OfficeUtils.h"
|
||||
|
||||
HRESULT COfficeDocFile::LoadFromFile(const std::wstring & docFile, const std::wstring & docxDirectory, const std::wstring & password, bool &bMacros, ProgressCallback *ffCallBack)
|
||||
_UINT32 COfficeDocFile::LoadFromFile(const std::wstring & docFile, const std::wstring & docxDirectory, const std::wstring & password, bool &bMacros, ProgressCallback *ffCallBack)
|
||||
{
|
||||
HRESULT hr = S_FALSE;
|
||||
_UINT32 hr = 0;
|
||||
|
||||
DocFileFormat::Converter docToDocx;
|
||||
docToDocx.m_sTempFolder = m_sTempFolder;
|
||||
@ -46,7 +46,7 @@ HRESULT COfficeDocFile::LoadFromFile(const std::wstring & docFile, const std::w
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT COfficeDocFile::SaveToFile (const std::wstring & sDstFileName, const std::wstring & sSrcFileName, ProgressCallback *ffCallBack )
|
||||
_UINT32 COfficeDocFile::SaveToFile (const std::wstring & sDstFileName, const std::wstring & sSrcFileName, ProgressCallback *ffCallBack )
|
||||
{
|
||||
return S_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -53,8 +53,8 @@ public:
|
||||
|
||||
std::wstring m_sTempFolder;
|
||||
|
||||
HRESULT LoadFromFile(const std::wstring & sSrcFileName, const std::wstring & sDstFileName, const std::wstring & password, bool &bMacros, ProgressCallback *ffCallBack = NULL);
|
||||
HRESULT SaveToFile(const std::wstring & sDstFileName, const std::wstring & sSrcFileName, ProgressCallback *ffCallBack = NULL);
|
||||
_UINT32 LoadFromFile(const std::wstring & sSrcFileName, const std::wstring & sDstFileName, const std::wstring & password, bool &bMacros, ProgressCallback *ffCallBack = NULL);
|
||||
_UINT32 SaveToFile(const std::wstring & sDstFileName, const std::wstring & sSrcFileName, ProgressCallback *ffCallBack = NULL);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
@ -8004,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();
|
||||
@ -8424,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;
|
||||
}
|
||||
@ -8575,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
|
||||
{
|
||||
@ -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);
|
||||
@ -7074,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);
|
||||
@ -7477,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())
|
||||
@ -7528,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)
|
||||
{
|
||||
@ -7843,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
|
||||
{
|
||||
@ -8039,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
|
||||
|
||||
@ -85,7 +85,7 @@ namespace BinXlsxRW{
|
||||
sMediaPath = pathMediaDir.GetPath();
|
||||
sEmbedPath = pathEmbedDir.GetPath();
|
||||
}
|
||||
int CXlsxSerializer::loadFromFile(const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sMediaDir, const std::wstring& sEmbedDir)
|
||||
_UINT32 CXlsxSerializer::loadFromFile(const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sMediaDir, const std::wstring& sEmbedDir)
|
||||
{
|
||||
std::wstring strFileInDir = NSSystemPath::GetDirectoryName(sSrcFileName);
|
||||
|
||||
@ -100,7 +100,7 @@ namespace BinXlsxRW{
|
||||
BinXlsxRW::BinaryFileReader oBinaryFileReader;
|
||||
return oBinaryFileReader.ReadFile(sSrcFileName, sDstPath, &oDrawingConverter, sXMLOptions);
|
||||
}
|
||||
int CXlsxSerializer::saveToFile(const std::wstring& sDstFileName, const std::wstring& sSrcPath, const std::wstring& sXMLOptions)
|
||||
_UINT32 CXlsxSerializer::saveToFile(const std::wstring& sDstFileName, const std::wstring& sSrcPath, const std::wstring& sXMLOptions)
|
||||
{
|
||||
COfficeFontPicker* pFontPicker = new COfficeFontPicker();
|
||||
pFontPicker->Init(m_sFontDir);
|
||||
@ -136,7 +136,7 @@ namespace BinXlsxRW{
|
||||
oOfficeDrawingConverter.SetFontPicker(pFontPicker);
|
||||
|
||||
BinXlsxRW::BinaryFileWriter oBinaryFileWriter(fp);
|
||||
int result = oBinaryFileWriter.Open(sSrcPath, sDstFileName, pEmbeddedFontsManager, &oOfficeDrawingConverter, sXMLOptions, m_bIsNoBase64);
|
||||
_UINT32 result = oBinaryFileWriter.Open(sSrcPath, sDstFileName, pEmbeddedFontsManager, &oOfficeDrawingConverter, sXMLOptions, m_bIsNoBase64);
|
||||
|
||||
RELEASEOBJECT(pFontPicker);
|
||||
return result;
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
#define XLSX_SERIALIZER
|
||||
|
||||
#include <string>
|
||||
#include "../../Common/DocxFormat/Source/Base/Types_32.h"
|
||||
|
||||
namespace OOX
|
||||
{
|
||||
@ -62,8 +63,8 @@ namespace BinXlsxRW {
|
||||
|
||||
static void CreateXlsxFolders (const std::wstring& sXmlOptions, const std::wstring& sDstPath, std::wstring& sMediaPath, std::wstring& sEmbedPath);
|
||||
|
||||
int loadFromFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sMediaDir, const std::wstring& sEmbedPath);
|
||||
int saveToFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions);
|
||||
_UINT32 loadFromFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sMediaDir, const std::wstring& sEmbedPath);
|
||||
_UINT32 saveToFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions);
|
||||
|
||||
bool saveChart (NSBinPptxRW::CBinaryFileReader* pReader, long lLength, const std::wstring& sFilename, const long& lChartNumber);
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 \
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
|
||||
#include "../include/odf/odf_document.h"
|
||||
|
||||
int ConvertOds2Xlsx(cpdoccore::odf_reader::odf_document & inputOdf, const std::wstring & dstPath, const std::wstring & fontsPath)
|
||||
_UINT32 ConvertOds2Xlsx(cpdoccore::odf_reader::odf_document & inputOdf, const std::wstring & dstPath, const std::wstring & fontsPath)
|
||||
{
|
||||
cpdoccore::oox::package::xlsx_document outputXlsx;
|
||||
cpdoccore::oox::xlsx_conversion_context conversionContext( &inputOdf);
|
||||
@ -56,7 +56,7 @@ int ConvertOds2Xlsx(cpdoccore::odf_reader::odf_document & inputOdf, const std::w
|
||||
outputXlsx.write(dstPath);
|
||||
return 0;
|
||||
}
|
||||
int ConvertOdt2Docx(cpdoccore::odf_reader::odf_document & inputOdf, const std::wstring & dstPath, const std::wstring & fontsPath)
|
||||
_UINT32 ConvertOdt2Docx(cpdoccore::odf_reader::odf_document & inputOdf, const std::wstring & dstPath, const std::wstring & fontsPath)
|
||||
{
|
||||
cpdoccore::oox::package::docx_document outputDocx;
|
||||
cpdoccore::oox::docx_conversion_context conversionContext(&inputOdf);
|
||||
@ -70,7 +70,7 @@ int ConvertOdt2Docx(cpdoccore::odf_reader::odf_document & inputOdf, const std::w
|
||||
|
||||
return 0;
|
||||
}
|
||||
int ConvertOdp2Pptx(cpdoccore::odf_reader::odf_document & inputOdf, const std::wstring & dstPath, const std::wstring & fontsPath)
|
||||
_UINT32 ConvertOdp2Pptx(cpdoccore::odf_reader::odf_document & inputOdf, const std::wstring & dstPath, const std::wstring & fontsPath)
|
||||
{
|
||||
cpdoccore::oox::package::pptx_document outputPptx;
|
||||
cpdoccore::oox::pptx_conversion_context conversionContext(&inputOdf);
|
||||
@ -83,9 +83,9 @@ int ConvertOdp2Pptx(cpdoccore::odf_reader::odf_document & inputOdf, const std::w
|
||||
|
||||
return 0;
|
||||
}
|
||||
int ConvertODF2OOXml(const std::wstring & srcPath, const std::wstring & dstPath, const std::wstring & fontsPath, const std::wstring & tempPath, const std::wstring & password, const ProgressCallback* CallBack)
|
||||
_UINT32 ConvertODF2OOXml(const std::wstring & srcPath, const std::wstring & dstPath, const std::wstring & fontsPath, const std::wstring & tempPath, const std::wstring & password, const ProgressCallback* CallBack)
|
||||
{
|
||||
int nResult = 0;
|
||||
_UINT32 nResult = 0;
|
||||
|
||||
try
|
||||
{
|
||||
@ -134,9 +134,9 @@ int ConvertODF2OOXml(const std::wstring & srcPath, const std::wstring & dstPath,
|
||||
|
||||
}
|
||||
|
||||
int ConvertOTF2ODF(const std::wstring & srcPath)
|
||||
_UINT32 ConvertOTF2ODF(const std::wstring & srcPath)
|
||||
{
|
||||
int nResult = 0;
|
||||
_UINT32 nResult = 0;
|
||||
|
||||
std::wstring manifest_xml = srcPath + FILE_SEPARATOR_STR + L"META-INF" + FILE_SEPARATOR_STR + L"manifest.xml";
|
||||
std::wstring mimetype_xml = srcPath + FILE_SEPARATOR_STR + L"mimetype";
|
||||
|
||||
@ -31,10 +31,11 @@
|
||||
*/
|
||||
|
||||
#include "../../DesktopEditor/common/Types.h"
|
||||
#include "../../Common/DocxFormat/Source/Base/Types_32.h"
|
||||
#include <string>
|
||||
|
||||
struct ProgressCallback;
|
||||
|
||||
int ConvertODF2OOXml(const std::wstring & srcPath, const std::wstring & dstPath, const std::wstring & fontsPath, const std::wstring & tempPath, const std::wstring & password, const ProgressCallback* CallBack);
|
||||
_UINT32 ConvertODF2OOXml(const std::wstring & srcPath, const std::wstring & dstPath, const std::wstring & fontsPath, const std::wstring & tempPath, const std::wstring & password, const ProgressCallback* CallBack);
|
||||
|
||||
int ConvertOTF2ODF(const std::wstring & otfPath);
|
||||
_UINT32 ConvertOTF2ODF(const std::wstring & otfPath);
|
||||
|
||||
@ -182,9 +182,7 @@ docx_conversion_context::docx_conversion_context(odf_reader::odf_document * OdfD
|
||||
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),
|
||||
@ -195,7 +193,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),
|
||||
@ -247,14 +244,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();
|
||||
@ -272,36 +269,36 @@ 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;
|
||||
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)
|
||||
{
|
||||
@ -309,7 +306,7 @@ void docx_conversion_context::finish_run()
|
||||
get_comments_context().state(0);
|
||||
}
|
||||
output_stream() << L"</w:r>";
|
||||
in_run_ = false;
|
||||
state_.in_run_ = false;
|
||||
|
||||
if (get_comments_context().state() == 2)
|
||||
{
|
||||
@ -465,22 +462,34 @@ void docx_conversion_context::start_field(const std::wstring & sInstrText, const
|
||||
output_stream() << L"</w:fldChar>";
|
||||
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: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: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>";
|
||||
|
||||
std::wstring sName = fields_names_stack_.back();
|
||||
fields_names_stack_.pop_back();
|
||||
|
||||
if (!sName.empty())
|
||||
{
|
||||
end_bookmark(sName);
|
||||
}
|
||||
}
|
||||
void docx_conversion_context::end_sdt()
|
||||
{
|
||||
@ -619,6 +628,22 @@ 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();
|
||||
@ -937,10 +962,10 @@ mc:Ignorable=\"w14 wp14\">";
|
||||
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(arListStyles[i]->get_text_list_style()->get_style_name());
|
||||
content[i]->docx_convert(*this);
|
||||
content[j]->docx_convert(*this);
|
||||
// TODO
|
||||
end_text_list_style();
|
||||
}
|
||||
@ -1034,13 +1059,36 @@ 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>";
|
||||
|
||||
for (size_t i = 0; i < arStyles.size(); i++)
|
||||
@ -1087,7 +1135,10 @@ void docx_conversion_context::process_styles()
|
||||
|
||||
if (odf_reader::style_content * content = arStyles[i]->content())
|
||||
{
|
||||
get_styles_context().start_process_style(arStyles[i].get());
|
||||
get_tabs_context().clear();
|
||||
odf_reader::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();
|
||||
}
|
||||
@ -1337,22 +1388,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>();
|
||||
|
||||
for (size_t i = 0; i < text_properties_stack_.size(); i++)
|
||||
for (size_t i = 0; i < state_.text_properties_stack_.size(); i++)
|
||||
{
|
||||
if (text_properties_stack_[i])
|
||||
cur->content().apply_from( text_properties_stack_[i]->content() );
|
||||
if (state_.text_properties_stack_[i])
|
||||
cur->content().apply_from( state_.text_properties_stack_[i]->content() );
|
||||
}
|
||||
return cur;
|
||||
}
|
||||
@ -1599,15 +1650,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;
|
||||
}
|
||||
}
|
||||
@ -1911,7 +1978,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;
|
||||
@ -2083,7 +2150,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>";
|
||||
|
||||
@ -668,7 +668,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;
|
||||
@ -798,8 +798,6 @@ 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 start_paragraph (bool is_header = false);
|
||||
void finish_paragraph ();
|
||||
@ -807,10 +805,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; }
|
||||
@ -990,6 +996,17 @@ public:
|
||||
|
||||
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_;
|
||||
@ -1032,8 +1049,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_;
|
||||
@ -1042,12 +1062,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_;
|
||||
@ -1056,7 +1074,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_;// цепочки переименований нумераций
|
||||
|
||||
|
||||
@ -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"
|
||||
@ -312,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()) ;
|
||||
|
||||
@ -1071,10 +1071,10 @@ void draw_shape::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
bool runState = Context.get_run_state();
|
||||
bool paraState = Context.get_paragraph_state();
|
||||
bool keepState = Context.get_paragraph_keep();
|
||||
|
||||
//Context.set_run_state (false);
|
||||
Context.set_paragraph_state (false);
|
||||
Context.reset_context_state();
|
||||
Context.set_run_state (runState);
|
||||
//Context.set_paragraph_state (false);
|
||||
|
||||
bool new_run = false;
|
||||
|
||||
@ -1106,7 +1106,8 @@ void draw_shape::docx_convert(oox::docx_conversion_context & Context)
|
||||
}
|
||||
}
|
||||
|
||||
Context.set_paragraph_state(paraState);
|
||||
//Context.set_paragraph_state(paraState);
|
||||
Context.back_context_state();
|
||||
|
||||
Context.get_drawing_context().stop_shape();
|
||||
}
|
||||
@ -1142,19 +1143,14 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
|
||||
std::wstringstream temp_stream(Context.get_drawing_context().get_text_stream_frame());
|
||||
Context.set_stream_man( boost::shared_ptr<oox::streams_man>( new oox::streams_man(temp_stream) ));
|
||||
|
||||
bool runState = Context.get_run_state ();
|
||||
bool pState = Context.get_paragraph_state ();
|
||||
|
||||
Context.set_run_state (false);
|
||||
Context.set_paragraph_state (false);
|
||||
Context.reset_context_state();
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
|
||||
Context.set_run_state (runState);
|
||||
Context.set_paragraph_state (pState);
|
||||
Context.back_context_state();
|
||||
|
||||
Context.get_drawing_context().get_text_stream_frame() = temp_stream.str();
|
||||
Context.set_stream_man(prev);
|
||||
@ -1208,12 +1204,7 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
|
||||
std::wstringstream temp_stream(Context.get_drawing_context().get_text_stream_frame());
|
||||
Context.set_stream_man( boost::shared_ptr<oox::streams_man>( new oox::streams_man(temp_stream) ));
|
||||
|
||||
bool pState = Context.get_paragraph_state ();
|
||||
bool runState = Context.get_run_state ();
|
||||
bool keepState = Context.get_paragraph_keep ();
|
||||
|
||||
Context.set_run_state (false);
|
||||
Context.set_paragraph_state (false);
|
||||
Context.reset_context_state();
|
||||
|
||||
bool drState = Context.get_drawing_state_content();
|
||||
|
||||
@ -1227,10 +1218,8 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
|
||||
Context.get_drawing_context().get_text_stream_frame() = temp_stream.str();
|
||||
Context.set_stream_man(prev);
|
||||
|
||||
Context.set_run_state (runState);
|
||||
Context.set_paragraph_state (pState);
|
||||
Context.set_drawing_state_content (drState);
|
||||
Context.set_paragraph_keep (keepState);
|
||||
Context.back_context_state();
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
|
||||
@ -1355,11 +1344,7 @@ void draw_g::docx_convert(oox::docx_conversion_context & Context)
|
||||
std::wstringstream temp_stream(drawing.content_group_);
|
||||
Context.set_stream_man( boost::shared_ptr<oox::streams_man>( new oox::streams_man(temp_stream) ));
|
||||
|
||||
bool pState = Context.get_paragraph_state ();
|
||||
bool runState = Context.get_run_state ();
|
||||
|
||||
Context.set_paragraph_state (false);
|
||||
Context.set_run_state (false);
|
||||
Context.reset_context_state();
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
@ -1369,8 +1354,8 @@ void draw_g::docx_convert(oox::docx_conversion_context & Context)
|
||||
drawing.content_group_ = temp_stream.str();
|
||||
|
||||
Context.set_stream_man (prev);
|
||||
Context.set_run_state (runState);
|
||||
Context.set_paragraph_state (pState);
|
||||
Context.back_context_state();
|
||||
|
||||
//--------------------------------------------------
|
||||
Context.get_drawing_context().get_size_group (drawing.cx , drawing.cy);
|
||||
Context.get_drawing_context().get_position_group(drawing.x , drawing.y);
|
||||
@ -1403,8 +1388,8 @@ void draw_g::docx_convert(oox::docx_conversion_context & Context)
|
||||
//--------------------------------------------------
|
||||
std::wostream & strm = Context.output_stream();
|
||||
|
||||
runState = Context.get_run_state();
|
||||
pState = Context.get_paragraph_state();
|
||||
bool runState = Context.get_run_state();
|
||||
bool pState = Context.get_paragraph_state();
|
||||
|
||||
if (!Context.get_drawing_context().in_group() && !pState)
|
||||
{
|
||||
@ -1465,10 +1450,8 @@ void draw_frame::docx_convert(oox::docx_conversion_context & Context)
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
bool runState = Context.get_run_state();
|
||||
bool paraState = Context.get_paragraph_state();
|
||||
bool keepState = Context.get_paragraph_keep();
|
||||
|
||||
Context.set_run_state (false);
|
||||
Context.set_paragraph_state (false);
|
||||
Context.reset_context_state();
|
||||
|
||||
if (!Context.get_drawing_context().in_group() && !runState)
|
||||
{
|
||||
@ -1490,9 +1473,7 @@ void draw_frame::docx_convert(oox::docx_conversion_context & Context)
|
||||
}
|
||||
}
|
||||
|
||||
Context.set_run_state (runState);
|
||||
Context.set_paragraph_state (paraState);
|
||||
Context.set_paragraph_keep (keepState);
|
||||
Context.back_context_state();
|
||||
|
||||
Context.get_drawing_context().stop_frame();
|
||||
}
|
||||
@ -1696,12 +1677,7 @@ void draw_control::docx_convert(oox::docx_conversion_context & Context)
|
||||
std::wstringstream temp_stream(Context.get_drawing_context().get_text_stream_shape());
|
||||
Context.set_stream_man( boost::shared_ptr<oox::streams_man>( new oox::streams_man(temp_stream) ));
|
||||
|
||||
bool pState = Context.get_paragraph_state ();
|
||||
bool runState = Context.get_run_state ();
|
||||
bool keepState = Context.get_paragraph_keep ();
|
||||
|
||||
Context.set_run_state (false);
|
||||
Context.set_paragraph_state (false);
|
||||
Context.reset_context_state();
|
||||
|
||||
bool drState = Context.get_drawing_state_content();
|
||||
|
||||
@ -1739,10 +1715,9 @@ void draw_control::docx_convert(oox::docx_conversion_context & Context)
|
||||
Context.get_drawing_context().get_text_stream_shape() = temp_stream.str();
|
||||
Context.set_stream_man(prev);
|
||||
|
||||
Context.set_run_state (runState);
|
||||
Context.set_paragraph_state (pState);
|
||||
Context.set_drawing_state_content (drState);
|
||||
Context.set_paragraph_keep (keepState);
|
||||
|
||||
Context.back_context_state();
|
||||
|
||||
const std::wstring & content = Context.get_drawing_context().get_text_stream_shape();
|
||||
|
||||
@ -1762,9 +1737,9 @@ void draw_control::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
std::wostream & strm = Context.output_stream();
|
||||
|
||||
pState = Context.get_paragraph_state();
|
||||
runState = Context.get_run_state();
|
||||
keepState = Context.get_paragraph_keep();
|
||||
bool pState = Context.get_paragraph_state();
|
||||
bool runState = Context.get_run_state();
|
||||
bool keepState = Context.get_paragraph_keep();
|
||||
|
||||
//Context.set_run_state (false);
|
||||
Context.set_paragraph_state (false);
|
||||
|
||||
@ -89,11 +89,7 @@ void draw_shape::common_docx_convert(oox::docx_conversion_context & Context)
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
}
|
||||
|
||||
bool pParaState = Context.get_paragraph_state();
|
||||
bool pRunState = Context.get_run_state();
|
||||
Context.set_paragraph_state (false);
|
||||
Context.set_run_state (false);
|
||||
Context.reset_context_state();
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
@ -105,8 +101,7 @@ void draw_shape::common_docx_convert(oox::docx_conversion_context & Context)
|
||||
}
|
||||
}
|
||||
|
||||
Context.set_paragraph_state(pParaState);
|
||||
Context.set_run_state(pRunState);
|
||||
Context.back_context_state();
|
||||
|
||||
Context.get_drawing_context().get_text_stream_shape() = temp_stream.str();
|
||||
Context.set_stream_man(prev);
|
||||
|
||||
@ -200,7 +200,11 @@ odf_document::Impl::Impl(const std::wstring & srcPath, const std::wstring & temp
|
||||
|
||||
if (false == map_encryptions_.empty())
|
||||
{
|
||||
if (password.empty()) return;
|
||||
if (password.empty())
|
||||
{
|
||||
bError = true;
|
||||
return;
|
||||
}
|
||||
|
||||
//decrypt files
|
||||
tmp_folder_ = NSDirectory::CreateDirectoryWithUniqueName(tempPath);
|
||||
@ -286,17 +290,22 @@ bool odf_document::Impl::decrypt_folder (const std::wstring &password, const std
|
||||
bool result = true;
|
||||
for (size_t i = 0; i < arFiles.size(); ++i)
|
||||
{
|
||||
result = false;
|
||||
std::wstring sFileName = NSFile::GetFileName(arFiles[i]);
|
||||
|
||||
std::map<std::wstring, std::pair<office_element_ptr, int>>::iterator pFind = map_encryptions_.find(arFiles[i]);
|
||||
if ( pFind != map_encryptions_.end() )
|
||||
std::map<std::wstring, std::pair<office_element_ptr, int>>::iterator pFind;
|
||||
if (false == map_encryptions_.empty())
|
||||
{
|
||||
result = decrypt_file(password, arFiles[i], dstPath + FILE_SEPARATOR_STR + sFileName, pFind->second.first, pFind->second.second);
|
||||
|
||||
if (false == result)
|
||||
break;
|
||||
pFind = map_encryptions_.find(arFiles[i]);
|
||||
if ( pFind != map_encryptions_.end() )
|
||||
{
|
||||
result = decrypt_file(password, arFiles[i], dstPath + FILE_SEPARATOR_STR + sFileName, pFind->second.first, pFind->second.second);
|
||||
|
||||
if (false == result)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!result && false == map_encryptions_extra_.empty())
|
||||
{
|
||||
pFind = map_encryptions_extra_.find(arFiles[i]);
|
||||
if ( pFind != map_encryptions_.end() )
|
||||
@ -306,10 +315,11 @@ bool odf_document::Impl::decrypt_folder (const std::wstring &password, const std
|
||||
if (false == result)
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSFile::CFileBinary::Copy(arFiles[i], dstPath + FILE_SEPARATOR_STR + sFileName);
|
||||
}
|
||||
}
|
||||
if (!result)
|
||||
{
|
||||
NSFile::CFileBinary::Copy(arFiles[i], dstPath + FILE_SEPARATOR_STR + sFileName);
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
for (size_t i = 0; result && i < arDirectories.size(); ++i)
|
||||
|
||||
@ -443,8 +443,9 @@ void form_combobox::docx_convert_sdt(oox::docx_conversion_context & Context, dra
|
||||
form_item* item = dynamic_cast<form_item*>(items_[i].get());
|
||||
if (!item) continue;
|
||||
|
||||
Context.output_stream() << L"<w:listItem w:displayText=\"" << (item->text_.empty() ? item->label_ : item->text_);
|
||||
Context.output_stream() << L"\" w:value=\"" << item->label_ << L"\"/>";
|
||||
std::wstring displayText = item->text_.empty() ? item->label_ : item->text_;
|
||||
Context.output_stream() << L"<w:listItem w:displayText=\"" << XmlUtils::EncodeXmlString(displayText);
|
||||
Context.output_stream() << L"\" w:value=\"" << XmlUtils::EncodeXmlString(item->label_) << L"\"/>";
|
||||
}
|
||||
|
||||
Context.output_stream() << L"</w:dropDownList>";
|
||||
@ -458,6 +459,10 @@ void form_combobox::docx_convert_sdt(oox::docx_conversion_context & Context, dra
|
||||
{
|
||||
Context.output_stream() << xml::utils::replace_text_to_xml(*current_value_ );
|
||||
}
|
||||
else
|
||||
{
|
||||
Context.output_stream() << L"Select item";
|
||||
}
|
||||
Context.output_stream() << L"</w:t>";
|
||||
Context.finish_run();
|
||||
}
|
||||
|
||||
@ -174,7 +174,7 @@ void text::docx_convert(oox::docx_conversion_context & Context)
|
||||
Context.output_stream() << L" xml:space=\"preserve\"";
|
||||
Context.output_stream() << L">";
|
||||
|
||||
Context.output_stream() << xml::utils::replace_text_to_xml( text_, true );
|
||||
Context.output_stream() << xml::utils::replace_text_to_xml( text_, true );//0xf4 0x80 0x80 0x81-??? - Gangs_Aff-Neg.odt
|
||||
Context.output_stream() << L"</" << textNode << L">";
|
||||
|
||||
if (add_del_run)
|
||||
@ -2059,6 +2059,10 @@ void field_fieldmark_start::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
Context.start_field(field_type_->substr(29), *text_name_);
|
||||
}
|
||||
else
|
||||
{
|
||||
Context.start_field(*field_type_, *text_name_);
|
||||
}
|
||||
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@ -165,162 +165,61 @@ void style_background_image::add_text(const std::wstring & Text)
|
||||
|
||||
void paragraph_format_properties::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
// 15.5.1
|
||||
CP_APPLY_ATTR(L"fo:line-height", fo_line_height_);
|
||||
|
||||
// 15.5.2
|
||||
CP_APPLY_ATTR(L"style:line-height-at-least", style_line_height_at_least_);
|
||||
|
||||
// 15.5.3
|
||||
CP_APPLY_ATTR(L"style:line-spacing", style_line_spacing_);
|
||||
|
||||
// 15.5.4
|
||||
CP_APPLY_ATTR(L"style:font-independent-line-spacing", style_font_independent_line_spacing_);
|
||||
|
||||
// 15.5.5
|
||||
CP_APPLY_ATTR(L"fo:text-align", fo_text_align_);
|
||||
|
||||
// 15.5.6
|
||||
CP_APPLY_ATTR(L"fo:text-align-last", fo_text_align_last_);
|
||||
|
||||
// 15.5.7
|
||||
CP_APPLY_ATTR(L"style:justify-single-word", style_justify_single_word_);
|
||||
|
||||
// 15.5.8
|
||||
CP_APPLY_ATTR(L"fo:keep-together", fo_keep_together_);
|
||||
|
||||
// 15.5.9
|
||||
CP_APPLY_ATTR(L"fo:widows", fo_widows_);
|
||||
|
||||
// 15.5.10
|
||||
CP_APPLY_ATTR(L"fo:orphans", fo_orphans_);
|
||||
|
||||
// 15.5.11 - Element
|
||||
|
||||
// 15.5.12
|
||||
CP_APPLY_ATTR(L"style:tab-stop-distance", style_tab_stop_distance_);
|
||||
|
||||
// 15.5.13
|
||||
CP_APPLY_ATTR(L"fo:hyphenation-keep", fo_hyphenation_keep_);
|
||||
|
||||
// 15.5.14
|
||||
CP_APPLY_ATTR(L"fo:hyphenation-ladder-count", fo_hyphenation_ladder_count_);
|
||||
|
||||
// 15.5.15 - Element
|
||||
|
||||
// 15.5.16
|
||||
CP_APPLY_ATTR(L"style:register-true", style_register_true_);
|
||||
|
||||
// 15.5.17
|
||||
CP_APPLY_ATTR(L"fo:margin-left", fo_margin_left_);
|
||||
|
||||
//
|
||||
CP_APPLY_ATTR(L"fo:margin-right", fo_margin_right_);
|
||||
|
||||
// 15.5.18
|
||||
CP_APPLY_ATTR(L"fo:text-indent", fo_text_indent_);
|
||||
|
||||
// 15.5.19
|
||||
CP_APPLY_ATTR(L"style:auto-text-indent", style_auto_text_indent_);
|
||||
|
||||
// 15.5.20
|
||||
CP_APPLY_ATTR(L"fo:margin-top", fo_margin_top_);
|
||||
|
||||
//
|
||||
CP_APPLY_ATTR(L"fo:margin-bottom", fo_margin_bottom_);
|
||||
|
||||
// 15.5.21
|
||||
CP_APPLY_ATTR(L"fo:margin", fo_margin_);
|
||||
|
||||
// 15.5.22
|
||||
CP_APPLY_ATTR(L"fo:break-before", fo_break_before_);
|
||||
|
||||
//
|
||||
CP_APPLY_ATTR(L"fo:break-after", fo_break_after_);
|
||||
|
||||
// 15.5.23
|
||||
CP_APPLY_ATTR(L"fo:background-color", fo_background_color_);
|
||||
|
||||
// 15.5.24 - Element
|
||||
|
||||
// 15.5.25
|
||||
CP_APPLY_ATTR(L"fo:border", fo_border_);
|
||||
|
||||
//
|
||||
CP_APPLY_ATTR(L"fo:border", fo_border_);
|
||||
CP_APPLY_ATTR(L"fo:border-top", fo_border_top_);
|
||||
|
||||
//
|
||||
CP_APPLY_ATTR(L"fo:border-bottom", fo_border_bottom_);
|
||||
|
||||
//
|
||||
CP_APPLY_ATTR(L"fo:border-left", fo_border_left_);
|
||||
|
||||
//
|
||||
CP_APPLY_ATTR(L"fo:border-right", fo_border_right_);
|
||||
|
||||
// 15.5.26
|
||||
//
|
||||
CP_APPLY_ATTR(L"style:border-line-width", style_border_line_width_);
|
||||
|
||||
//
|
||||
CP_APPLY_ATTR(L"style:border-line-width-top", style_border_line_width_top_);
|
||||
//
|
||||
CP_APPLY_ATTR(L"style:border-line-width-bottom", style_border_line_width_bottom_);
|
||||
//
|
||||
CP_APPLY_ATTR(L"style:border-line-width-left", style_border_line_width_left_);
|
||||
//
|
||||
CP_APPLY_ATTR(L"style:border-line-width-right", style_border_line_width_right_);
|
||||
|
||||
// 15.5.27
|
||||
//
|
||||
CP_APPLY_ATTR(L"fo:padding", fo_padding_);
|
||||
|
||||
//
|
||||
CP_APPLY_ATTR(L"fo:padding-top", fo_padding_top_);
|
||||
|
||||
//
|
||||
CP_APPLY_ATTR(L"fo:padding-bottom", fo_padding_bottom_);
|
||||
|
||||
//
|
||||
CP_APPLY_ATTR(L"fo:padding-left", fo_padding_left_);
|
||||
|
||||
//
|
||||
CP_APPLY_ATTR(L"fo:padding-right", fo_padding_right_);
|
||||
|
||||
// 15.5.28
|
||||
CP_APPLY_ATTR(L"style:shadow", style_shadow_);
|
||||
|
||||
// 15.5.29
|
||||
CP_APPLY_ATTR(L"fo:keep-with-next", fo_keep_with_next_);
|
||||
|
||||
// 15.5.30
|
||||
CP_APPLY_ATTR(L"text:number-lines", text_number_lines_);
|
||||
|
||||
// 15.5.31
|
||||
CP_APPLY_ATTR(L"text:line-number", text_line_number_);
|
||||
|
||||
// 15.5.32
|
||||
CP_APPLY_ATTR(L"style:text-autospace", style_text_autospace_);
|
||||
|
||||
// 15.5.33
|
||||
CP_APPLY_ATTR(L"style:punctuation-wrap", style_punctuation_wrap_);
|
||||
|
||||
// 15.5.34
|
||||
CP_APPLY_ATTR(L"style:line-break", style_line_break_);
|
||||
|
||||
// 15.5.35
|
||||
CP_APPLY_ATTR(L"style:vertical-align", style_vertical_align_);
|
||||
|
||||
// 15.5.36
|
||||
CP_APPLY_ATTR(L"style:writing-mode", style_writing_mode_);
|
||||
|
||||
// 15.5.37
|
||||
CP_APPLY_ATTR(L"style:writing-mode-automatic", style_writing_mode_automatic_);
|
||||
|
||||
// 15.5.38
|
||||
CP_APPLY_ATTR(L"style:snap-to-layout-grid", style_snap_to_layout_grid_);
|
||||
|
||||
// 15.5.39
|
||||
_CP_OPT(std::wstring) style_page_number_str_;
|
||||
CP_APPLY_ATTR(L"style:page-number", style_page_number_str_);
|
||||
|
||||
@ -331,7 +230,6 @@ void paragraph_format_properties::add_attributes( const xml::attributes_wc_ptr &
|
||||
style_page_number_= boost::lexical_cast<int>(style_page_number_str_.get());
|
||||
}
|
||||
|
||||
// 15.5.40
|
||||
CP_APPLY_ATTR(L"style:background-transparency", style_background_transparency_);
|
||||
|
||||
CP_APPLY_ATTR(L"style:join_border", style_join_border_);
|
||||
@ -391,6 +289,8 @@ void style_paragraph_properties::add_text(const std::wstring & Text)
|
||||
|
||||
void paragraph_format_properties::apply_from(const paragraph_format_properties & Other)
|
||||
{
|
||||
_CP_APPLY_PROP(outline_level_, Other.outline_level_);
|
||||
|
||||
apply_line_width(fo_line_height_, Other.fo_line_height_);
|
||||
_CP_APPLY_PROP(style_line_height_at_least_, Other.style_line_height_at_least_);
|
||||
_CP_APPLY_PROP(style_line_spacing_, Other.style_line_spacing_);
|
||||
|
||||
@ -211,6 +211,8 @@ public:
|
||||
|
||||
void xlsx_convert(std::wostream & strm, bool in_draw);
|
||||
|
||||
_CP_OPT(unsigned int) outline_level_;
|
||||
|
||||
_CP_OPT(odf_types::line_width) fo_line_height_;
|
||||
_CP_OPT(odf_types::length) style_line_height_at_least_;
|
||||
_CP_OPT(odf_types::length) style_line_spacing_;
|
||||
|
||||
@ -381,6 +381,7 @@ bool table_table_cell::empty()
|
||||
{
|
||||
if (!content_.elements_.empty()) return false;
|
||||
if (attlist_.table_formula_) return false;
|
||||
if (attlist_.table_style_name_) return false;
|
||||
|
||||
if (attlist_extra_.table_number_columns_spanned_ > 1) return false;
|
||||
if (attlist_extra_.table_number_rows_spanned_ > 1) return false;
|
||||
|
||||
@ -445,7 +445,7 @@ void h::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
|
||||
paragraph_.add_attributes(Attributes);
|
||||
|
||||
paragraph_.is_header_ = true;
|
||||
paragraph_.is_header_ = true;
|
||||
paragraph_.attrs_.outline_level_ = outline_level_;
|
||||
}
|
||||
|
||||
@ -960,9 +960,9 @@ void common_entry_template::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
Context.get_table_content_context().start_level(*style_name_);
|
||||
|
||||
if (outline_level_)
|
||||
if (outline_level_ && style_name_)
|
||||
{
|
||||
Context.get_table_content_context().add_outline_level_style(*outline_level_, style_name_.get_value_or(L""));
|
||||
Context.get_table_content_context().add_outline_level_style(*style_name_, *outline_level_);
|
||||
}
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
|
||||
@ -376,6 +376,10 @@
|
||||
RelativePath="..\..\XlsxSerializerCom\Writer\CSVWriter.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ASCOfficeDocxFile2\BinReader\CustormXmlWriter.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\DocxSerializer.cpp"
|
||||
>
|
||||
|
||||
@ -70,7 +70,7 @@ static const _sh_typ Shape_Types_Mapping[] = // index === OOX::Drawing::EShapeTy
|
||||
{ L"mso-spt50" , 7}, // shapetypeBorderCallout2,
|
||||
{ L"mso-spt51" , 7}, // shapetypeBorderCallout3,
|
||||
{ L"brace-pair" , 7}, // shapetypeBracePair,
|
||||
{ L"bracket-pair" , 7}, // shapetypeBracketPair,
|
||||
{ L"" , 7}, // shapetypeBracketPair,
|
||||
{ L"mso-spt41" , 7}, // shapetypeCallout1,
|
||||
{ L"mso-spt42" , 7}, // shapetypeCallout2,
|
||||
{ L"mso-spt43" , 7}, // shapetypeCallout3,
|
||||
@ -156,7 +156,7 @@ static const _sh_typ Shape_Types_Mapping[] = // index === OOX::Drawing::EShapeTy
|
||||
{ L"left-right-arrow-callout" , 7}, // shapetypeLeftRightArrowCallout,
|
||||
{ L"" , 7}, // shapetypeLeftRightCircularArrow,
|
||||
{ L"" , 7}, // shapetypeLeftRightRibbon,
|
||||
{ L"mso-spt182" , 7}, // shapetypeLeftRightUpArrow,
|
||||
{ L"" , 7}, // shapetypeLeftRightUpArrow,
|
||||
{ L"" , 7}, // shapetypeLeftUpArrow,
|
||||
{ L"lightning" , 7}, // shapetypeLightningBolt,
|
||||
{ L"" , 5}, // shapetypeLine,
|
||||
|
||||
@ -893,6 +893,61 @@ public:
|
||||
handles.push_back(h2);
|
||||
}
|
||||
};
|
||||
class oox_shape_leftRightUpArrow : public oox_shape
|
||||
{
|
||||
public:
|
||||
oox_shape_leftRightUpArrow()
|
||||
{
|
||||
odf_type_name = L"ooxml-leftRightUpArrow";
|
||||
|
||||
enhanced_path = L"M 0 ?f18 L ?f7 ?f17 ?f7 ?f19 ?f13 ?f19 ?f13 ?f7 ?f10 ?f7 ?f9 0 ?f11 ?f7 ?f14 ?f7 ?f14 ?f19 ?f15 ?f19 ?f15 ?f17 ?f23 ?f18 ?f15 ?f24 ?f15 ?f20 ?f7 ?f20 ?f7 ?f24 Z N";
|
||||
text_areas = L"?f21 ?f19 ?f22 ?f20";
|
||||
modifiers = L"9928 10359 14667";
|
||||
view_box = L"0 0 0 0";
|
||||
|
||||
add(L"f0", L"if(0-$1 ,0,if(50000-$1 ,$1 ,50000))");
|
||||
add(L"f1", L"?f0 *2/1");
|
||||
add(L"f2", L"if(0-$0 ,0,if(?f1 -$0 ,$0 ,?f1 ))");
|
||||
add(L"f3", L"100000+0-?f1 ");
|
||||
add(L"f4", L"?f3 *1/2");
|
||||
add(L"f5", L"if(0-$2 ,0,if(?f4 -$2 ,$2 ,?f4 ))");
|
||||
add(L"f6", L"min(logwidth,logheight)");
|
||||
add(L"f7", L"?f6 *?f5 /100000");
|
||||
add(L"f8", L"?f6 *?f0 /100000");
|
||||
add(L"f9", L"logwidth/2");
|
||||
add(L"f10", L"?f9 +0-?f8 ");
|
||||
add(L"f11", L"?f9 +?f8 -0");
|
||||
add(L"f12", L"?f6 *?f2 /200000");
|
||||
add(L"f13", L"?f9 +0-?f12 ");
|
||||
add(L"f14", L"?f9 +?f12 -0");
|
||||
add(L"f15", L"logwidth+0-?f7 ");
|
||||
add(L"f16", L"?f6 *?f0 /50000");
|
||||
add(L"f17", L"logheight+0-?f16 ");
|
||||
add(L"f18", L"logheight+0-?f8 ");
|
||||
add(L"f19", L"?f18 +0-?f12 ");
|
||||
add(L"f20", L"?f18 +?f12 -0");
|
||||
add(L"f21", L"?f12 *?f7 /?f8 ");
|
||||
add(L"f22", L"logwidth+0-?f21 ");
|
||||
add(L"f23", L"logwidth");
|
||||
add(L"f24", L"logheight");
|
||||
/////////////////////////////////////////////////////////
|
||||
_handle h1, h2, h3;
|
||||
h1.position = L"?f13 ?f7";
|
||||
h1.x_minimum = L"0";
|
||||
h1.x_maximum = L"?f1";
|
||||
handles.push_back(h1);
|
||||
|
||||
h2.position = L"?f10 0";
|
||||
h2.x_minimum = L"0";
|
||||
h2.x_maximum = L"50000";
|
||||
handles.push_back(h2);
|
||||
|
||||
h3.position = L"?f23 ?f7";
|
||||
h3.y_minimum = L"0";
|
||||
h3.y_maximum = L"?f4";
|
||||
handles.push_back(h3);
|
||||
}
|
||||
};
|
||||
class oox_shape_NotchedRightArrow : public oox_shape
|
||||
{
|
||||
public:
|
||||
|
||||
@ -273,6 +273,65 @@ public:
|
||||
/////////////////////////////////////////////////////////
|
||||
}
|
||||
};
|
||||
class oox_shape_Wave : public oox_shape
|
||||
{
|
||||
public:
|
||||
oox_shape_Wave()
|
||||
{
|
||||
odf_type_name =L"ooxml-wave";
|
||||
|
||||
modifiers = L"12500 0";
|
||||
enhanced_path = L"M ?f13 ?f2 C ?f17 ?f4 ?f18 ?f5 ?f15 ?f2 L ?f20 ?f6 C ?f22 ?f8 ?f21 ?f7 ?f19 ?f6 Z N";
|
||||
text_areas = L"?f27 ?f29 ?f28 ?f30";
|
||||
glue_points = L"?f35 ?f10 ?f19 ?f6 ?f28 ?f14 ?f38 ?f6";
|
||||
view_box = L"0 0 0 0";
|
||||
|
||||
add(L"f0", L"if(0-$0 ,0,if(20000-$0 ,$0 ,20000))");
|
||||
add(L"f1", L"if(-10000-$1 ,-10000,if(10000-$1 ,$1 ,10000))");
|
||||
add(L"f2", L"logheight*?f0 /100000");
|
||||
add(L"f3", L"?f2 *10/3");
|
||||
add(L"f4", L"?f2 +0-?f3 ");
|
||||
add(L"f5", L"?f2 +?f3 -0");
|
||||
add(L"f6", L"logheight+0-?f2 ");
|
||||
add(L"f7", L"?f6 +0-?f3 ");
|
||||
add(L"f8", L"?f6 +?f3 -0");
|
||||
add(L"f9", L"logwidth*?f1 /100000");
|
||||
add(L"f10", L"logwidth*?f1 /50000");
|
||||
add(L"f11", L"abs(?f9 )");
|
||||
add(L"f12", L"if(?f10 ,0,?f10 )");
|
||||
add(L"f13", L"0+0-?f12 ");
|
||||
add(L"f14", L"if(?f10 ,?f10 ,0)");
|
||||
add(L"f15", L"logwidth+0-?f14 ");
|
||||
add(L"f16", L"(?f12 +?f15 )/3");
|
||||
add(L"f17", L"?f13 +?f16 -0");
|
||||
add(L"f18", L"(?f17 +?f15 )/2");
|
||||
add(L"f19", L"0+?f14 -0");
|
||||
add(L"f20", L"logwidth+?f12 -0");
|
||||
add(L"f21", L"?f19 +?f16 -0");
|
||||
add(L"f22", L"(?f21 +?f20 )/2");
|
||||
add(L"f23", L"logwidth+0-?f11");
|
||||
add(L"f24", L"logwidth/2");
|
||||
add(L"f25", L"?f24 +?f9 -0");
|
||||
add(L"f26", L"?f24 +0-?f9 ");
|
||||
add(L"f27", L"max(?f13 ,?f19 )");
|
||||
add(L"f28", L"min(?f15 ,?f20 )");
|
||||
add(L"f29", L"logheight*?f0 /50000");
|
||||
add(L"f30", L"logheight+0-?f29 ");
|
||||
add(L"f31", L"logheight");
|
||||
add(L"f32", L"logheight/2");
|
||||
/////////////////////////////////////////////////////////
|
||||
_handle h1, h2;
|
||||
h1.position = L"0 ?f2";
|
||||
h1.y_maximum= L"20000";
|
||||
h1.y_minimum= L"0";
|
||||
handles.push_back(h1);
|
||||
|
||||
h2.position = L"?f25 ?f31";
|
||||
h2.x_maximum= L"10000";
|
||||
h2.x_minimum= L"-10000";
|
||||
handles.push_back(h2);
|
||||
}
|
||||
};
|
||||
class oox_shape_DoubleWave : public oox_shape
|
||||
{
|
||||
public:
|
||||
@ -995,8 +1054,6 @@ public:
|
||||
handles.push_back(h2);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class oox_shape_Chord : public oox_shape
|
||||
{
|
||||
public:
|
||||
@ -1482,4 +1539,55 @@ public:
|
||||
h.x_maximum = L"50000";
|
||||
handles.push_back(h);
|
||||
}
|
||||
};}
|
||||
};
|
||||
class oox_shape_bracketPair : public oox_shape
|
||||
{
|
||||
public:
|
||||
oox_shape_bracketPair()
|
||||
{
|
||||
odf_type_name =L"ooxml-bracketPair";
|
||||
|
||||
//enhanced_path = L"M 0 ?f2 L ?f3 0 L ?f11 ?f4 L ?f2 ?f10 Z S N M ?f2 ?f10 L 0 ?f2 M ?f3 0 L ?f11 ?f4 F N";
|
||||
enhanced_path = L"M 0 ?f2 G ?f2 ?f2 ?f12 ?f13 L ?f3 0 G ?f2 ?f2 ?f14 ?f15 L ?f11 ?f4 G ?f2 ?f2 ?f16 ?f17 L ?f2 ?f10 G ?f2 ?f2 ?f18 ?f19 Z S N M ?f2 ?f10 G ?f2 ?f2 ?f20 ?f21 L 0 ?f2 G ?f2 ?f2 ?f22 ?f23 M ?f3 0 G ?f2 ?f2 ?f24 ?f25 L ?f11 ?f4 G ?f2 ?f2 ?f26 ?f27 F N";
|
||||
text_areas = L"?f5 ?f5 ?f6 ?f7";
|
||||
view_box = L"0 0 0 0";
|
||||
modifiers = L"23051";
|
||||
|
||||
add(L"f0", L"if(0-$0 ,0,if(50000-$0 ,$0 ,50000))");
|
||||
add(L"f1", L"min(logwidth,logheight)");
|
||||
add(L"f2", L"?f1 *?f0 /100000");
|
||||
add(L"f3", L"logwidth+0-?f2 ");
|
||||
add(L"f4", L"logheight+0-?f2 ");
|
||||
add(L"f5", L"?f2 *29289/100000");
|
||||
add(L"f6", L"logwidth+0-?f5 ");
|
||||
add(L"f7", L"logheight+0-?f5 ");
|
||||
add(L"f8", L"logwidth/2");
|
||||
add(L"f9", L"logheight/2");
|
||||
add(L"f10", L"logheight");
|
||||
add(L"f11", L"logwidth");
|
||||
add(L"f12", L"(10800000)/60000.0");
|
||||
add(L"f13", L"(5400000)/60000.0");
|
||||
add(L"f14", L"(16200000)/60000.0");
|
||||
add(L"f15", L"(5400000)/60000.0");
|
||||
add(L"f16", L"(0)/60000.0");
|
||||
add(L"f17", L"(5400000)/60000.0");
|
||||
add(L"f18", L"(5400000)/60000.0");
|
||||
add(L"f19", L"(5400000)/60000.0");
|
||||
add(L"f20", L"(5400000)/60000.0");
|
||||
add(L"f21", L"(5400000)/60000.0");
|
||||
add(L"f22", L"(10800000)/60000.0");
|
||||
add(L"f23", L"(5400000)/60000.0");
|
||||
add(L"f24", L"(16200000)/60000.0");
|
||||
add(L"f25", L"(5400000)/60000.0");
|
||||
add(L"f26", L"(0)/60000.0");
|
||||
add(L"f27", L"(5400000)/60000.0");
|
||||
/////////////////////////////////////////////////////////
|
||||
_handle h1;
|
||||
|
||||
h1.position = L"0 ?f2";
|
||||
h1.y_minimum = L"0";
|
||||
h1.y_maximum = L"50000";
|
||||
handles.push_back(h1);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -38,6 +38,7 @@
|
||||
|
||||
#include "../../../DesktopEditor/common/File.h"
|
||||
#include "../../../DesktopEditor/common/Directory.h"
|
||||
#include "../../../DesktopEditor/common/SystemUtils.h"
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
|
||||
#include "../../../Common/3dParty/cryptopp/osrng.h"
|
||||
@ -194,7 +195,10 @@ namespace odf_writer
|
||||
{
|
||||
CP_XML_NODE(L"meta:generator")
|
||||
{
|
||||
CP_XML_STREAM() << L"ONLYOFFICE";
|
||||
std::wstring sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvApplicationName);
|
||||
if (sApplication.empty())
|
||||
sApplication = NSSystemUtils::gc_EnvApplicationNameDefault;
|
||||
CP_XML_STREAM() << sApplication;
|
||||
#if defined(INTVER)
|
||||
std::string s = VALUE2STR(INTVER);
|
||||
CP_XML_STREAM() << L"/" << std::wstring (s.begin(), s.end() );
|
||||
|
||||
@ -801,43 +801,88 @@ bool odf_drawing_context::change_text_box_2_wordart()
|
||||
if (impl_->current_drawing_state_.elements_.empty()) return false;
|
||||
|
||||
draw_text_box* t = dynamic_cast<draw_text_box*>(impl_->current_drawing_state_.elements_.back().elm.get());
|
||||
if (!t) return false;
|
||||
//------------------------------------------------------------------------
|
||||
office_element_ptr draw_elm = impl_->create_draw_element(7);
|
||||
|
||||
draw_base* draw = dynamic_cast<draw_base*>(draw_elm.get());
|
||||
if (draw == NULL) return false;
|
||||
|
||||
size_t sz = impl_->current_level_.size();
|
||||
if (sz < 2) return false;
|
||||
|
||||
size_t sz_state = impl_->current_drawing_state_.elements_.size();
|
||||
if (sz_state < 2) return false;
|
||||
|
||||
if (sz > 2) //в группе ??
|
||||
if (t)
|
||||
{
|
||||
draw_base* draw_old = dynamic_cast<draw_base*>(impl_->current_level_[sz-2].get());
|
||||
if (draw_old)
|
||||
//------------------------------------------------------------------------
|
||||
office_element_ptr draw_elm = impl_->create_draw_element(7);
|
||||
|
||||
draw_base* draw = dynamic_cast<draw_base*>(draw_elm.get());
|
||||
if (draw == NULL) return false;
|
||||
|
||||
size_t sz = impl_->current_level_.size();
|
||||
if (sz < 2) return false;
|
||||
|
||||
size_t sz_state = impl_->current_drawing_state_.elements_.size();
|
||||
if (sz_state < 2) return false;
|
||||
|
||||
if (sz > 2) //в группе ??
|
||||
{
|
||||
draw_old->content_[draw_old->content_.size() - 1] = draw_elm;
|
||||
draw_base* draw_old = dynamic_cast<draw_base*>(impl_->current_level_[sz-2].get());
|
||||
if (draw_old)
|
||||
{
|
||||
draw_old->content_[draw_old->content_.size() - 1] = draw_elm;
|
||||
}
|
||||
}
|
||||
//----------------------------------------------
|
||||
|
||||
odf_element_state state = impl_->current_drawing_state_.elements_[sz_state - 2];
|
||||
state.elm = draw_elm;
|
||||
|
||||
draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_style_name_ = state.style_name;
|
||||
|
||||
impl_->current_level_.erase (impl_->current_level_.end() - 2, impl_->current_level_.end());
|
||||
impl_->current_level_.push_back(draw_elm);
|
||||
|
||||
impl_->current_drawing_state_.elements_.erase(impl_->current_drawing_state_.elements_.end() - 2, impl_->current_drawing_state_.elements_.end());
|
||||
impl_->current_drawing_state_.elements_.push_back( state);
|
||||
|
||||
impl_->current_drawing_state_.oox_shape_preset_ = 2031;//plain text
|
||||
|
||||
if (sz == 2) impl_->root_element_ = draw_elm;
|
||||
return true;
|
||||
}
|
||||
//----------------------------------------------
|
||||
draw_base* s = dynamic_cast<draw_base*>(impl_->current_drawing_state_.elements_.back().elm.get());
|
||||
if (s)
|
||||
{
|
||||
//------------------------------------------------------------------------
|
||||
office_element_ptr draw_elm = impl_->create_draw_element(7);
|
||||
|
||||
draw_base* draw = dynamic_cast<draw_base*>(draw_elm.get());
|
||||
if (draw == NULL) return false;
|
||||
|
||||
odf_element_state state = impl_->current_drawing_state_.elements_[sz_state - 2];
|
||||
state.elm = draw_elm;
|
||||
size_t sz = impl_->current_level_.size();
|
||||
if (sz < 1) return false;
|
||||
|
||||
draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_style_name_ = state.style_name;
|
||||
size_t sz_state = impl_->current_drawing_state_.elements_.size();
|
||||
if (sz_state < 1) return false;
|
||||
|
||||
impl_->current_level_.erase (impl_->current_level_.end() - 2, impl_->current_level_.end());
|
||||
impl_->current_level_.push_back(draw_elm);
|
||||
if (sz > 1) //в группе ??
|
||||
{
|
||||
draw_base* draw_old = dynamic_cast<draw_base*>(impl_->current_level_[sz - 1].get());
|
||||
if (draw_old)
|
||||
{
|
||||
draw_old->content_[draw_old->content_.size() - 1] = draw_elm;
|
||||
}
|
||||
}
|
||||
//----------------------------------------------
|
||||
|
||||
impl_->current_drawing_state_.elements_.erase(impl_->current_drawing_state_.elements_.end() - 2, impl_->current_drawing_state_.elements_.end());
|
||||
impl_->current_drawing_state_.elements_.push_back( state);
|
||||
odf_element_state state = impl_->current_drawing_state_.elements_[sz_state - 1];
|
||||
state.elm = draw_elm;
|
||||
|
||||
impl_->current_drawing_state_.oox_shape_preset_ = 2031;//plain text
|
||||
draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_style_name_ = state.style_name;
|
||||
|
||||
impl_->current_level_.erase (impl_->current_level_.end() - 1, impl_->current_level_.end());
|
||||
impl_->current_level_.push_back(draw_elm);
|
||||
|
||||
impl_->current_drawing_state_.elements_.erase(impl_->current_drawing_state_.elements_.end() - 1, impl_->current_drawing_state_.elements_.end());
|
||||
impl_->current_drawing_state_.elements_.push_back( state);
|
||||
|
||||
impl_->current_drawing_state_.oox_shape_preset_ = 2031;//plain text
|
||||
|
||||
if (sz == 1) impl_->root_element_ = draw_elm;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sz == 2) impl_->root_element_ = draw_elm;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1055,6 +1100,7 @@ bool odf_drawing_context::isLineShape()
|
||||
case 48: //SimpleTypes::shapetypeCurvedConnector3:
|
||||
case 49: //SimpleTypes::shapetypeCurvedConnector4:
|
||||
case 50: //SimpleTypes::shapetypeCurvedConnector5:
|
||||
case 31: //SimpleTypes::shapetypeBracketPair
|
||||
return true;
|
||||
case 1000:
|
||||
if (impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_.get_value_or(draw_fill(draw_fill::solid)).get_type() == draw_fill::none)
|
||||
@ -1132,7 +1178,7 @@ void odf_drawing_context::end_element()
|
||||
impl_->current_level_.pop_back();
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void odf_drawing_context::start_area_properties()
|
||||
void odf_drawing_context::start_area_properties(bool reset)
|
||||
{
|
||||
impl_->current_drawing_part_ = Area;
|
||||
}
|
||||
@ -1140,9 +1186,11 @@ void odf_drawing_context::end_area_properties()
|
||||
{
|
||||
impl_->current_drawing_part_ = Unknown;
|
||||
}
|
||||
void odf_drawing_context::start_line_properties()
|
||||
void odf_drawing_context::start_line_properties(bool reset)
|
||||
{
|
||||
impl_->current_drawing_part_ = Line;
|
||||
if (reset)
|
||||
impl_->current_graphic_properties->draw_stroke_ = boost::none;
|
||||
}
|
||||
void odf_drawing_context::end_line_properties()
|
||||
{
|
||||
|
||||
@ -201,10 +201,10 @@ public:
|
||||
void set_opacity (double percent);
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
void start_area_properties();
|
||||
void start_area_properties(bool reset = false);
|
||||
void end_area_properties();
|
||||
|
||||
void start_line_properties ();
|
||||
void start_line_properties (bool reset = false);
|
||||
void set_line_width (double pt);
|
||||
void set_line_dash_preset (int style);
|
||||
|
||||
|
||||
@ -59,6 +59,10 @@ namespace odf_writer
|
||||
{
|
||||
std::vector<office_element_ptr> spanned_row_cell;
|
||||
};
|
||||
struct odf_row_state : odf_element_state
|
||||
{
|
||||
std::vector<office_element_ptr> spanned_column_cell;
|
||||
};
|
||||
struct odf_table_state
|
||||
{
|
||||
odf_table_state()
|
||||
@ -71,9 +75,9 @@ namespace odf_writer
|
||||
|
||||
table_width = 0;
|
||||
}
|
||||
std::vector<odf_element_state> rows;
|
||||
std::vector<odf_column_state> columns;
|
||||
std::vector<odf_element_state> cells;
|
||||
std::vector<odf_row_state> rows;
|
||||
std::vector<odf_column_state> columns;
|
||||
std::vector<odf_element_state> cells;
|
||||
|
||||
odf_element_state table;
|
||||
|
||||
@ -178,13 +182,17 @@ void odf_table_context::start_table(office_element_ptr &elm, bool styled)
|
||||
}
|
||||
void odf_table_context::end_table()
|
||||
{
|
||||
//последние объединенные по вертикали ячейки ..
|
||||
for (size_t i =0 ; i < impl_->current_table().columns.size(); i++)
|
||||
//последние объединенные ячейки ..
|
||||
for (size_t i = 0 ; i < impl_->current_table().columns.size(); i++)
|
||||
{
|
||||
impl_->current_table().current_column = i+1;
|
||||
impl_->current_table().current_column = i + 1;
|
||||
set_cell_row_span_restart();
|
||||
}
|
||||
|
||||
for (size_t i = 0 ; i < impl_->current_table().rows.size(); i++)
|
||||
{
|
||||
impl_->current_table().current_row = i + 1;
|
||||
set_cell_column_span_restart();
|
||||
}
|
||||
style * style_ = dynamic_cast<style *>(impl_->current_table().table.style_elm.get());
|
||||
if (style_)
|
||||
{
|
||||
@ -206,7 +214,7 @@ void odf_table_context::start_row(office_element_ptr &elm, bool styled)
|
||||
table_table_row * row = dynamic_cast<table_table_row *>(elm.get());
|
||||
if (!row)return;
|
||||
|
||||
odf_element_state state;
|
||||
odf_row_state state;
|
||||
|
||||
state.elm = elm;
|
||||
|
||||
@ -235,6 +243,8 @@ void odf_table_context::end_row()
|
||||
{
|
||||
if (impl_->empty()) return;
|
||||
|
||||
set_cell_column_span_restart();
|
||||
|
||||
//for (int i = impl_->current_table().current_column ; i< impl_->current_table().columns.size() ; i++)
|
||||
//{
|
||||
// office_element_ptr cell; //потом на default ???
|
||||
@ -480,29 +490,59 @@ void odf_table_context::start_cell(office_element_ptr &elm, bool styled)
|
||||
}
|
||||
}
|
||||
}
|
||||
//if (cell)
|
||||
//{
|
||||
// cell->table_table_cell_attlist_.common_value_and_type_attlist_ = common_value_and_type_attlist();
|
||||
// cell->table_table_cell_attlist_.common_value_and_type_attlist_->office_value_type_ = office_value_type(office_value_type::String);
|
||||
//}
|
||||
int row = impl_->current_table().current_row - 1;
|
||||
odf_row_state & state_row = impl_->current_table().rows[row];
|
||||
|
||||
if (cell && state_row.spanned_column_cell.size() > 1)
|
||||
{
|
||||
table_table_cell * cell = dynamic_cast<table_table_cell *>(state_row.spanned_column_cell[0].get());
|
||||
if (!cell)return;
|
||||
|
||||
cell->table_table_cell_attlist_extra_.table_number_columns_spanned_ = state_row.spanned_column_cell.size();
|
||||
state_row.spanned_column_cell.clear();
|
||||
}
|
||||
|
||||
impl_->current_table().cells.push_back(state);
|
||||
|
||||
impl_->current_table().current_column++;
|
||||
}
|
||||
void odf_table_context::set_cell_column_span_restart()
|
||||
{
|
||||
int row = impl_->current_table().current_row - 1;
|
||||
odf_row_state & state = impl_->current_table().rows[row];
|
||||
|
||||
int sz = state.spanned_column_cell.size();
|
||||
if (sz > 1)
|
||||
{
|
||||
table_table_cell * cell = dynamic_cast<table_table_cell *>(state.spanned_column_cell[0].get());
|
||||
if (!cell)return;
|
||||
|
||||
cell->table_table_cell_attlist_extra_.table_number_columns_spanned_ = sz;
|
||||
}
|
||||
state.spanned_column_cell.clear();
|
||||
}
|
||||
void odf_table_context::set_cell_column_span(int spanned)
|
||||
{
|
||||
if (impl_->empty()) return;
|
||||
if (impl_->current_table().cells.size() < 1)return;
|
||||
if (spanned < 1)return;
|
||||
|
||||
if (spanned > 0)
|
||||
{
|
||||
table_table_cell * cell = dynamic_cast<table_table_cell *>(impl_->current_table().cells.back().elm.get());
|
||||
if (cell)
|
||||
cell->table_table_cell_attlist_extra_.table_number_columns_spanned_ = spanned;
|
||||
}
|
||||
else
|
||||
{
|
||||
int row = impl_->current_table().current_row - 1;
|
||||
odf_row_state & state = impl_->current_table().rows[row];
|
||||
|
||||
table_table_cell * cell = dynamic_cast<table_table_cell *>(impl_->current_table().cells.back().elm.get());;
|
||||
if (!cell)return;
|
||||
|
||||
cell->table_table_cell_attlist_extra_.table_number_columns_spanned_ = spanned;
|
||||
|
||||
//impl_->current_table().current_column += spanned - 1;
|
||||
if (state.spanned_column_cell.empty() && impl_->current_table().cells.size() > 1 )
|
||||
{
|
||||
state.spanned_column_cell.push_back(impl_->current_table().cells[impl_->current_table().cells.size() - 2].elm);
|
||||
}
|
||||
state.spanned_column_cell.push_back(impl_->current_table().cells.back().elm);
|
||||
}
|
||||
}
|
||||
|
||||
void odf_table_context::set_cell_row_span(int spanned)
|
||||
@ -524,7 +564,7 @@ void odf_table_context::set_cell_row_span(int spanned)
|
||||
|
||||
void odf_table_context::set_cell_row_span_restart()
|
||||
{
|
||||
int col = impl_->current_table().current_column-1;
|
||||
int col = impl_->current_table().current_column - 1;
|
||||
odf_column_state & state = impl_->current_table().columns[col];
|
||||
|
||||
int sz = state.spanned_row_cell.size();
|
||||
|
||||
@ -85,7 +85,8 @@ public:
|
||||
void end_row();
|
||||
|
||||
void start_cell(office_element_ptr &elm, bool styled = false);
|
||||
void set_cell_column_span(int spanned);
|
||||
void set_cell_column_span(int spanned = 0);
|
||||
void set_cell_column_span_restart();
|
||||
void set_cell_row_span(int spanned = 0);
|
||||
void set_cell_row_span_restart();
|
||||
void end_cell();
|
||||
|
||||
@ -192,10 +192,30 @@ void ods_conversion_context::start_row(int _start_row, int repeated, int level,
|
||||
{
|
||||
if (_start_row > current_table().current_row() + 1)
|
||||
{
|
||||
int repeated_default = _start_row - current_table().current_row()-1;
|
||||
|
||||
start_row(_start_row - repeated_default, repeated_default, 0, true);
|
||||
end_row();
|
||||
int repeated_default = _start_row - current_table().current_row() - 1;
|
||||
|
||||
while(true)
|
||||
{
|
||||
//делим на 3 - до, с комметом, после;
|
||||
int comment_idx = current_table().is_row_comment(current_table().current_row() + 1, repeated_default);
|
||||
|
||||
if (comment_idx < 0) break;
|
||||
int rows = current_table().comments_[comment_idx].row - current_table().current_row() - 1;
|
||||
|
||||
start_row(current_table().current_row() + 1, rows, 0, true);
|
||||
end_row();
|
||||
|
||||
start_row(current_table().current_row() + 1, 1, 0, true);
|
||||
end_row();
|
||||
|
||||
repeated_default -= (1 + rows);
|
||||
}
|
||||
|
||||
if (repeated_default > 0)
|
||||
{
|
||||
start_row(_start_row - repeated_default, repeated_default, 0, true);
|
||||
end_row();
|
||||
}
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////
|
||||
while (level < current_table().current_level())
|
||||
|
||||
@ -423,7 +423,7 @@ int ods_table_state::is_cell_comment(int col, int row, unsigned int repeate_col)
|
||||
{
|
||||
for (size_t i = 0; i < comments_.size(); i++)
|
||||
{
|
||||
if ((comments_[i].col < col + repeate_col && comments_[i].col >= col) && comments_[i].row == row)
|
||||
if ((comments_[i].col < col + repeate_col && comments_[i].col >= col) && comments_[i].row == row && comments_[i].used == false)
|
||||
{
|
||||
return (int)i;
|
||||
}
|
||||
@ -434,7 +434,7 @@ int ods_table_state::is_row_comment(int row, int repeate_row)
|
||||
{
|
||||
for (size_t i = 0; i < comments_.size(); i++)
|
||||
{
|
||||
if (comments_[i].row < row + repeate_row && comments_[i].row >= row)
|
||||
if (comments_[i].row < row + repeate_row && comments_[i].row >= row && comments_[i].used == false)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
@ -1050,6 +1050,7 @@ void ods_table_state::end_cell()
|
||||
{
|
||||
office_element_ptr & comm_elm = comments_[cells_.back().comment_idx].elm;
|
||||
cells_.back().elm->add_child_element(comm_elm);
|
||||
comments_[cells_.back().comment_idx].used = true;
|
||||
}
|
||||
if (cells_.back().empty)
|
||||
{
|
||||
@ -1060,22 +1061,22 @@ void ods_table_state::end_cell()
|
||||
|
||||
void ods_table_state::add_default_cell( unsigned int repeated)
|
||||
{
|
||||
int comment_idx = is_cell_comment(current_table_column_ + 1 , current_table_row_, repeated);
|
||||
int comment_idx = is_cell_comment(current_table_column_ + 1, current_table_row_, repeated);
|
||||
if (comment_idx >= 0 && repeated > 1)
|
||||
{
|
||||
//делим на 3 - до, с комметом, после;
|
||||
int c = current_table_column_;
|
||||
|
||||
add_default_cell(comments_[comment_idx].col - c -1);
|
||||
add_default_cell(comments_[comment_idx].col - c - 1);
|
||||
add_default_cell(1);
|
||||
add_default_cell(repeated + c +1 - comments_[comment_idx].col);
|
||||
add_default_cell(repeated + c + 1 - comments_[comment_idx].col);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
office_element_ptr default_cell_elm;
|
||||
create_element(L"table", L"table-cell",default_cell_elm, context_);
|
||||
create_element(L"table", L"table-cell", default_cell_elm, context_);
|
||||
|
||||
current_row_element()->add_child_element(default_cell_elm);
|
||||
|
||||
|
||||
@ -202,7 +202,8 @@ struct ods_comment_state
|
||||
std::wstring author;
|
||||
|
||||
office_element_ptr elm;
|
||||
//style graphic
|
||||
|
||||
bool used = false;
|
||||
};
|
||||
struct ods_shared_formula_state
|
||||
{
|
||||
|
||||
@ -621,10 +621,15 @@ std::map<std::wstring, std::wstring> odt_conversion_context::parse_instr_options
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void odt_conversion_context::set_field_instr(std::wstring instr)
|
||||
void odt_conversion_context::add_field_instr(const std::wstring &instr)
|
||||
{
|
||||
current_fields.back().instrText += instr;
|
||||
}
|
||||
void odt_conversion_context::set_field_instr()
|
||||
{
|
||||
if (current_fields.empty()) return;
|
||||
|
||||
std::wstring instr = current_fields.back().instrText;
|
||||
|
||||
current_fields.back().status = 1; //prepare
|
||||
|
||||
@ -641,7 +646,6 @@ void odt_conversion_context::set_field_instr(std::wstring instr)
|
||||
{
|
||||
ref = res[1].str();
|
||||
current_fields.back().value = ref.substr(1, ref.length() - 2);
|
||||
|
||||
}
|
||||
}
|
||||
res1 = instr.find(L"NUMPAGES");
|
||||
@ -795,6 +799,7 @@ void odt_conversion_context::separate_field()
|
||||
{
|
||||
if (current_fields.empty()) return;
|
||||
|
||||
set_field_instr();
|
||||
current_fields.back().result = true;
|
||||
}
|
||||
void odt_conversion_context::set_master_page_name(std::wstring master_name)
|
||||
@ -934,6 +939,11 @@ void odt_conversion_context::end_field()
|
||||
{
|
||||
if (current_fields.empty()) return;
|
||||
|
||||
if (current_fields.back().status == 0 && current_fields.back().instrText.empty() == false)
|
||||
{
|
||||
set_field_instr();
|
||||
}
|
||||
|
||||
if (current_fields.back().status == 2)
|
||||
{
|
||||
current_fields.back().status = 3;//prepare for delete
|
||||
@ -1487,7 +1497,7 @@ void odt_conversion_context::start_table_row(bool styled)
|
||||
}
|
||||
void odt_conversion_context::start_table_cell(int col, bool covered, bool styled)
|
||||
{
|
||||
for (int i=table_context()->current_column() ; i < col; i++)
|
||||
for (int i = table_context()->current_column(); i < col; i++)
|
||||
{
|
||||
add_default_cell();
|
||||
}
|
||||
|
||||
@ -114,7 +114,8 @@ public:
|
||||
void start_field (bool in_span);
|
||||
void end_field ();
|
||||
void separate_field ();
|
||||
void set_field_instr (std::wstring instr);
|
||||
void add_field_instr (const std::wstring &instr);
|
||||
void set_field_instr ();
|
||||
std::map<std::wstring, std::wstring> parse_instr_options(const std::wstring& value);
|
||||
|
||||
void start_run (bool styled = false);
|
||||
@ -213,6 +214,8 @@ private:
|
||||
std::wstring value;
|
||||
|
||||
std::wstring format;
|
||||
std::wstring instrText;
|
||||
|
||||
short status = 0;//0, 1, 2, 3 - init, prapare, start, finish
|
||||
bool in_span = false;
|
||||
bool result = false; //after separate
|
||||
|
||||
@ -123,15 +123,18 @@ oox_shape_ptr oox_shape::create(int ooxPrstGeomType)
|
||||
case SimpleTypes::shapetypePie: return boost::make_shared<oox_shape_Pie>();
|
||||
case SimpleTypes::shapetypeDonut: return boost::make_shared<oox_shape_Donut>();
|
||||
case SimpleTypes::shapetypeLeftRightRibbon: return boost::make_shared<oox_shape_LeftRightRibbon>();
|
||||
case SimpleTypes::shapetypeWave: return boost::make_shared<oox_shape_Wave>();
|
||||
case SimpleTypes::shapetypeBracketPair: return boost::make_shared<oox_shape_bracketPair>();
|
||||
|
||||
case SimpleTypes::shapetypeFlowChartExtract: return boost::make_shared<oox_shape_FlowChartExtract>();
|
||||
|
||||
case SimpleTypes::shapetypeLeftArrowCallout: return boost::make_shared<oox_shape_LeftArrowCallout>();
|
||||
case SimpleTypes::shapetypeRightArrowCallout: return boost::make_shared<oox_shape_RightArrowCallout>();
|
||||
case SimpleTypes::shapetypeUpArrowCallout: return boost::make_shared<oox_shape_UpArrowCallout>();
|
||||
case SimpleTypes::shapetypeDownArrowCallout: return boost::make_shared<oox_shape_DownArrowCallout>();
|
||||
case SimpleTypes::shapetypeDownArrowCallout: return boost::make_shared<oox_shape_DownArrowCallout>();
|
||||
|
||||
case SimpleTypes::shapetypeBentUpArrow: return boost::make_shared<oox_shape_BentUpArrow>();
|
||||
case SimpleTypes::shapetypeLeftRightUpArrow: return boost::make_shared<oox_shape_leftRightUpArrow>();
|
||||
|
||||
//case (2001 + SimpleTypes::textshapetypeTextArchDown):
|
||||
//case (2001 + SimpleTypes::textshapetypeTextArchDownPour):
|
||||
|
||||
@ -319,6 +319,7 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
|
||||
|
||||
if (pImageData->m_oRelId.IsInit()) sIdImageFileCache = pImageData->m_oRelId->GetValue();
|
||||
else if (pImageData->m_rId.IsInit()) sIdImageFileCache = pImageData->m_rId->GetValue();
|
||||
else if (pImageData->m_rPict.IsInit()) sIdImageFileCache = pImageData->m_rPict->GetValue();
|
||||
|
||||
if (!sIdImageFileCache.empty())
|
||||
{
|
||||
@ -1300,7 +1301,7 @@ void OoxConverter::convert(PPTX::Logic::BodyPr *oox_bodyPr)
|
||||
}
|
||||
}
|
||||
|
||||
if (oox_bodyPr->fromWordArt.IsInit() && oox_bodyPr->prstTxWarp.IsInit())
|
||||
if ((oox_bodyPr->fromWordArt.IsInit() && (*oox_bodyPr->fromWordArt)) && oox_bodyPr->prstTxWarp.IsInit())
|
||||
{
|
||||
for (size_t i = 0; i < oox_bodyPr->prstTxWarp->avLst.size(); i++)
|
||||
{
|
||||
@ -1806,7 +1807,7 @@ void OoxConverter::convert(PPTX::Logic::RunProperties *oox_run_pr, odf_writer::s
|
||||
if (drawing) //from styles drawing impossible( ... todoooo ???
|
||||
{
|
||||
if ((oox_run_pr->Fill.is<PPTX::Logic::GradFill>()) ||
|
||||
((oox_run_pr->ln.IsInit()) && (oox_run_pr->ln->Fill.is_init() && oox_run_pr->ln->Fill.getType() != OOX::et_a_noFill)))
|
||||
(oox_run_pr->ln.IsInit() /*&& (oox_run_pr->ln->Fill.is_init() && oox_run_pr->ln->Fill.getType() != OOX::et_a_noFill)*/))
|
||||
{
|
||||
drawing->change_text_box_2_wordart();
|
||||
}
|
||||
@ -1815,13 +1816,13 @@ void OoxConverter::convert(PPTX::Logic::RunProperties *oox_run_pr, odf_writer::s
|
||||
{
|
||||
if (oox_run_pr->Fill.is_init())
|
||||
{
|
||||
drawing->start_area_properties();
|
||||
drawing->start_area_properties(true);
|
||||
convert(&oox_run_pr->Fill);
|
||||
drawing->end_area_properties();
|
||||
}
|
||||
if (oox_run_pr->ln.is_init())
|
||||
{
|
||||
drawing->start_line_properties();
|
||||
drawing->start_line_properties(true);
|
||||
if (oox_run_pr->ln->Fill.is_init() && oox_run_pr->ln->Fill.getType() != OOX::et_a_noFill )
|
||||
{
|
||||
drawing->set_line_dash_preset(6);
|
||||
|
||||
@ -343,6 +343,9 @@ void OoxConverter::convert(OOX::Vml::CShape *vml_shape)
|
||||
void OoxConverter::convert(OOX::Vml::CImage *vml_image)
|
||||
{
|
||||
if (vml_image == NULL) return;
|
||||
|
||||
OOX::Vml::CVmlCommonElements *vml_common = dynamic_cast<OOX::Vml::CVmlCommonElements *>(vml_image);
|
||||
convert(vml_common);
|
||||
}
|
||||
void OoxConverter::convert(OOX::Vml::CImageData *vml_image_data)
|
||||
{
|
||||
@ -351,10 +354,15 @@ void OoxConverter::convert(OOX::Vml::CImageData *vml_image_data)
|
||||
std::wstring pathImage;
|
||||
double Width=0, Height = 0;
|
||||
|
||||
if (vml_image_data->m_rId.IsInit())
|
||||
std::wstring sID;
|
||||
|
||||
if (vml_image_data->m_rId.IsInit()) sID = vml_image_data->m_rId->GetValue();
|
||||
else if (vml_image_data->m_oRelId.IsInit()) sID = vml_image_data->m_oRelId->GetValue();
|
||||
else if (vml_image_data->m_rPict.IsInit()) sID = vml_image_data->m_rPict->GetValue();
|
||||
|
||||
if (!sID.empty())
|
||||
{
|
||||
std::wstring sID = vml_image_data->m_rId->GetValue();
|
||||
pathImage = find_link_by_id(sID,1);
|
||||
pathImage = find_link_by_id(sID, 1);
|
||||
}
|
||||
|
||||
//что именно нужно заливка объекта или картинка - разрулится внутри drawing_context
|
||||
@ -432,13 +440,18 @@ void OoxConverter::convert(OOX::Vml::CFill *vml_fill)
|
||||
sRgbColor2 = XmlUtils::IntToString(*nRgbColor2, L"%06X");
|
||||
}
|
||||
|
||||
if (vml_fill->m_rId.IsInit())
|
||||
std::wstring sID;
|
||||
|
||||
if (vml_fill->m_rId.IsInit()) sID = vml_fill->m_rId->GetValue();
|
||||
else if (vml_fill->m_oRelId.IsInit()) sID = vml_fill->m_oRelId->GetValue();
|
||||
else if (vml_fill->m_sId.IsInit()) sID = vml_fill->m_sId.get2();
|
||||
|
||||
if (!sID.empty())
|
||||
{
|
||||
//bitmap fill
|
||||
odf_context()->drawing_context()->start_bitmap_style();
|
||||
{
|
||||
double Width=0, Height = 0;
|
||||
std::wstring sID = vml_fill->m_rId->GetValue();
|
||||
|
||||
sImagePath = find_link_by_id(sID, 1);
|
||||
|
||||
@ -732,12 +745,59 @@ void OoxConverter::convert(OOX::Vml::CTextPath *vml_textpath)
|
||||
if (vml_textpath == NULL) return; //это типо фигурный текст
|
||||
if (vml_textpath->m_sString.IsInit()==false) return;
|
||||
|
||||
//DocxConverter *docx_converter = dynamic_cast<DocxConverter*>(this);
|
||||
odf_context()->drawing_context()->change_text_box_2_wordart();
|
||||
|
||||
if (vml_textpath->m_oStyle.IsInit())
|
||||
{
|
||||
odf_context()->styles_context()->create_style(L"", odf_types::style_family::Paragraph, true, false, -1);
|
||||
|
||||
odf_writer::style_paragraph_properties *paragraph_properties = odf_context()->styles_context()->last_state()->get_paragraph_properties();
|
||||
odf_writer::style_text_properties *text_properties = odf_context()->styles_context()->last_state()->get_text_properties();
|
||||
|
||||
for (size_t i = 0; i < vml_textpath->m_oStyle->m_arrProperties.size(); i++)
|
||||
{
|
||||
if (vml_textpath->m_oStyle->m_arrProperties[i] == NULL) continue;
|
||||
|
||||
switch(vml_textpath->m_oStyle->m_arrProperties[i]->get_Type())
|
||||
{
|
||||
case SimpleTypes::Vml::cssptFont:
|
||||
//height = vml_textpath->m_oStyle->m_arrProperties[i]->get_Value().oValue.dValue;
|
||||
break;
|
||||
case SimpleTypes::Vml::cssptFontSize:
|
||||
text_properties->content_.fo_font_size_ = odf_types::length(vml_textpath->m_oStyle->m_arrProperties[i]->get_Value().dValue, odf_types::length::pt);
|
||||
break;
|
||||
case SimpleTypes::Vml::cssptFontStyle:
|
||||
//width = vml_textpath->m_oStyle->m_arrProperties[i]->get_Value().oValue.dValue;
|
||||
break;
|
||||
case SimpleTypes::Vml::cssptFontWeight:
|
||||
//width = vml_textpath->m_oStyle->m_arrProperties[i]->get_Value().oValue.dValue;
|
||||
break;
|
||||
case SimpleTypes::Vml::cssptFontFamily:
|
||||
text_properties->content_.fo_font_family_ = vml_textpath->m_oStyle->m_arrProperties[i]->get_Value().wsValue;
|
||||
break;
|
||||
case SimpleTypes::Vml::cssptHTextAlign:
|
||||
switch(vml_textpath->m_oStyle->m_arrProperties[i]->get_Value().eVTextAlign)
|
||||
{
|
||||
case SimpleTypes::Vml::cssvtextalignLeft:
|
||||
paragraph_properties->content_.fo_text_align_ = odf_types::text_align(odf_types::text_align::Left); break;
|
||||
case SimpleTypes::Vml::cssvtextalignRight:
|
||||
paragraph_properties->content_.fo_text_align_ = odf_types::text_align(odf_types::text_align::Right); break;
|
||||
case SimpleTypes::Vml::cssvtextalignCenter:
|
||||
paragraph_properties->content_.fo_text_align_ = odf_types::text_align(odf_types::text_align::Center); break;
|
||||
case SimpleTypes::Vml::cssvtextalignJustify:
|
||||
paragraph_properties->content_.fo_text_align_ = odf_types::text_align(odf_types::text_align::Left); break;
|
||||
case SimpleTypes::Vml::cssvtextalignLetterJustify:
|
||||
paragraph_properties->content_.fo_text_align_ = odf_types::text_align(odf_types::text_align::Justify); break;
|
||||
case SimpleTypes::Vml::cssvtextalignStretchJustify:
|
||||
paragraph_properties->content_.fo_text_align_ = odf_types::text_align(odf_types::text_align::Justify); break;
|
||||
}break;
|
||||
}
|
||||
}
|
||||
}
|
||||
odf_context()->start_text_context();
|
||||
|
||||
odf_context()->text_context()->start_paragraph(false);
|
||||
odf_context()->text_context()->start_span(false);
|
||||
odf_context()->text_context()->start_paragraph(vml_textpath->m_oStyle.IsInit());
|
||||
odf_context()->text_context()->start_span(/*vml_textpath->m_oStyle.IsInit()*/);
|
||||
odf_context()->text_context()->add_text_content(vml_textpath->m_sString.get());
|
||||
odf_context()->text_context()->end_span();
|
||||
odf_context()->text_context()->end_paragraph();
|
||||
@ -765,11 +825,13 @@ void OoxConverter::convert(OOX::VmlWord::CWrap *vml_wrap)
|
||||
}break;
|
||||
case SimpleTypes::wraptypeSquare:
|
||||
{
|
||||
odf_context()->drawing_context()->set_wrap_style(odf_types::style_wrap::Dynamic);
|
||||
if (vml_wrap->m_oSide.IsInit())
|
||||
{
|
||||
if (vml_wrap->m_oSide->GetValue() == SimpleTypes::wrapsideLargest)
|
||||
/* if (vml_wrap->m_oSide->GetValue() == SimpleTypes::wrapsideLargest)
|
||||
odf_context()->drawing_context()->set_wrap_style(odf_types::style_wrap::Dynamic);
|
||||
else if (vml_wrap->m_oSide->GetValue() == SimpleTypes::wrapsideLeft)
|
||||
else */
|
||||
if (vml_wrap->m_oSide->GetValue() == SimpleTypes::wrapsideLeft)
|
||||
odf_context()->drawing_context()->set_wrap_style(odf_types::style_wrap::Left);
|
||||
else if (vml_wrap->m_oSide->GetValue() == SimpleTypes::wrapsideRight)
|
||||
odf_context()->drawing_context()->set_wrap_style(odf_types::style_wrap::Right);
|
||||
@ -787,7 +849,7 @@ void OoxConverter::convert(OOX::VmlWord::CWrap *vml_wrap)
|
||||
}break;
|
||||
case SimpleTypes::wraptypeTopAndBottom:
|
||||
{
|
||||
odf_context()->drawing_context()->set_wrap_style(odf_types::style_wrap::Parallel);
|
||||
odf_context()->drawing_context()->set_wrap_style(odf_types::style_wrap::None);
|
||||
}break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -890,7 +890,9 @@ void DocxConverter::convert(OOX::Logic::CFldSimple *oox_fld)
|
||||
odt_context->start_field(true);
|
||||
{
|
||||
if (oox_fld->m_sInstr.IsInit())
|
||||
odt_context->set_field_instr(oox_fld->m_sInstr.get2());
|
||||
odt_context->add_field_instr(oox_fld->m_sInstr.get2());
|
||||
|
||||
odt_context->separate_field();
|
||||
|
||||
for (size_t i = 0; i < oox_fld->m_arrItems.size(); ++i)
|
||||
{
|
||||
@ -903,7 +905,7 @@ void DocxConverter::convert(OOX::Logic::CInstrText *oox_instrText)
|
||||
{
|
||||
if (oox_instrText == NULL) return;
|
||||
|
||||
odt_context->set_field_instr(oox_instrText->m_sText);
|
||||
odt_context->add_field_instr(oox_instrText->m_sText);
|
||||
|
||||
}
|
||||
void DocxConverter::convert(OOX::Logic::CDelText *oox_delText)
|
||||
@ -1294,10 +1296,11 @@ void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cp
|
||||
if (oox_paragraph_pr->m_oShd.IsInit())
|
||||
{
|
||||
_CP_OPT(odf_types::color) odf_color;
|
||||
convert(oox_paragraph_pr->m_oShd->m_oFill.GetPointer(), oox_paragraph_pr->m_oShd->m_oThemeFill.GetPointer(),
|
||||
oox_paragraph_pr->m_oShd->m_oThemeFillTint.GetPointer(), oox_paragraph_pr->m_oShd->m_oThemeShade.GetPointer(), odf_color);
|
||||
convert(oox_paragraph_pr->m_oShd.GetPointer(), odf_color);
|
||||
if (odf_color)
|
||||
{
|
||||
paragraph_properties->content_.fo_background_color_ = *odf_color;
|
||||
}
|
||||
}
|
||||
if (oox_paragraph_pr->m_oTextDirection.IsInit() && oox_paragraph_pr->m_oTextDirection->m_oVal.IsInit())
|
||||
{
|
||||
@ -1396,6 +1399,70 @@ void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cp
|
||||
}
|
||||
}
|
||||
|
||||
void DocxConverter::convert( ComplexTypes::Word::CShading* shading, _CP_OPT(odf_types::color)& odf_color)
|
||||
{
|
||||
if (!shading) return;
|
||||
|
||||
convert(shading->m_oFill.GetPointer(), shading->m_oThemeFill.GetPointer(),
|
||||
shading->m_oThemeFillTint.GetPointer(), shading->m_oThemeShade.GetPointer(), odf_color);
|
||||
|
||||
if (odf_color) return;
|
||||
|
||||
if (shading->m_oColor.IsInit())
|
||||
{
|
||||
if ((shading->m_oColor->GetValue() == SimpleTypes::hexcolorAuto) &&
|
||||
(shading->m_oVal.IsInit()) && (shading->m_oVal->GetValue() == SimpleTypes::shdClear))
|
||||
{
|
||||
return;
|
||||
}
|
||||
BYTE ucR = 0xff, ucB = 0xff, ucG = 0xff; //auto fill
|
||||
if (shading->m_oColor->GetValue() == SimpleTypes::hexcolorRGB)
|
||||
{
|
||||
ucR = shading->m_oColor->Get_R();
|
||||
ucB = shading->m_oColor->Get_B();
|
||||
ucG = shading->m_oColor->Get_G();
|
||||
}
|
||||
if (shading->m_oVal.IsInit())
|
||||
{
|
||||
double kf = 0;
|
||||
switch(shading->m_oVal->GetValue())
|
||||
{
|
||||
case SimpleTypes::shdPct10: kf = 0.10; break;
|
||||
case SimpleTypes::shdPct12: kf = 0.12; break;
|
||||
case SimpleTypes::shdPct15: kf = 0.15; break;
|
||||
case SimpleTypes::shdPct20: kf = 0.20; break;
|
||||
case SimpleTypes::shdPct25: kf = 0.25; break;
|
||||
case SimpleTypes::shdPct30: kf = 0.30; break;
|
||||
case SimpleTypes::shdPct35: kf = 0.35; break;
|
||||
case SimpleTypes::shdPct37: kf = 0.37; break;
|
||||
case SimpleTypes::shdPct40: kf = 0.40; break;
|
||||
case SimpleTypes::shdPct45: kf = 0.45; break;
|
||||
case SimpleTypes::shdPct5 : kf = 0.05; break;
|
||||
case SimpleTypes::shdPct50: kf = 0.50; break;
|
||||
case SimpleTypes::shdPct55: kf = 0.55; break;
|
||||
case SimpleTypes::shdPct60: kf = 0.60; break;
|
||||
case SimpleTypes::shdPct62: kf = 0.62; break;
|
||||
case SimpleTypes::shdPct65: kf = 0.65; break;
|
||||
case SimpleTypes::shdPct70: kf = 0.70; break;
|
||||
case SimpleTypes::shdPct75: kf = 0.75; break;
|
||||
case SimpleTypes::shdPct80: kf = 0.80; break;
|
||||
case SimpleTypes::shdPct85: kf = 0.85; break;
|
||||
case SimpleTypes::shdPct87: kf = 0.87; break;
|
||||
case SimpleTypes::shdPct90: kf = 0.90; break;
|
||||
case SimpleTypes::shdPct95: kf = 0.95; break;
|
||||
}
|
||||
ucR = (BYTE)(ucR * (1 - kf)); ucB = (BYTE)(ucB * (1 - kf)); ucG = (BYTE)(ucG * (1 - kf));
|
||||
}
|
||||
SimpleTypes::CHexColor<> *oRgbColor = new SimpleTypes::CHexColor<>(ucR,ucG,ucB);
|
||||
|
||||
if (oRgbColor)
|
||||
{
|
||||
std::wstring strColor = L"#" + oRgbColor->ToString().substr(2);//.Right(6);
|
||||
odf_color = odf_types::color(strColor);
|
||||
delete oRgbColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
void DocxConverter::apply_HF_from(OOX::Logic::CSectionProperty *props, OOX::Logic::CSectionProperty *other)
|
||||
{
|
||||
if (props == NULL || other== NULL)return;
|
||||
@ -2178,20 +2245,38 @@ void DocxConverter::convert(OOX::Logic::CRunProperty *oox_run_pr, odf_writer::st
|
||||
}
|
||||
|
||||
bool set_color = false;
|
||||
if (oox_run_pr->m_oTextFill.getType() == OOX::et_a_gradFill)
|
||||
if (oox_run_pr->m_oTextFill.getType() == OOX::et_a_gradFill || oox_run_pr->m_oTextOutline.IsInit())
|
||||
{
|
||||
NSCommon::smart_ptr<PPTX::Logic::GradFill> gradFill = oox_run_pr->m_oTextFill.Fill.smart_dynamic_cast<PPTX::Logic::GradFill>();
|
||||
odf_writer::odf_drawing_context *drawing_context = odf_context()->drawing_context();
|
||||
if (drawing_context)
|
||||
{
|
||||
if (odf_context()->drawing_context()->change_text_box_2_wordart())
|
||||
{
|
||||
odf_context()->drawing_context()->start_area_properties();
|
||||
NSCommon::smart_ptr<PPTX::Logic::GradFill> gradFill = oox_run_pr->m_oTextFill.Fill.smart_dynamic_cast<PPTX::Logic::GradFill>();
|
||||
NSCommon::smart_ptr<PPTX::Logic::SolidFill> solidFill = oox_run_pr->m_oTextFill.Fill.smart_dynamic_cast<PPTX::Logic::SolidFill>();
|
||||
|
||||
odf_context()->drawing_context()->start_area_properties(true);
|
||||
if(gradFill.IsInit())
|
||||
{
|
||||
OoxConverter::convert(gradFill.operator->());
|
||||
}
|
||||
else if (solidFill.IsInit())
|
||||
{
|
||||
OoxConverter::convert(solidFill.operator->());
|
||||
}
|
||||
else
|
||||
{
|
||||
odf_context()->drawing_context()->set_no_fill();
|
||||
}
|
||||
odf_context()->drawing_context()->end_area_properties();
|
||||
|
||||
if (oox_run_pr->m_oTextOutline.IsInit())
|
||||
{
|
||||
odf_context()->drawing_context()->start_line_properties(true);
|
||||
OoxConverter::convert(oox_run_pr->m_oTextOutline.operator->());
|
||||
odf_context()->drawing_context()->end_line_properties();
|
||||
}
|
||||
|
||||
set_color = true;
|
||||
}
|
||||
}
|
||||
@ -2560,6 +2645,17 @@ void DocxConverter::convert(OOX::Logic::CPicture* oox_pic)
|
||||
odf_context()->drawing_context()->corrected_line_fill();
|
||||
odf_context()->drawing_context()->end_shape();
|
||||
}
|
||||
else if (oox_pic->m_oImage.IsInit())
|
||||
{
|
||||
odf_context()->drawing_context()->set_name(L"Image");
|
||||
odf_context()->drawing_context()->start_shape(3000);
|
||||
|
||||
OoxConverter::convert(oox_pic->m_oShape.GetPointer());
|
||||
OoxConverter::convert(oox_pic->m_oImage.GetPointer());
|
||||
|
||||
odf_context()->drawing_context()->corrected_line_fill();
|
||||
odf_context()->drawing_context()->end_shape();
|
||||
}
|
||||
else if (oox_pic->m_oShapeType.IsInit())
|
||||
{
|
||||
SimpleTypes::Vml::SptType sptType = oox_pic->m_oShapeType->m_oSpt.IsInit() ? static_cast<SimpleTypes::Vml::SptType>(oox_pic->m_oShapeType->m_oSpt->GetValue()) : SimpleTypes::Vml::sptNotPrimitive;
|
||||
@ -2638,7 +2734,12 @@ void DocxConverter::convert(OOX::Logic::CPicture* oox_pic)
|
||||
odf_context()->drawing_context()->start_shape(SimpleTypes::shapetypeRect);
|
||||
}
|
||||
OoxConverter::convert(shape_type);
|
||||
OoxConverter::convert(oox_pic->m_oShape.GetPointer());
|
||||
OoxConverter::convert(oox_pic->m_oShape.GetPointer());
|
||||
|
||||
for (size_t i = 0; i < oox_pic->m_arrItems.size(); i++)
|
||||
{
|
||||
convert(oox_pic->m_arrItems[i]);
|
||||
}
|
||||
odf_context()->drawing_context()->end_shape();
|
||||
}
|
||||
odf_context()->drawing_context()->end_drawing();
|
||||
@ -4050,6 +4151,12 @@ void DocxConverter::convert(OOX::Logic::CTc *oox_table_cell)
|
||||
oox_table_cell->m_pTableCellProperties->m_oVMerge->m_oVal->GetValue() == SimpleTypes::mergeRestart))
|
||||
covered = true;
|
||||
}
|
||||
if (oox_table_cell->m_pTableCellProperties->m_oHMerge.IsInit())
|
||||
{
|
||||
if (!(oox_table_cell->m_pTableCellProperties->m_oHMerge->m_oVal.IsInit() &&
|
||||
oox_table_cell->m_pTableCellProperties->m_oHMerge->m_oVal->GetValue() == SimpleTypes::mergeRestart))
|
||||
covered = true;
|
||||
}
|
||||
}
|
||||
|
||||
odt_context->start_table_cell( oox_table_cell->m_nNumCol, covered, convert(oox_table_cell->m_pTableCellProperties, oox_table_cell->m_nNumCol + 1));
|
||||
@ -4065,7 +4172,18 @@ void DocxConverter::convert(OOX::Logic::CTc *oox_table_cell)
|
||||
odt_context->table_context()->set_cell_row_span();
|
||||
}
|
||||
if (oox_table_cell->m_pTableCellProperties->m_oGridSpan.IsInit() && oox_table_cell->m_pTableCellProperties->m_oGridSpan->m_oVal.IsInit())
|
||||
{
|
||||
odt_context->table_context()->set_cell_column_span(oox_table_cell->m_pTableCellProperties->m_oGridSpan->m_oVal->GetValue());
|
||||
}
|
||||
else if ((oox_table_cell->m_pTableCellProperties->m_oHMerge.IsInit()) &&
|
||||
(oox_table_cell->m_pTableCellProperties->m_oHMerge->m_oVal.IsInit()))
|
||||
{
|
||||
if (oox_table_cell->m_pTableCellProperties->m_oHMerge->m_oVal->GetValue() == SimpleTypes::mergeRestart)
|
||||
odt_context->table_context()->set_cell_column_span_restart();
|
||||
else
|
||||
odt_context->table_context()->set_cell_column_span();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < oox_table_cell->m_arrItems.size(); ++i)
|
||||
@ -4307,13 +4425,23 @@ bool DocxConverter::convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr,
|
||||
{
|
||||
switch(oox_table_cell_pr->m_oTextDirection->m_oVal->GetValue())
|
||||
{
|
||||
case SimpleTypes::textdirectionLr :
|
||||
table_cell_properties->style_table_cell_properties_attlist_.style_direction_ = odf_types::direction(odf_types::direction::Ltr);break;
|
||||
case SimpleTypes::textdirectionTb :
|
||||
{
|
||||
table_cell_properties->style_table_cell_properties_attlist_.style_direction_ = odf_types::direction(odf_types::direction::Ltr);
|
||||
}break;
|
||||
case SimpleTypes::textdirectionLr ://повернутость буковок
|
||||
case SimpleTypes::textdirectionLrV :
|
||||
case SimpleTypes::textdirectionTb ://повернутость буковок
|
||||
case SimpleTypes::textdirectionTbV :
|
||||
case SimpleTypes::textdirectionRlV :
|
||||
table_cell_properties->style_table_cell_properties_attlist_.style_direction_ = odf_types::direction(odf_types::direction::Ttb);break;
|
||||
{
|
||||
table_cell_properties->style_table_cell_properties_attlist_.style_direction_ = odf_types::direction(odf_types::direction::Ttb);
|
||||
odf_writer::style_text_properties *text_cell_properties = odt_context->styles_context()->last_state()->get_text_properties();
|
||||
if (text_cell_properties)
|
||||
{
|
||||
text_cell_properties->content_.style_text_rotation_angle_ = 90;
|
||||
text_cell_properties->content_.style_text_rotation_scale_ = odf_types::text_rotation_scale::LineHeight;
|
||||
}
|
||||
}break;
|
||||
case SimpleTypes::textdirectionRl ://rtl
|
||||
break;
|
||||
}
|
||||
|
||||
@ -117,6 +117,7 @@ namespace ComplexTypes
|
||||
class CTblWidth;
|
||||
class CPageBorder;
|
||||
class CTrackChange;
|
||||
class CShading;
|
||||
}
|
||||
}
|
||||
namespace cpdoccore
|
||||
@ -219,6 +220,7 @@ namespace Oox2Odf
|
||||
void convert(OOX::Drawing::CInline *oox_inline);
|
||||
|
||||
void convert(SimpleTypes::CTheme<> *oox_font_theme,_CP_OPT(std::wstring) & odf_font_name);
|
||||
void convert(ComplexTypes::Word::CShading *shading, _CP_OPT(odf_types::color) & odf_color);
|
||||
void convert(ComplexTypes::Word::CColor *color, _CP_OPT(odf_types::color) & odf_color);
|
||||
void convert(SimpleTypes::CUniversalMeasure *oox_size, _CP_OPT(odf_types::length) & odf_size);
|
||||
void convert(SimpleTypes::CUniversalMeasure *oox_size, _CP_OPT(odf_types::length_or_percent) & odf_size);
|
||||
|
||||
@ -301,7 +301,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
|
||||
ods_context->start_rows();
|
||||
for (size_t row = 0 ; row < oox_sheet->m_oSheetData->m_arrItems.size(); row++)
|
||||
{
|
||||
convert(oox_sheet->m_oSheetData->m_arrItems[row]);
|
||||
convert(oox_sheet->m_oSheetData->m_arrItems[row], row > 0 ? oox_sheet->m_oSheetData->m_arrItems[row - 1] : NULL);
|
||||
|
||||
if ( oox_sheet->m_oSheetData->m_arrItems[row] )
|
||||
delete oox_sheet->m_oSheetData->m_arrItems[row];
|
||||
@ -487,6 +487,8 @@ void XlsxConverter::convert(OOX::Spreadsheet::CRow *oox_row, OOX::Spreadsheet::C
|
||||
{
|
||||
if (oox_row == NULL)return;
|
||||
|
||||
int row_number = oox_row->m_oR.IsInit() ? oox_row->m_oR->GetValue() : -1;
|
||||
|
||||
if (oox_row_prev)
|
||||
{
|
||||
if (oox_row_prev->m_arrItems.empty() &&
|
||||
@ -592,14 +594,15 @@ void XlsxConverter::convert(OOX::Spreadsheet::CRow *oox_row, OOX::Spreadsheet::C
|
||||
|
||||
if (bEqual)
|
||||
{
|
||||
ods_context->add_row_repeated();
|
||||
return;
|
||||
if (false == ods_context->current_table().is_row_comment(row_number, 1))
|
||||
{
|
||||
ods_context->add_row_repeated();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int row_number = oox_row->m_oR.IsInit() ? oox_row->m_oR->GetValue() : -1;
|
||||
|
||||
bool _default = true;
|
||||
|
||||
if (oox_row->m_oHt.IsInit() || oox_row->m_oCustomHeight.IsInit() || oox_row->m_oHidden.IsInit() || oox_row->m_oCollapsed.IsInit()) _default = false;
|
||||
|
||||
@ -52,7 +52,7 @@ COfficePPTFile::~COfficePPTFile()
|
||||
CloseFile();
|
||||
}
|
||||
|
||||
long COfficePPTFile::OpenFile(const std::wstring & sFileName, const std::wstring & password, bool &bMacros)
|
||||
_UINT32 COfficePPTFile::OpenFile(const std::wstring & sFileName, const std::wstring & password, bool &bMacros)
|
||||
{
|
||||
CloseFile();
|
||||
|
||||
@ -103,14 +103,14 @@ bool COfficePPTFile::CloseFile()
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT COfficePPTFile::LoadFromFile(std::wstring sSrcFileName, std::wstring sDstPath, std::wstring password, bool &bMacros)
|
||||
_UINT32 COfficePPTFile::LoadFromFile(std::wstring sSrcFileName, std::wstring sDstPath, std::wstring password, bool &bMacros)
|
||||
{
|
||||
if (m_strTempDirectory.empty())
|
||||
{
|
||||
m_strTempDirectory = NSDirectory::GetTempPath();
|
||||
}
|
||||
|
||||
long nResult = OpenFile(sSrcFileName, password, bMacros);
|
||||
_UINT32 nResult = OpenFile(sSrcFileName, password, bMacros);
|
||||
if (nResult != S_OK)
|
||||
{
|
||||
CloseFile();
|
||||
|
||||
@ -66,9 +66,9 @@ public:
|
||||
return m_strTempDirectory;
|
||||
}
|
||||
|
||||
HRESULT LoadFromFile(std::wstring sSrcFileName, std::wstring sDstPath, std::wstring password, bool &bMacros);
|
||||
_UINT32 LoadFromFile(std::wstring sSrcFileName, std::wstring sDstPath, std::wstring password, bool &bMacros);
|
||||
|
||||
long OpenFile(const std::wstring & fileName, const std::wstring & password, bool &bMacros);
|
||||
_UINT32 OpenFile(const std::wstring & fileName, const std::wstring & password, bool &bMacros);
|
||||
bool CloseFile();
|
||||
private:
|
||||
|
||||
|
||||
@ -39,6 +39,7 @@
|
||||
#include "../../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
|
||||
#include "../../../ASCOfficeXlsFile2/source/Common/simple_xml_writer.h"
|
||||
#include "../../../DesktopEditor/common/Directory.h"
|
||||
#include "../../../DesktopEditor/common/SystemUtils.h"
|
||||
|
||||
#include "../Reader/PPTDocumentInfo.h"
|
||||
|
||||
@ -291,7 +292,9 @@ void NSPresentationEditor::CPPTXWriter::WriteApp(CFile& oFile)
|
||||
{
|
||||
CP_XML_STREAM() << 0;
|
||||
}
|
||||
std::wstring sApplication = L"ONLYOFFICE";
|
||||
std::wstring sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvApplicationName);
|
||||
if (sApplication.empty())
|
||||
sApplication = NSSystemUtils::gc_EnvApplicationNameDefault;
|
||||
#if defined(INTVER)
|
||||
std::string s = VALUE2STR(INTVER);
|
||||
sApplication += L"/" + std::wstring(s.begin(), s.end());
|
||||
|
||||
@ -170,7 +170,7 @@ namespace NS_DWC_Common
|
||||
alpha = (BYTE)(XmlUtils::GetDouble(str) * 256);
|
||||
}
|
||||
else
|
||||
alpha = (BYTE)XmlUtils::GetDouble(opacityStr) * 256;
|
||||
alpha = (BYTE)(XmlUtils::GetDouble(opacityStr) * 256);
|
||||
}
|
||||
return alpha;
|
||||
}
|
||||
@ -2164,6 +2164,7 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
|
||||
nullable_string sOpacity;
|
||||
nullable_string sOpacity2;
|
||||
nullable_string sColor2;
|
||||
nullable_string sColor;
|
||||
nullable_string sType;
|
||||
nullable_string sFocus;
|
||||
nullable_string sFocusSize;
|
||||
@ -2171,8 +2172,9 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
|
||||
nullable_string sAngle;
|
||||
nullable_string sColors;
|
||||
|
||||
XmlMacroReadAttributeBase(oNodeP, L"opacity" , sOpacity);
|
||||
XmlMacroReadAttributeBase(oNodeP, L"opacity" , sOpacity);
|
||||
XmlMacroReadAttributeBase(oNodeP, L"opacity2" , sOpacity2);
|
||||
XmlMacroReadAttributeBase(oNodeP, L"color" , sColor);
|
||||
XmlMacroReadAttributeBase(oNodeP, L"color2" , sColor2);
|
||||
XmlMacroReadAttributeBase(oNodeP, L"type" , sType);
|
||||
XmlMacroReadAttributeBase(oNodeP, L"focus" , sFocus);
|
||||
@ -2199,22 +2201,52 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
|
||||
{
|
||||
nFocus = _wtoi(sFocus->c_str())/100.0;
|
||||
}
|
||||
|
||||
if (sOpacity.is_init())
|
||||
{
|
||||
bOpacity = true;
|
||||
lAlpha = NS_DWC_Common::getOpacityFromString(*sOpacity);
|
||||
oMod.name = L"alpha";
|
||||
oMod.val = (int)(lAlpha * 100000.0 / 255.0);
|
||||
oMod.val = (int)((1 - lAlpha/ 255.0) * 100000.0 );
|
||||
|
||||
if (arColors.at(0)->is_init())
|
||||
arColors.at(0)->Color->Modifiers.push_back(oMod);
|
||||
}
|
||||
if (sColor.is_init())
|
||||
{
|
||||
NSPresentationEditor::CColor color;
|
||||
if (sColor->find(L"fill") != -1)
|
||||
{
|
||||
std::wstring sColorEffect = *sColor;
|
||||
if (sColorEffect.length() > 5)
|
||||
sColorEffect = sColorEffect.substr(5);
|
||||
|
||||
int resR, resG, resB;
|
||||
GetColorWithEffect(sColorEffect, R, G, B, resR, resG, resB);
|
||||
|
||||
color.R = resR;
|
||||
color.G = resG;
|
||||
color.B = resB;
|
||||
}
|
||||
else
|
||||
{
|
||||
color = NS_DWC_Common::getColorFromString(*sColor);
|
||||
}
|
||||
PPTX::Logic::UniColor *oColor = new PPTX::Logic::UniColor();
|
||||
oColor->Color = new PPTX::Logic::SrgbClr();
|
||||
oColor->Color->SetRGB(color.R, color.G, color.B);
|
||||
|
||||
if (bOpacity)
|
||||
oColor->Color->Modifiers.push_back(oMod);
|
||||
|
||||
arColors[0] = oColor;
|
||||
}
|
||||
if (sOpacity2.is_init())
|
||||
{
|
||||
bOpacity2 = true;
|
||||
lAlpha = NS_DWC_Common::getOpacityFromString(*sOpacity2);
|
||||
oMod.name = L"alpha";
|
||||
oMod2.val = (int)(lAlpha * 100000.0 / 255.0);
|
||||
oMod2.val = (int)((1 - lAlpha/ 255.) * 100000.);
|
||||
|
||||
if (arColors.at(1)->is_init())
|
||||
arColors.at(1)->Color->Modifiers.push_back(oMod2);
|
||||
@ -2863,8 +2895,8 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
|
||||
pShape->signatureLine = pPPTShape->m_oSignatureLine;
|
||||
}
|
||||
|
||||
if (!pPPTShape->IsWordArt())
|
||||
CheckPenShape(elem, oNodeShape, pPPTShape);
|
||||
//if (!pPPTShape->IsWordArt())
|
||||
CheckPenShape(elem, oNodeShape, pPPTShape);
|
||||
|
||||
CheckBrushShape(elem, oNodeShape, pPPTShape);
|
||||
|
||||
@ -4257,7 +4289,10 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
|
||||
nullable_string sRelid;
|
||||
XmlMacroReadAttributeBase(oNodeFillID, L"o:relid", sRelid);
|
||||
|
||||
if (sRid.is_init() || sRelid.is_init())
|
||||
nullable_string sPictId;
|
||||
XmlMacroReadAttributeBase(oNodeFillID, L"r:pict", sPictId);
|
||||
|
||||
if (sRid.is_init() || sRelid.is_init() || sPictId.is_init())
|
||||
{
|
||||
nullable_string sType;
|
||||
XmlMacroReadAttributeBase(oNodeFillID, L"type", sType);
|
||||
@ -4278,7 +4313,7 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
|
||||
pBlipFill->m_namespace = L"a";
|
||||
pBlipFill->blip = new PPTX::Logic::Blip();
|
||||
|
||||
std::wstring sId = sRid.IsInit() ? *sRid : (sRelid.IsInit() ? *sRelid : L"");
|
||||
std::wstring sId = sRid.IsInit() ? *sRid : (sRelid.IsInit() ? *sRelid : (sPictId.IsInit() ? *sPictId : L""));
|
||||
pBlipFill->blip->embed = new OOX::RId(sId);
|
||||
|
||||
if (sType.is_init() && *sType == L"tile")
|
||||
@ -4451,6 +4486,13 @@ void CDrawingConverter::CheckPenShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils::
|
||||
XmlUtils::CXmlNode oNodeStroke = oNode.ReadNode(L"v:stroke");
|
||||
if (oNodeStroke.IsValid())
|
||||
{
|
||||
nullable_string sStrokeOn;
|
||||
XmlMacroReadAttributeBase(oNodeStroke, L"on", sStrokeOn);
|
||||
if (sStrokeOn.is_init())
|
||||
{
|
||||
sStroked.reset();
|
||||
sStroked = sStrokeOn;
|
||||
}
|
||||
sStrokeColor.reset();
|
||||
XmlMacroReadAttributeBase(oNodeStroke, L"strokecolor", sStrokeColor);
|
||||
if (sStrokeColor.is_init())
|
||||
|
||||
@ -74,9 +74,9 @@ public:
|
||||
|
||||
~CPPTXFile();
|
||||
|
||||
HRESULT LoadFromFile(std::wstring sSrcFileName, std::wstring sDstPath, std::wstring sXMLOptions);
|
||||
_UINT32 LoadFromFile(std::wstring sSrcFileName, std::wstring sDstPath, std::wstring sXMLOptions);
|
||||
|
||||
HRESULT SaveToFile(std::wstring sDstFileName, std::wstring sSrcPath, std::wstring sXMLOptions);
|
||||
_UINT32 SaveToFile(std::wstring sDstFileName, std::wstring sSrcPath, std::wstring sXMLOptions);
|
||||
|
||||
HRESULT get_TempDirectory(std::wstring* pVal);
|
||||
HRESULT put_TempDirectory(std::wstring newVal);
|
||||
@ -96,8 +96,9 @@ public:
|
||||
HRESULT SetThemesDir (std::wstring bsDir);
|
||||
HRESULT SetUseSystemFonts (bool useSystemFonts);
|
||||
void SetIsNoBase64 (bool bIsNoBase64);
|
||||
HRESULT OpenFileToPPTY (std::wstring bsInput, std::wstring bsOutput);
|
||||
HRESULT OpenDirectoryToPPTY (std::wstring bsInput, std::wstring bsOutput);
|
||||
HRESULT ConvertPPTYToPPTX (std::wstring bsInput, std::wstring bsOutput, std::wstring bsThemesFolder);
|
||||
|
||||
_UINT32 OpenFileToPPTY (std::wstring bsInput, std::wstring bsOutput);
|
||||
_UINT32 OpenDirectoryToPPTY (std::wstring bsInput, std::wstring bsOutput);
|
||||
_UINT32 ConvertPPTYToPPTX (std::wstring bsInput, std::wstring bsOutput, std::wstring bsThemesFolder);
|
||||
};
|
||||
#endif //ASC_OFFICE_PPTX_FILE
|
||||
|
||||
@ -47,6 +47,7 @@
|
||||
#include "Editor/PPTXWriter.h"
|
||||
|
||||
#include "PPTXFormat/PPTXEvent.h"
|
||||
#include "../Common/OfficeFileErrorDescription.h"
|
||||
|
||||
CPPTXFile::CPPTXFile(extract_to_directory fCallbackExtract, compress_from_directory fCallbackCompress, progress_operation fCallbackProgress, void* pCallbackArg)
|
||||
{
|
||||
@ -82,20 +83,20 @@ CPPTXFile::~CPPTXFile()
|
||||
{
|
||||
RELEASEOBJECT(m_pPptxDocument);
|
||||
}
|
||||
HRESULT CPPTXFile::LoadFromFile(std::wstring sSrcFileName, std::wstring sDstPath, std::wstring sXMLOptions)
|
||||
_UINT32 CPPTXFile::LoadFromFile(std::wstring sSrcFileName, std::wstring sDstPath, std::wstring sXMLOptions)
|
||||
{
|
||||
std::wstring localTempDir(sDstPath);
|
||||
if(!localTempDir.empty())
|
||||
{
|
||||
bool res = NSDirectory::CreateDirectory(localTempDir);
|
||||
if (res == false) return S_FALSE;
|
||||
if (res == false) return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
|
||||
put_TempDirectory(sDstPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool res = NSDirectory::CreateDirectory(m_strTempDir);
|
||||
if (res == false) return S_FALSE;
|
||||
if (res == false) return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
localTempDir = m_strTempDir;
|
||||
|
||||
@ -103,7 +104,7 @@ HRESULT CPPTXFile::LoadFromFile(std::wstring sSrcFileName, std::wstring sDstPath
|
||||
if (m_pCallbackArg)
|
||||
{
|
||||
if(!m_fCallbackExtract(m_pCallbackArg, srcFileName , localTempDir))
|
||||
return S_FALSE;
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -116,19 +117,19 @@ HRESULT CPPTXFile::LoadFromFile(std::wstring sSrcFileName, std::wstring sDstPath
|
||||
if(!m_pPptxDocument->isValid(localTempDir))
|
||||
{
|
||||
RELEASEOBJECT(m_pPptxDocument);
|
||||
return S_FALSE;
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
m_pPptxDocument->read(localTempDir, (PPTX::IPPTXEvent*)this);
|
||||
if(GetPercent() < 1000000)
|
||||
{
|
||||
RELEASEOBJECT(m_pPptxDocument);
|
||||
return S_FALSE;
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
smart_ptr<PPTX::Presentation> presentation = m_pPptxDocument->Get(OOX::Presentation::FileTypes::Presentation).smart_dynamic_cast<PPTX::Presentation>();
|
||||
if (!presentation.is_init())
|
||||
{
|
||||
NSDirectory::DeleteDirectory(m_strTempDir, false);
|
||||
return S_FALSE;
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
|
||||
m_strDirectory = sSrcFileName;
|
||||
@ -136,12 +137,12 @@ HRESULT CPPTXFile::LoadFromFile(std::wstring sSrcFileName, std::wstring sDstPath
|
||||
if (-1 != nIndex)
|
||||
m_strDirectory = m_strDirectory.substr(0, nIndex);
|
||||
|
||||
return S_OK;
|
||||
return 0;
|
||||
}
|
||||
HRESULT CPPTXFile::SaveToFile(std::wstring sDstFileName, std::wstring sSrcPath, std::wstring sXMLOptions)
|
||||
_UINT32 CPPTXFile::SaveToFile(std::wstring sDstFileName, std::wstring sSrcPath, std::wstring sXMLOptions)
|
||||
{
|
||||
if (NULL == m_pPptxDocument)
|
||||
return S_FALSE;
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
|
||||
OOX::CPath oPath;
|
||||
oPath.m_strFilename = std::wstring(sSrcPath);
|
||||
@ -149,7 +150,7 @@ HRESULT CPPTXFile::SaveToFile(std::wstring sDstFileName, std::wstring sSrcPath,
|
||||
|
||||
std::wstring srcFilePath = sSrcPath;
|
||||
std::wstring dstFileName = sDstFileName;
|
||||
return m_fCallbackCompress ? (m_fCallbackCompress(m_pCallbackArg, srcFilePath, dstFileName) ? S_OK : S_FALSE) : S_OK;
|
||||
return m_fCallbackCompress ? (m_fCallbackCompress(m_pCallbackArg, srcFilePath, dstFileName) ? 0 : AVS_FILEUTILS_ERROR_CONVERT) : 0;
|
||||
}
|
||||
HRESULT CPPTXFile::get_TempDirectory(std::wstring* pVal)
|
||||
{
|
||||
@ -237,7 +238,7 @@ void CPPTXFile::SetIsNoBase64(bool bIsNoBase64)
|
||||
{
|
||||
m_bIsNoBase64 = bIsNoBase64;
|
||||
}
|
||||
HRESULT CPPTXFile::OpenFileToPPTY(std::wstring bsInput, std::wstring bsOutput)
|
||||
_UINT32 CPPTXFile::OpenFileToPPTY(std::wstring bsInput, std::wstring bsOutput)
|
||||
{
|
||||
if (m_strTempDir.empty())
|
||||
{
|
||||
@ -268,14 +269,14 @@ HRESULT CPPTXFile::OpenFileToPPTY(std::wstring bsInput, std::wstring bsOutput)
|
||||
}
|
||||
std::wstring bsLocalInputTemp= pathLocalInputTemp.GetPath();
|
||||
|
||||
HRESULT hr = OpenDirectoryToPPTY(bsLocalInputTemp, bsOutput);
|
||||
_UINT32 hr = OpenDirectoryToPPTY(bsLocalInputTemp, bsOutput);
|
||||
|
||||
if (notDeleteInput == false)
|
||||
NSDirectory::DeleteDirectory(pathLocalInputTemp.GetPath());
|
||||
|
||||
return hr;
|
||||
}
|
||||
HRESULT CPPTXFile::OpenDirectoryToPPTY(std::wstring bsInput, std::wstring bsOutput)
|
||||
_UINT32 CPPTXFile::OpenDirectoryToPPTY(std::wstring bsInput, std::wstring bsOutput)
|
||||
{
|
||||
OOX::CPath pathInputDirectory = bsInput;
|
||||
|
||||
@ -285,20 +286,20 @@ HRESULT CPPTXFile::OpenDirectoryToPPTY(std::wstring bsInput, std::wstring bsOutp
|
||||
if (!m_pPptxDocument->isValid(pathInputDirectory.GetPath())) // true ???
|
||||
{
|
||||
RELEASEOBJECT(m_pPptxDocument);
|
||||
return S_FALSE;
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
|
||||
m_pPptxDocument->read(pathInputDirectory.GetPath() + FILE_SEPARATOR_STR, (PPTX::IPPTXEvent*)this);
|
||||
if(GetPercent() < 1000000)
|
||||
{
|
||||
RELEASEOBJECT(m_pPptxDocument);
|
||||
return S_FALSE;
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
smart_ptr<PPTX::Presentation> presentation = m_pPptxDocument->Get(OOX::Presentation::FileTypes::Presentation).smart_dynamic_cast<PPTX::Presentation>();
|
||||
if (!presentation.is_init())
|
||||
{
|
||||
NSDirectory::DeleteDirectory(m_strTempDir, false);
|
||||
return S_FALSE;
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
|
||||
m_strDirectory = pathInputDirectory.GetDirectory();
|
||||
@ -335,7 +336,7 @@ HRESULT CPPTXFile::OpenDirectoryToPPTY(std::wstring bsInput, std::wstring bsOutp
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CPPTXFile::ConvertPPTYToPPTX(std::wstring bsInput, std::wstring bsOutput, std::wstring bsThemesFolder)//bsOutput и файл и директория может быть
|
||||
_UINT32 CPPTXFile::ConvertPPTYToPPTX(std::wstring bsInput, std::wstring bsOutput, std::wstring bsThemesFolder)//bsOutput и файл и директория может быть
|
||||
{
|
||||
OOX::CPath pathLocalTempDirectory;
|
||||
|
||||
@ -368,14 +369,15 @@ HRESULT CPPTXFile::ConvertPPTYToPPTX(std::wstring bsInput, std::wstring bsOutput
|
||||
oWriter.OpenPPTY(pSrcBuffer, lFileSize, srcFolder, bsThemesFolder);
|
||||
|
||||
RELEASEARRAYOBJECTS(pSrcBuffer);
|
||||
HRESULT hRes = S_OK;
|
||||
|
||||
_UINT32 hRes = 0;
|
||||
|
||||
if (m_fCallbackCompress)
|
||||
{
|
||||
std::wstring strOutput = bsOutput;
|
||||
std::wstring strInput = pathLocalTempDirectory.GetPath();
|
||||
|
||||
hRes = m_fCallbackCompress(m_pCallbackArg, strInput, strOutput) ? S_OK : S_FALSE;
|
||||
hRes = m_fCallbackCompress(m_pCallbackArg, strInput, strOutput) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
|
||||
NSDirectory::DeleteDirectory(strInput);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user