mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Compare commits
18 Commits
v5.2.0.135
...
v5.2.0.188
| Author | SHA1 | Date | |
|---|---|---|---|
| dd40e3e53c | |||
| d657ece017 | |||
| b21b1b8aaf | |||
| 09fb980060 | |||
| 274c000ce7 | |||
| 9e6dd1fbb1 | |||
| de51052f6a | |||
| 2c8efcb183 | |||
| 9c2a717870 | |||
| 185dc3064f | |||
| c6f8a1cde8 | |||
| 3fb166f99a | |||
| fb34d57ee6 | |||
| da2d997838 | |||
| 76d68fa70f | |||
| b59908e4c2 | |||
| 04e6b642f4 | |||
| c9ddd5b7b5 |
@ -58,7 +58,8 @@ namespace DocFileFormat
|
||||
}
|
||||
else
|
||||
{
|
||||
short cch = reader->ReadInt16();
|
||||
short cch = reader->ReadInt16();
|
||||
|
||||
|
||||
unsigned char *chars = reader->ReadBytes(18, true);
|
||||
|
||||
@ -67,13 +68,34 @@ namespace DocFileFormat
|
||||
newObject->m_AuthorIndex = reader->ReadUInt16();
|
||||
|
||||
//skip 4 bytes
|
||||
reader->ReadBytes(4, false);
|
||||
unsigned int skip = reader->ReadUInt32();
|
||||
|
||||
newObject->m_BookmarkId = reader->ReadInt32();
|
||||
newObject->m_BookmarkId = reader->ReadInt32(); //-1 - comment is on a length zero text range in the Main Document
|
||||
RELEASEARRAYOBJECTS(chars);
|
||||
}
|
||||
|
||||
|
||||
return static_cast<ByteStructure*>(newObject);
|
||||
}
|
||||
ByteStructure* AnnotationReferenceExDescriptor::ConstructObject(VirtualStreamReader* reader, int length)
|
||||
{
|
||||
AnnotationReferenceExDescriptor *newObject = new AnnotationReferenceExDescriptor();
|
||||
|
||||
if (reader->nWordVersion > 0)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
m_nDTTM = reader->ReadUInt32();
|
||||
reader->ReadUInt16(); //padding1
|
||||
m_nDepth = reader->ReadUInt32();
|
||||
m_nDiatrdParent = reader->ReadUInt32();
|
||||
unsigned int flag = reader->ReadUInt32();
|
||||
m_fInkAtn = GETBIT(flag, 1);
|
||||
}
|
||||
|
||||
|
||||
return static_cast<ByteStructure*>(newObject);
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,21 +46,6 @@ namespace DocFileFormat
|
||||
return (nWordVersion > 0) ? STRUCTURE_SIZE_OLD : STRUCTURE_SIZE;
|
||||
}
|
||||
|
||||
inline std::wstring GetUserInitials() const
|
||||
{
|
||||
return m_UserInitials;
|
||||
}
|
||||
|
||||
inline unsigned short GetAuthorIndex() const
|
||||
{
|
||||
return m_AuthorIndex;
|
||||
}
|
||||
|
||||
inline int GetBookmarkId() const
|
||||
{
|
||||
return m_BookmarkId;
|
||||
}
|
||||
|
||||
AnnotationReferenceDescriptor() : m_AuthorIndex(0), m_BookmarkId(0)
|
||||
{
|
||||
}
|
||||
@ -71,13 +56,35 @@ namespace DocFileFormat
|
||||
|
||||
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length );
|
||||
|
||||
private:
|
||||
|
||||
/// The initials of the user who left the annotation.
|
||||
std::wstring m_UserInitials;
|
||||
/// An index into the string table of comment author names.
|
||||
unsigned short m_AuthorIndex;
|
||||
/// Identifies a bookmark.
|
||||
int m_BookmarkId;
|
||||
};
|
||||
|
||||
class AnnotationReferenceExDescriptor: public ByteStructure
|
||||
{
|
||||
public:
|
||||
static const int STRUCTURE_SIZE = 18;
|
||||
static const int STRUCTURE_SIZE_OLD = 0;
|
||||
|
||||
static const int GetSize(int nWordVersion)
|
||||
{
|
||||
return (nWordVersion > 0) ? STRUCTURE_SIZE_OLD : STRUCTURE_SIZE;
|
||||
}
|
||||
|
||||
AnnotationReferenceExDescriptor() : m_nDTTM(0), m_nDepth(0), m_nDiatrdParent(0), m_fInkAtn(false)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~AnnotationReferenceExDescriptor()
|
||||
{
|
||||
}
|
||||
|
||||
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length );
|
||||
|
||||
unsigned int m_nDTTM;
|
||||
unsigned int m_nDepth;
|
||||
unsigned int m_nDiatrdParent;
|
||||
bool m_fInkAtn;
|
||||
};
|
||||
}
|
||||
|
||||
@ -39,13 +39,8 @@ namespace DocFileFormat
|
||||
class BookmarkFirst: public ByteStructure
|
||||
{
|
||||
private:
|
||||
/// An unsigned integer that specifies a zero-based index into the PlcfBkl or PlcfBkld
|
||||
/// that is paired with the PlcfBkf or PlcfBkfd containing this FBKF.
|
||||
/// The entry found at said index specifies the location of the end of the bookmark associated with this FBKF.
|
||||
/// Ibkl MUST be unique for all FBKFs inside a given PlcfBkf or PlcfBkfd.
|
||||
short ibkl;
|
||||
/// A BKC that specifies further information about the bookmark associated with this FBKF.
|
||||
short bkc;
|
||||
short ibkl;
|
||||
short bkc;
|
||||
|
||||
public:
|
||||
static const int STRUCTURE_SIZE = 4;
|
||||
@ -78,4 +73,32 @@ namespace DocFileFormat
|
||||
return static_cast<ByteStructure*>( newObject );
|
||||
}
|
||||
};
|
||||
class AtnBookmarkFirst: public ByteStructure
|
||||
{
|
||||
public:
|
||||
unsigned short bmc;
|
||||
unsigned int lTag;
|
||||
|
||||
static const int STRUCTURE_SIZE = 10;
|
||||
|
||||
AtnBookmarkFirst()
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~AtnBookmarkFirst()
|
||||
{
|
||||
}
|
||||
|
||||
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length )
|
||||
{
|
||||
AtnBookmarkFirst *newObject = new AtnBookmarkFirst();
|
||||
|
||||
newObject->bmc = reader->ReadUInt16(); //0x0100
|
||||
newObject->lTag = reader->ReadUInt32();
|
||||
|
||||
unsigned int lTagOld = reader->ReadUInt32();
|
||||
|
||||
return static_cast<ByteStructure*>( newObject );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ namespace DocFileFormat
|
||||
convertSprms( dynamic_cast<CharacterPropertyExceptions*>( chpx )->grpprl, _rPr );
|
||||
|
||||
// apend revision changes
|
||||
if (_revisionData->Type == Changed)
|
||||
if ((_revisionData) && (_revisionData->Type == Changed))
|
||||
{
|
||||
XMLTools::XMLElement rPrChange( L"w:rPrChange");
|
||||
|
||||
|
||||
@ -52,8 +52,6 @@ namespace DocFileFormat
|
||||
{
|
||||
m_context->_docx->RegisterComments();
|
||||
|
||||
int index = 0;
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"?xml version=\"1.0\" encoding=\"UTF-8\"?");
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:comments", TRUE );
|
||||
|
||||
@ -63,33 +61,60 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:o", OpenXmlNamespaces::Office );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:w10", OpenXmlNamespaces::OfficeWord );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:r", OpenXmlNamespaces::Relationships );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wpc", L"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:cx", L"http://schemas.microsoft.com/office/drawing/2014/chartex" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:cx1", L"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:mc", L"http://schemas.openxmlformats.org/markup-compatibility/2006" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:m", L"http://schemas.openxmlformats.org/officeDocument/2006/math" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wp14", L"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:w14", L"http://schemas.microsoft.com/office/word/2010/wordml" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:w15", L"http://schemas.microsoft.com/office/word/2012/wordml" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:w16se", L"http://schemas.microsoft.com/office/word/2015/wordml/symex" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wpg", L"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wpi", L"http://schemas.microsoft.com/office/word/2010/wordprocessingInk" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wne", L"http://schemas.microsoft.com/office/word/2006/wordml" );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:wps", L"http://schemas.microsoft.com/office/word/2010/wordprocessingShape" );
|
||||
m_pXmlWriter->WriteAttribute( L"mc:Ignorable", L"w14 w15 w16se wp14");
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
int cp = m_document->FIB->m_RgLw97.ccpText + m_document->FIB->m_RgLw97.ccpFtn + m_document->FIB->m_RgLw97.ccpHdr;
|
||||
|
||||
size_t count = m_document->AnnotationsReferencePlex->Elements.size();
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
for (size_t index = 0; index < count; ++index)
|
||||
{
|
||||
AnnotationReferenceDescriptor* atrdPre10 = static_cast<AnnotationReferenceDescriptor*>(m_document->AnnotationsReferencePlex->Elements[index]);
|
||||
AnnotationReferenceExDescriptor* atrdPost10 = m_document->AnnotationsReferenceExPlex ? static_cast<AnnotationReferenceExDescriptor*>(m_document->AnnotationsReferenceExPlex->Elements[index]) : NULL;
|
||||
|
||||
unsigned short index_author = atrdPre10->GetAuthorIndex();
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:comment", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 ));
|
||||
if (index_author < m_document->AnnotationOwners->size()) //conv_253l2H1CehgKwsxCtNk__docx.doc
|
||||
if (atrdPre10->m_BookmarkId < 0)
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 + count + 1024 ));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 ));
|
||||
}
|
||||
if (atrdPost10)
|
||||
{
|
||||
//!!!TODO!!!
|
||||
/*//ATRDpost10 is optional and not saved in all files
|
||||
if (doc.AnnotationReferenceExtraTable != null &&
|
||||
doc.AnnotationReferenceExtraTable.Count > index)
|
||||
{
|
||||
AnnotationReferenceDescriptorExtra atrdPost10 = doc.AnnotationReferenceExtraTable[index];
|
||||
atrdPost10.Date.Convert(new DateMapping(_writer));
|
||||
}*/
|
||||
}
|
||||
if (atrdPre10->m_AuthorIndex < m_document->AnnotationOwners->size()) //conv_253l2H1CehgKwsxCtNk__docx.doc
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:author",
|
||||
FormatUtils::XmlEncode(m_document->AnnotationOwners->at( index_author ) ));
|
||||
FormatUtils::XmlEncode(m_document->AnnotationOwners->at( atrdPre10->m_AuthorIndex ) ));
|
||||
}
|
||||
m_pXmlWriter->WriteAttribute( L"w:initials", atrdPre10->GetUserInitials());
|
||||
m_pXmlWriter->WriteAttribute( L"w:initials", atrdPre10->m_UserInitials);
|
||||
|
||||
|
||||
//!!!TODO!!!
|
||||
/*//ATRDpost10 is optional and not saved in all files
|
||||
if (doc.AnnotationReferenceExtraTable != null &&
|
||||
doc.AnnotationReferenceExtraTable.Count > index)
|
||||
{
|
||||
AnnotationReferenceDescriptorExtra atrdPost10 = doc.AnnotationReferenceExtraTable[index];
|
||||
atrdPost10.Date.Convert(new DateMapping(_writer));
|
||||
}*/
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
@ -116,8 +141,6 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd(L"w:comment" );
|
||||
|
||||
++index;
|
||||
}
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"w:comments" );
|
||||
|
||||
@ -45,7 +45,7 @@ namespace DocFileFormat
|
||||
{
|
||||
DocumentMapping::DocumentMapping(ConversionContext* context, IMapping* caller) : _skipRuns(0), _lastValidPapx(NULL), _lastValidSepx(NULL),
|
||||
AbstractOpenXmlMapping( new XMLTools::CStringXmlWriter() ), _sectionNr(0), _footnoteNr(0),
|
||||
_endnoteNr(0), _commentNr(0), _caller(caller)
|
||||
_endnoteNr(0), _commentNr(1), _caller(caller)
|
||||
{
|
||||
m_document = NULL;
|
||||
m_context = context;
|
||||
@ -506,7 +506,7 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
//write text
|
||||
for (unsigned int i = 0; i < chars->size(); ++i)
|
||||
for (size_t i = 0; i < chars->size(); ++i)
|
||||
{
|
||||
wchar_t c = chars->at(i), code = c;
|
||||
|
||||
@ -526,7 +526,20 @@ namespace DocFileFormat
|
||||
|
||||
text.clear();
|
||||
|
||||
XMLTools::XMLElement elem(L"w:br");
|
||||
if (textType == L"instrText")
|
||||
{
|
||||
m_pXmlWriter->WriteNodeEnd(L"w:r");
|
||||
m_pXmlWriter->WriteNodeBegin(L"w:r");
|
||||
CharacterPropertiesMapping* rPr = new CharacterPropertiesMapping(m_pXmlWriter, m_document, NULL, _lastValidPapx, false);
|
||||
if (rPr)
|
||||
{
|
||||
rPr->_webHidden = _writeWebHidden;
|
||||
|
||||
chpx->Convert(rPr);
|
||||
RELEASEOBJECT(rPr);
|
||||
}
|
||||
}
|
||||
XMLTools::XMLElement elem(L"w:br");
|
||||
elem.AppendAttribute(L"w:type", L"textWrapping");
|
||||
elem.AppendAttribute(L"w:clear", L"all");
|
||||
|
||||
@ -1013,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 );
|
||||
}
|
||||
@ -1024,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 );
|
||||
}
|
||||
@ -1041,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 );
|
||||
}
|
||||
}
|
||||
@ -1196,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;
|
||||
};
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ namespace DocFileFormat
|
||||
drawing.dgglbl = (DrawingType)oStearmReader.ReadByte();
|
||||
drawing.container = static_cast<DrawingContainer*>(RecordFactory::ReadRecord (&oStearmReader, 0));
|
||||
|
||||
for (unsigned int i = 0; i < drawing.container->Children.size(); ++i)
|
||||
for (size_t i = 0; i < drawing.container->Children.size(); ++i)
|
||||
{
|
||||
Record* groupChild = drawing.container->Children[i];
|
||||
if (groupChild)
|
||||
@ -140,7 +140,7 @@ namespace DocFileFormat
|
||||
GroupContainer* group = iter->container->FirstChildWithType<GroupContainer>();
|
||||
if (group)
|
||||
{
|
||||
for (unsigned int i = 1; i < group->Children.size(); ++i)
|
||||
for (size_t i = 1; i < group->Children.size(); ++i)
|
||||
{
|
||||
Record* groupChild = group->Children[i];
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -85,7 +85,7 @@ namespace DocFileFormat
|
||||
IndividualFootnotesPlex(NULL), FootnoteReferenceCharactersPlex(NULL), IndividualEndnotesPlex(NULL),
|
||||
EndnoteReferenceCharactersPlex(NULL), FieldsPlex(NULL), FootnoteDocumentFieldsPlex(NULL),
|
||||
EndnoteDocumentFieldsPlex(NULL), HeadersAndFootersDocumentFieldsPlex(NULL), HeaderStoriesPlex(NULL),
|
||||
AnnotationsReferencePlex(NULL), IndividualCommentsPlex(NULL), TextboxBreakPlex(NULL), TextboxBreakPlexHeader(NULL),
|
||||
AnnotationsReferencePlex(NULL), AnnotationsReferenceExPlex(NULL), IndividualCommentsPlex(NULL), TextboxBreakPlex(NULL), TextboxBreakPlexHeader(NULL),
|
||||
TextboxIndividualPlex(NULL),AssocNames(NULL), BookmarkAnnotNames(NULL), Captions(NULL), AutoCaptions(NULL), ListPlex(NULL),
|
||||
OfficeDrawingPlex(NULL), OfficeDrawingPlexHeader(NULL), SectionPlex(NULL), BookmarkStartPlex(NULL), BookmarkEndPlex(NULL),
|
||||
AutoTextPlex(NULL), AllPapxFkps(NULL), AllChpxFkps(NULL), AllPapx(NULL), AllPapxVector(NULL), AllSepx(NULL), Styles(NULL), listTable(NULL),
|
||||
@ -318,8 +318,8 @@ namespace DocFileFormat
|
||||
// Read all needed PLCFs
|
||||
if (FIB->m_RgLw97.ccpFtn > 0)
|
||||
{
|
||||
IndividualFootnotesPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcffndTxt, FIB->m_FibWord97.lcbPlcffndTxt, nWordVersion);
|
||||
FootnoteReferenceCharactersPlex = new Plex<FootnoteDescriptor>(FootnoteDescriptor::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcffndRef, FIB->m_FibWord97.lcbPlcffndRef, nWordVersion);
|
||||
IndividualFootnotesPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcffndTxt, FIB->m_FibWord97.lcbPlcffndTxt, nWordVersion);
|
||||
}
|
||||
|
||||
if (nWordVersion > 0 && FIB->m_FibWord97.lcbPlcPad > 0)
|
||||
@ -329,8 +329,8 @@ namespace DocFileFormat
|
||||
|
||||
if (FIB->m_RgLw97.ccpEdn > 0)
|
||||
{
|
||||
IndividualEndnotesPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfendTxt, FIB->m_FibWord97.lcbPlcfendTxt, nWordVersion);
|
||||
EndnoteReferenceCharactersPlex = new Plex<EndnoteDescriptor>(EndnoteDescriptor::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfendRef, FIB->m_FibWord97.lcbPlcfendRef, nWordVersion);
|
||||
IndividualEndnotesPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfendTxt, FIB->m_FibWord97.lcbPlcfendTxt, nWordVersion);
|
||||
}
|
||||
|
||||
if (FIB->m_RgLw97.ccpHdr > 0)
|
||||
@ -343,6 +343,11 @@ namespace DocFileFormat
|
||||
AnnotationsReferencePlex = new Plex<AnnotationReferenceDescriptor>(AnnotationReferenceDescriptor::GetSize(nWordVersion), TableStream, FIB->m_FibWord97.fcPlcfandRef, FIB->m_FibWord97.lcbPlcfandRef, nWordVersion);
|
||||
IndividualCommentsPlex = new Plex<EmptyStructure> (EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfandTxt, FIB->m_FibWord97.lcbPlcfandTxt, nWordVersion);
|
||||
}
|
||||
|
||||
if (FIB->m_FibWord2002.lcbAtrdExtra > 0)
|
||||
{
|
||||
AnnotationsReferenceExPlex = new Plex<AnnotationReferenceExDescriptor>(AnnotationReferenceExDescriptor::GetSize(nWordVersion), TableStream, FIB->m_FibWord2002.fcAtrdExtra, FIB->m_FibWord2002.lcbAtrdExtra, nWordVersion);
|
||||
}
|
||||
OfficeDrawingPlex = new Plex<Spa> (Spa::GetSize(nWordVersion), TableStream, FIB->m_FibWord97.fcPlcSpaMom, FIB->m_FibWord97.lcbPlcSpaMom, nWordVersion);
|
||||
OfficeDrawingPlexHeader = new Plex<Spa> (Spa::GetSize(nWordVersion), TableStream, FIB->m_FibWord97.fcPlcSpaHdr, FIB->m_FibWord97.lcbPlcSpaHdr, nWordVersion);
|
||||
|
||||
@ -356,7 +361,7 @@ namespace DocFileFormat
|
||||
TextboxBreakPlex = new Plex<Tbkd> (Tbkd::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfTxbxBkd, FIB->m_FibWord97.lcbPlcfTxbxBkd, nWordVersion);
|
||||
TextboxBreakPlexHeader = new Plex<Tbkd> (Tbkd::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfTxbxHdrBkd, FIB->m_FibWord97.lcbPlcfTxbxHdrBkd, nWordVersion);
|
||||
|
||||
AnnotStartPlex = new Plex<BookmarkFirst> (BookmarkFirst::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfAtnBkf, FIB->m_FibWord97.lcbPlcfAtnBkf, nWordVersion);
|
||||
AnnotStartPlex = new Plex<BookmarkFirst> (BookmarkFirst::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfAtnBkf, FIB->m_FibWord97.lcbPlcfAtnBkf, nWordVersion);
|
||||
AnnotEndPlex = new Plex<EmptyStructure> (EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfAtnBkl, FIB->m_FibWord97.lcbPlcfAtnBkl, nWordVersion);
|
||||
|
||||
|
||||
@ -368,18 +373,19 @@ namespace DocFileFormat
|
||||
BookmarkStartEndCPs.push_back(std::make_pair(BookmarkStartPlex->CharacterPositions[i], BookmarkEndPlex->CharacterPositions[pBookmark->GetIndex()]));
|
||||
}
|
||||
}
|
||||
for (size_t i = 0; i < AnnotStartPlex->Elements.size(); ++i)
|
||||
for (size_t i = 0; AnnotStartPlex && i < AnnotStartPlex->Elements.size(); ++i)
|
||||
{
|
||||
BookmarkFirst* pBookmark = static_cast<BookmarkFirst*>(AnnotStartPlex->Elements[i]);
|
||||
BookmarkFirst* pBookmark = static_cast<BookmarkFirst*>(AnnotStartPlex->Elements[i]);
|
||||
if (pBookmark)
|
||||
{
|
||||
short end = pBookmark->GetIndex();
|
||||
if (i < AnnotStartPlex->CharacterPositions.size() && end < AnnotEndPlex->CharacterPositions.size())
|
||||
short ind = pBookmark->GetIndex();
|
||||
if (i < AnnotStartPlex->CharacterPositions.size() -1 )
|
||||
{
|
||||
AnnotStartEndCPs.push_back(std::make_pair(AnnotStartPlex->CharacterPositions[i], AnnotEndPlex->CharacterPositions[end]));
|
||||
AnnotStartEndCPs.push_back(std::make_pair(AnnotStartPlex->CharacterPositions[i], AnnotEndPlex->CharacterPositions[i + 1]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AutoTextPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfGlsy, FIB->m_FibWord97.lcbPlcfGlsy, nWordVersion);
|
||||
FieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldMom, FIB->m_FibWord97.lcbPlcfFldMom, nWordVersion);
|
||||
FootnoteDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldFtn, FIB->m_FibWord97.lcbPlcfFldFtn, nWordVersion);
|
||||
@ -435,7 +441,7 @@ namespace DocFileFormat
|
||||
std::unordered_map<int, int> fonts_charsets;
|
||||
bool bFontsCodePage = false;
|
||||
|
||||
for ( size_t i = 0; !bFontsCodePage && i < FontTable->Data.size(); ++i)
|
||||
for ( size_t i = 0; FIB->m_FibWord97.lcbClx > 0 && !bFontsCodePage && i < FontTable->Data.size(); ++i)
|
||||
{
|
||||
FontFamilyName* font = dynamic_cast<FontFamilyName*>( FontTable->Data[i]);
|
||||
if (!font) continue;
|
||||
@ -488,13 +494,13 @@ namespace DocFileFormat
|
||||
|
||||
if (BookmarkNames)
|
||||
{
|
||||
for (unsigned int i = 0; i < BookmarkStartEndCPs.size(); ++i)
|
||||
for (size_t i = 0; i < BookmarkStartEndCPs.size(); ++i)
|
||||
{
|
||||
WideString* bookmarkName = static_cast<WideString*>(BookmarkNames->operator[]( i ));
|
||||
|
||||
if ( ( bookmarkName != NULL ) && ( *bookmarkName == L"_PictureBullets" ) )
|
||||
{
|
||||
for (unsigned int j = BookmarkStartEndCPs[i].first, k = 0; j < Text->size(); ++j, ++k )
|
||||
for (size_t j = BookmarkStartEndCPs[i].first, k = 0; j < Text->size(); ++j, ++k )
|
||||
{
|
||||
if ( Text->at( j ) == 1 )
|
||||
{
|
||||
@ -540,7 +546,7 @@ namespace DocFileFormat
|
||||
{
|
||||
AllSepx = new std::map<int, SectionPropertyExceptions*>();
|
||||
|
||||
for (unsigned int i = 0; i < SectionPlex->Elements.size(); ++i)
|
||||
for (size_t i = 0; i < SectionPlex->Elements.size(); ++i)
|
||||
{
|
||||
//Read the SED
|
||||
SectionDescriptor* sed = static_cast<SectionDescriptor*>(SectionPlex->Elements.at(i));
|
||||
@ -869,6 +875,7 @@ namespace DocFileFormat
|
||||
RELEASEOBJECT(HeaderStoriesPlex);
|
||||
RELEASEOBJECT(IndividualCommentsPlex);
|
||||
RELEASEOBJECT(AnnotationsReferencePlex);
|
||||
RELEASEOBJECT(AnnotationsReferenceExPlex);
|
||||
RELEASEOBJECT(TextboxBreakPlex);
|
||||
RELEASEOBJECT(TextboxBreakPlexHeader);
|
||||
RELEASEOBJECT(OfficeDrawingPlex);
|
||||
|
||||
@ -224,6 +224,7 @@ namespace DocFileFormat
|
||||
Plex<FieldCharacter> *EndnoteDocumentFieldsPlex;
|
||||
Plex<FieldCharacter> *HeadersAndFootersDocumentFieldsPlex;
|
||||
Plex<AnnotationReferenceDescriptor> *AnnotationsReferencePlex;
|
||||
Plex<AnnotationReferenceExDescriptor> *AnnotationsReferenceExPlex;
|
||||
Plex<EmptyStructure> *AutoTextPlex;
|
||||
// Each character position specifies the beginning of a range of text that constitutes the contents of an AutoText item
|
||||
|
||||
|
||||
@ -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)
|
||||
{
|
||||
@ -631,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();
|
||||
@ -1046,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++)
|
||||
@ -1352,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;
|
||||
}
|
||||
@ -1942,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;
|
||||
@ -2114,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>";
|
||||
|
||||
@ -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_;
|
||||
@ -1045,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_;
|
||||
@ -1059,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_;// цепочки переименований нумераций
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -70,7 +70,7 @@ static const _sh_typ Shape_Types_Mapping[] = // index === OOX::Drawing::EShapeTy
|
||||
{ L"mso-spt50" , 7}, // shapetypeBorderCallout2,
|
||||
{ L"mso-spt51" , 7}, // shapetypeBorderCallout3,
|
||||
{ L"brace-pair" , 7}, // shapetypeBracePair,
|
||||
{ L"bracket-pair" , 7}, // shapetypeBracketPair,
|
||||
{ L"" , 7}, // shapetypeBracketPair,
|
||||
{ L"mso-spt41" , 7}, // shapetypeCallout1,
|
||||
{ L"mso-spt42" , 7}, // shapetypeCallout2,
|
||||
{ L"mso-spt43" , 7}, // shapetypeCallout3,
|
||||
@ -156,7 +156,7 @@ static const _sh_typ Shape_Types_Mapping[] = // index === OOX::Drawing::EShapeTy
|
||||
{ L"left-right-arrow-callout" , 7}, // shapetypeLeftRightArrowCallout,
|
||||
{ L"" , 7}, // shapetypeLeftRightCircularArrow,
|
||||
{ L"" , 7}, // shapetypeLeftRightRibbon,
|
||||
{ L"mso-spt182" , 7}, // shapetypeLeftRightUpArrow,
|
||||
{ L"" , 7}, // shapetypeLeftRightUpArrow,
|
||||
{ L"" , 7}, // shapetypeLeftUpArrow,
|
||||
{ L"lightning" , 7}, // shapetypeLightningBolt,
|
||||
{ L"" , 5}, // shapetypeLine,
|
||||
|
||||
@ -893,6 +893,61 @@ public:
|
||||
handles.push_back(h2);
|
||||
}
|
||||
};
|
||||
class oox_shape_leftRightUpArrow : public oox_shape
|
||||
{
|
||||
public:
|
||||
oox_shape_leftRightUpArrow()
|
||||
{
|
||||
odf_type_name = L"ooxml-leftRightUpArrow";
|
||||
|
||||
enhanced_path = L"M 0 ?f18 L ?f7 ?f17 ?f7 ?f19 ?f13 ?f19 ?f13 ?f7 ?f10 ?f7 ?f9 0 ?f11 ?f7 ?f14 ?f7 ?f14 ?f19 ?f15 ?f19 ?f15 ?f17 ?f23 ?f18 ?f15 ?f24 ?f15 ?f20 ?f7 ?f20 ?f7 ?f24 Z N";
|
||||
text_areas = L"?f21 ?f19 ?f22 ?f20";
|
||||
modifiers = L"9928 10359 14667";
|
||||
view_box = L"0 0 0 0";
|
||||
|
||||
add(L"f0", L"if(0-$1 ,0,if(50000-$1 ,$1 ,50000))");
|
||||
add(L"f1", L"?f0 *2/1");
|
||||
add(L"f2", L"if(0-$0 ,0,if(?f1 -$0 ,$0 ,?f1 ))");
|
||||
add(L"f3", L"100000+0-?f1 ");
|
||||
add(L"f4", L"?f3 *1/2");
|
||||
add(L"f5", L"if(0-$2 ,0,if(?f4 -$2 ,$2 ,?f4 ))");
|
||||
add(L"f6", L"min(logwidth,logheight)");
|
||||
add(L"f7", L"?f6 *?f5 /100000");
|
||||
add(L"f8", L"?f6 *?f0 /100000");
|
||||
add(L"f9", L"logwidth/2");
|
||||
add(L"f10", L"?f9 +0-?f8 ");
|
||||
add(L"f11", L"?f9 +?f8 -0");
|
||||
add(L"f12", L"?f6 *?f2 /200000");
|
||||
add(L"f13", L"?f9 +0-?f12 ");
|
||||
add(L"f14", L"?f9 +?f12 -0");
|
||||
add(L"f15", L"logwidth+0-?f7 ");
|
||||
add(L"f16", L"?f6 *?f0 /50000");
|
||||
add(L"f17", L"logheight+0-?f16 ");
|
||||
add(L"f18", L"logheight+0-?f8 ");
|
||||
add(L"f19", L"?f18 +0-?f12 ");
|
||||
add(L"f20", L"?f18 +?f12 -0");
|
||||
add(L"f21", L"?f12 *?f7 /?f8 ");
|
||||
add(L"f22", L"logwidth+0-?f21 ");
|
||||
add(L"f23", L"logwidth");
|
||||
add(L"f24", L"logheight");
|
||||
/////////////////////////////////////////////////////////
|
||||
_handle h1, h2, h3;
|
||||
h1.position = L"?f13 ?f7";
|
||||
h1.x_minimum = L"0";
|
||||
h1.x_maximum = L"?f1";
|
||||
handles.push_back(h1);
|
||||
|
||||
h2.position = L"?f10 0";
|
||||
h2.x_minimum = L"0";
|
||||
h2.x_maximum = L"50000";
|
||||
handles.push_back(h2);
|
||||
|
||||
h3.position = L"?f23 ?f7";
|
||||
h3.y_minimum = L"0";
|
||||
h3.y_maximum = L"?f4";
|
||||
handles.push_back(h3);
|
||||
}
|
||||
};
|
||||
class oox_shape_NotchedRightArrow : public oox_shape
|
||||
{
|
||||
public:
|
||||
|
||||
@ -273,6 +273,65 @@ public:
|
||||
/////////////////////////////////////////////////////////
|
||||
}
|
||||
};
|
||||
class oox_shape_Wave : public oox_shape
|
||||
{
|
||||
public:
|
||||
oox_shape_Wave()
|
||||
{
|
||||
odf_type_name =L"ooxml-wave";
|
||||
|
||||
modifiers = L"12500 0";
|
||||
enhanced_path = L"M ?f13 ?f2 C ?f17 ?f4 ?f18 ?f5 ?f15 ?f2 L ?f20 ?f6 C ?f22 ?f8 ?f21 ?f7 ?f19 ?f6 Z N";
|
||||
text_areas = L"?f27 ?f29 ?f28 ?f30";
|
||||
glue_points = L"?f35 ?f10 ?f19 ?f6 ?f28 ?f14 ?f38 ?f6";
|
||||
view_box = L"0 0 0 0";
|
||||
|
||||
add(L"f0", L"if(0-$0 ,0,if(20000-$0 ,$0 ,20000))");
|
||||
add(L"f1", L"if(-10000-$1 ,-10000,if(10000-$1 ,$1 ,10000))");
|
||||
add(L"f2", L"logheight*?f0 /100000");
|
||||
add(L"f3", L"?f2 *10/3");
|
||||
add(L"f4", L"?f2 +0-?f3 ");
|
||||
add(L"f5", L"?f2 +?f3 -0");
|
||||
add(L"f6", L"logheight+0-?f2 ");
|
||||
add(L"f7", L"?f6 +0-?f3 ");
|
||||
add(L"f8", L"?f6 +?f3 -0");
|
||||
add(L"f9", L"logwidth*?f1 /100000");
|
||||
add(L"f10", L"logwidth*?f1 /50000");
|
||||
add(L"f11", L"abs(?f9 )");
|
||||
add(L"f12", L"if(?f10 ,0,?f10 )");
|
||||
add(L"f13", L"0+0-?f12 ");
|
||||
add(L"f14", L"if(?f10 ,?f10 ,0)");
|
||||
add(L"f15", L"logwidth+0-?f14 ");
|
||||
add(L"f16", L"(?f12 +?f15 )/3");
|
||||
add(L"f17", L"?f13 +?f16 -0");
|
||||
add(L"f18", L"(?f17 +?f15 )/2");
|
||||
add(L"f19", L"0+?f14 -0");
|
||||
add(L"f20", L"logwidth+?f12 -0");
|
||||
add(L"f21", L"?f19 +?f16 -0");
|
||||
add(L"f22", L"(?f21 +?f20 )/2");
|
||||
add(L"f23", L"logwidth+0-?f11");
|
||||
add(L"f24", L"logwidth/2");
|
||||
add(L"f25", L"?f24 +?f9 -0");
|
||||
add(L"f26", L"?f24 +0-?f9 ");
|
||||
add(L"f27", L"max(?f13 ,?f19 )");
|
||||
add(L"f28", L"min(?f15 ,?f20 )");
|
||||
add(L"f29", L"logheight*?f0 /50000");
|
||||
add(L"f30", L"logheight+0-?f29 ");
|
||||
add(L"f31", L"logheight");
|
||||
add(L"f32", L"logheight/2");
|
||||
/////////////////////////////////////////////////////////
|
||||
_handle h1, h2;
|
||||
h1.position = L"0 ?f2";
|
||||
h1.y_maximum= L"20000";
|
||||
h1.y_minimum= L"0";
|
||||
handles.push_back(h1);
|
||||
|
||||
h2.position = L"?f25 ?f31";
|
||||
h2.x_maximum= L"10000";
|
||||
h2.x_minimum= L"-10000";
|
||||
handles.push_back(h2);
|
||||
}
|
||||
};
|
||||
class oox_shape_DoubleWave : public oox_shape
|
||||
{
|
||||
public:
|
||||
@ -995,8 +1054,6 @@ public:
|
||||
handles.push_back(h2);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class oox_shape_Chord : public oox_shape
|
||||
{
|
||||
public:
|
||||
@ -1482,4 +1539,55 @@ public:
|
||||
h.x_maximum = L"50000";
|
||||
handles.push_back(h);
|
||||
}
|
||||
};}
|
||||
};
|
||||
class oox_shape_bracketPair : public oox_shape
|
||||
{
|
||||
public:
|
||||
oox_shape_bracketPair()
|
||||
{
|
||||
odf_type_name =L"ooxml-bracketPair";
|
||||
|
||||
//enhanced_path = L"M 0 ?f2 L ?f3 0 L ?f11 ?f4 L ?f2 ?f10 Z S N M ?f2 ?f10 L 0 ?f2 M ?f3 0 L ?f11 ?f4 F N";
|
||||
enhanced_path = L"M 0 ?f2 G ?f2 ?f2 ?f12 ?f13 L ?f3 0 G ?f2 ?f2 ?f14 ?f15 L ?f11 ?f4 G ?f2 ?f2 ?f16 ?f17 L ?f2 ?f10 G ?f2 ?f2 ?f18 ?f19 Z S N M ?f2 ?f10 G ?f2 ?f2 ?f20 ?f21 L 0 ?f2 G ?f2 ?f2 ?f22 ?f23 M ?f3 0 G ?f2 ?f2 ?f24 ?f25 L ?f11 ?f4 G ?f2 ?f2 ?f26 ?f27 F N";
|
||||
text_areas = L"?f5 ?f5 ?f6 ?f7";
|
||||
view_box = L"0 0 0 0";
|
||||
modifiers = L"23051";
|
||||
|
||||
add(L"f0", L"if(0-$0 ,0,if(50000-$0 ,$0 ,50000))");
|
||||
add(L"f1", L"min(logwidth,logheight)");
|
||||
add(L"f2", L"?f1 *?f0 /100000");
|
||||
add(L"f3", L"logwidth+0-?f2 ");
|
||||
add(L"f4", L"logheight+0-?f2 ");
|
||||
add(L"f5", L"?f2 *29289/100000");
|
||||
add(L"f6", L"logwidth+0-?f5 ");
|
||||
add(L"f7", L"logheight+0-?f5 ");
|
||||
add(L"f8", L"logwidth/2");
|
||||
add(L"f9", L"logheight/2");
|
||||
add(L"f10", L"logheight");
|
||||
add(L"f11", L"logwidth");
|
||||
add(L"f12", L"(10800000)/60000.0");
|
||||
add(L"f13", L"(5400000)/60000.0");
|
||||
add(L"f14", L"(16200000)/60000.0");
|
||||
add(L"f15", L"(5400000)/60000.0");
|
||||
add(L"f16", L"(0)/60000.0");
|
||||
add(L"f17", L"(5400000)/60000.0");
|
||||
add(L"f18", L"(5400000)/60000.0");
|
||||
add(L"f19", L"(5400000)/60000.0");
|
||||
add(L"f20", L"(5400000)/60000.0");
|
||||
add(L"f21", L"(5400000)/60000.0");
|
||||
add(L"f22", L"(10800000)/60000.0");
|
||||
add(L"f23", L"(5400000)/60000.0");
|
||||
add(L"f24", L"(16200000)/60000.0");
|
||||
add(L"f25", L"(5400000)/60000.0");
|
||||
add(L"f26", L"(0)/60000.0");
|
||||
add(L"f27", L"(5400000)/60000.0");
|
||||
/////////////////////////////////////////////////////////
|
||||
_handle h1;
|
||||
|
||||
h1.position = L"0 ?f2";
|
||||
h1.y_minimum = L"0";
|
||||
h1.y_maximum = L"50000";
|
||||
handles.push_back(h1);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -1100,6 +1100,7 @@ bool odf_drawing_context::isLineShape()
|
||||
case 48: //SimpleTypes::shapetypeCurvedConnector3:
|
||||
case 49: //SimpleTypes::shapetypeCurvedConnector4:
|
||||
case 50: //SimpleTypes::shapetypeCurvedConnector5:
|
||||
case 31: //SimpleTypes::shapetypeBracketPair
|
||||
return true;
|
||||
case 1000:
|
||||
if (impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_.get_value_or(draw_fill(draw_fill::solid)).get_type() == draw_fill::none)
|
||||
@ -1177,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;
|
||||
}
|
||||
@ -1185,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);
|
||||
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -123,15 +123,18 @@ oox_shape_ptr oox_shape::create(int ooxPrstGeomType)
|
||||
case SimpleTypes::shapetypePie: return boost::make_shared<oox_shape_Pie>();
|
||||
case SimpleTypes::shapetypeDonut: return boost::make_shared<oox_shape_Donut>();
|
||||
case SimpleTypes::shapetypeLeftRightRibbon: return boost::make_shared<oox_shape_LeftRightRibbon>();
|
||||
case SimpleTypes::shapetypeWave: return boost::make_shared<oox_shape_Wave>();
|
||||
case SimpleTypes::shapetypeBracketPair: return boost::make_shared<oox_shape_bracketPair>();
|
||||
|
||||
case SimpleTypes::shapetypeFlowChartExtract: return boost::make_shared<oox_shape_FlowChartExtract>();
|
||||
|
||||
case SimpleTypes::shapetypeLeftArrowCallout: return boost::make_shared<oox_shape_LeftArrowCallout>();
|
||||
case SimpleTypes::shapetypeRightArrowCallout: return boost::make_shared<oox_shape_RightArrowCallout>();
|
||||
case SimpleTypes::shapetypeUpArrowCallout: return boost::make_shared<oox_shape_UpArrowCallout>();
|
||||
case SimpleTypes::shapetypeDownArrowCallout: return boost::make_shared<oox_shape_DownArrowCallout>();
|
||||
case SimpleTypes::shapetypeDownArrowCallout: return boost::make_shared<oox_shape_DownArrowCallout>();
|
||||
|
||||
case SimpleTypes::shapetypeBentUpArrow: return boost::make_shared<oox_shape_BentUpArrow>();
|
||||
case SimpleTypes::shapetypeLeftRightUpArrow: return boost::make_shared<oox_shape_leftRightUpArrow>();
|
||||
|
||||
//case (2001 + SimpleTypes::textshapetypeTextArchDown):
|
||||
//case (2001 + SimpleTypes::textshapetypeTextArchDownPour):
|
||||
|
||||
@ -1301,7 +1301,7 @@ void OoxConverter::convert(PPTX::Logic::BodyPr *oox_bodyPr)
|
||||
}
|
||||
}
|
||||
|
||||
if (oox_bodyPr->fromWordArt.IsInit() && oox_bodyPr->prstTxWarp.IsInit())
|
||||
if ((oox_bodyPr->fromWordArt.IsInit() && (*oox_bodyPr->fromWordArt)) && oox_bodyPr->prstTxWarp.IsInit())
|
||||
{
|
||||
for (size_t i = 0; i < oox_bodyPr->prstTxWarp->avLst.size(); i++)
|
||||
{
|
||||
@ -1807,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();
|
||||
}
|
||||
@ -1816,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);
|
||||
|
||||
@ -1410,6 +1410,11 @@ void DocxConverter::convert( ComplexTypes::Word::CShading* shading, _CP_OPT(odf_
|
||||
|
||||
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)
|
||||
{
|
||||
@ -2240,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;
|
||||
}
|
||||
}
|
||||
@ -4402,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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -218,9 +218,11 @@ namespace NSBinPptxRW
|
||||
}
|
||||
|
||||
std::wstring strExts = _T(".jpg");
|
||||
int nIndexExt = (int)strInput.rfind(wchar_t('.'));
|
||||
//use GetFileName to avoid defining '.' in the directory as extension
|
||||
std::wstring strFileName = NSFile::GetFileName(strInput);
|
||||
int nIndexExt = (int)strFileName.rfind(wchar_t('.'));
|
||||
if (-1 != nIndexExt)
|
||||
strExts = strInput.substr(nIndexExt);
|
||||
strExts = strFileName.substr(nIndexExt);
|
||||
|
||||
int typeAdditional = 0;
|
||||
std::wstring strAdditional;
|
||||
|
||||
@ -64,6 +64,7 @@ namespace OOX
|
||||
m_mTable.insert( std::make_pair( _T("emf"), _T("image/x-emf")));
|
||||
m_mTable.insert( std::make_pair( _T("emz"), _T("image/x-emz")));
|
||||
m_mTable.insert( std::make_pair( _T("wmf"), _T("image/x-wmf")));
|
||||
m_mTable.insert( std::make_pair( _T("svg"), _T("image/svg+xml")));
|
||||
m_mTable.insert( std::make_pair( _T("svm"), _T("image/svm")));
|
||||
m_mTable.insert( std::make_pair( _T("wav"), _T("audio/wav")));
|
||||
m_mTable.insert( std::make_pair( _T("wma"), _T("audio/x-wma")));
|
||||
|
||||
@ -102,3 +102,16 @@ void CFileDownloader::CheckSuspend()
|
||||
{
|
||||
return m_pInternal->CheckSuspend();
|
||||
}
|
||||
|
||||
#ifdef _MAC
|
||||
bool CFileDownloader::m_bIsARCEnabled = false;
|
||||
|
||||
void CFileDownloader::SetARCEnabled(const bool& enabled)
|
||||
{
|
||||
m_bIsARCEnabled = enabled;
|
||||
}
|
||||
bool CFileDownloader::GetARCEnabled()
|
||||
{
|
||||
return m_bIsARCEnabled;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -41,6 +41,10 @@ protected:
|
||||
// создаем в зависимости от платформы
|
||||
CFileDownloader_private* m_pInternal;
|
||||
|
||||
#ifdef _MAC
|
||||
static bool m_bIsARCEnabled;
|
||||
#endif
|
||||
|
||||
public:
|
||||
CFileDownloader(std::wstring sFileUrl, bool bDelete = true);
|
||||
virtual ~CFileDownloader();
|
||||
@ -63,4 +67,9 @@ public:
|
||||
int GetPriority();
|
||||
|
||||
void CheckSuspend();
|
||||
|
||||
#ifdef _MAC
|
||||
static void SetARCEnabled(const bool& enabled);
|
||||
static bool GetARCEnabled();
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
#include "FileDownloader_private.h"
|
||||
#include "FileDownloader.h"
|
||||
|
||||
#if _IOS
|
||||
#import <Foundation/Foundation.h>
|
||||
@ -27,12 +28,12 @@ public :
|
||||
}
|
||||
|
||||
virtual int DownloadFile()
|
||||
{
|
||||
{
|
||||
if (m_sFilePath.empty())
|
||||
{
|
||||
{
|
||||
m_sFilePath = NSFile::CFileBinary::CreateTempFileWithUniqueName(NSFile::CFileBinary::GetTempPath(), L"DWD");
|
||||
if (NSFile::CFileBinary::Exists(m_sFilePath))
|
||||
NSFile::CFileBinary::Remove(m_sFilePath);
|
||||
NSFile::CFileBinary::Remove(m_sFilePath);
|
||||
}
|
||||
|
||||
NSString* stringURL = StringWToNSString(m_sFileUrl);
|
||||
@ -50,9 +51,12 @@ public :
|
||||
return 0;
|
||||
#else
|
||||
#ifndef _ASC_USE_ARC_
|
||||
[stringURL release];
|
||||
[url release];
|
||||
[urlData release];
|
||||
if (!CFileDownloader::GetARCEnabled())
|
||||
{
|
||||
[stringURL release];
|
||||
[url release];
|
||||
[urlData release];
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return 0;
|
||||
@ -62,8 +66,11 @@ public :
|
||||
return 1;
|
||||
#else
|
||||
#ifndef _ASC_USE_ARC_
|
||||
[stringURL release];
|
||||
[url release];
|
||||
if (!CFileDownloader::GetARCEnabled())
|
||||
{
|
||||
[stringURL release];
|
||||
[url release];
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return 1;
|
||||
|
||||
@ -1 +1 @@
|
||||
2.4.546.0
|
||||
2.4.547.0
|
||||
|
||||
@ -937,7 +937,38 @@ namespace NSDoctRenderer
|
||||
CheckFileDir();
|
||||
NSDirectory::CreateDirectory(m_sFileDir + L"/changes");
|
||||
|
||||
std::wstring sFileCopy = m_sFileDir + L"/origin." + NSCommon::GetFileExtention(path);
|
||||
std::wstring sExtCopy = NSCommon::GetFileExtention(path);
|
||||
|
||||
if (true)
|
||||
{
|
||||
// для файлов по ссылке - расширение может быть плохим.
|
||||
const wchar_t* sExtCopyPtr = sExtCopy.c_str();
|
||||
int nExtCopyLen = sExtCopy.length();
|
||||
int nValidIndex = 0;
|
||||
while (nValidIndex < nExtCopyLen)
|
||||
{
|
||||
wchar_t c = sExtCopyPtr[nValidIndex];
|
||||
if ((c >= 'a' && c <= 'z') ||
|
||||
(c >= 'A' && c <= 'Z') ||
|
||||
(c >= '0' && c <= '9'))
|
||||
{
|
||||
++nValidIndex;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if (nValidIndex > 0)
|
||||
{
|
||||
sExtCopy = sExtCopy.substr(0, nValidIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
sExtCopy = L"tmp";
|
||||
}
|
||||
}
|
||||
|
||||
std::wstring sFileCopy = m_sFileDir + L"/origin." + sExtCopy;
|
||||
MoveFileOpen(path, sFileCopy);
|
||||
|
||||
COfficeFileFormatChecker oChecker;
|
||||
|
||||
@ -914,6 +914,25 @@ TFontCacheSizes CFontFile::GetChar(LONG lUnicode)
|
||||
return oSizes;
|
||||
}
|
||||
|
||||
double CFontFile::GetCharWidth(int gid)
|
||||
{
|
||||
if (!m_pFace)
|
||||
return 0;
|
||||
|
||||
if (0 != FT_Load_Glyph(m_pFace, gid, 40970))
|
||||
return 0;
|
||||
|
||||
FT_Glyph pGlyph = NULL;
|
||||
if (0 != FT_Get_Glyph(m_pFace->glyph, &pGlyph))
|
||||
return 0;
|
||||
|
||||
double dRet = (double)(m_pFace->glyph->linearHoriAdvance * m_dUnitsKoef / m_pFace->units_per_EM);
|
||||
|
||||
FT_Done_Glyph(pGlyph);
|
||||
|
||||
return dRet;
|
||||
}
|
||||
|
||||
INT CFontFile::GetString(CGlyphString& oString)
|
||||
{
|
||||
int nCountGlyph = oString.GetLength();
|
||||
|
||||
@ -239,6 +239,8 @@ public:
|
||||
int SetCMapForCharCode(long lUnicode, int *pnCMapIndex);
|
||||
int SetCMapForCharCode2(long lUnicode);
|
||||
|
||||
double GetCharWidth(int gid);
|
||||
|
||||
int GetKerning(FT_UInt unPrevGID, FT_UInt unGID);
|
||||
void SetStringGID(const INT& bGID);
|
||||
INT GetStringGID();
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
@ -256,7 +256,7 @@ namespace NSCommon
|
||||
int nCount = 1;
|
||||
++tmp;
|
||||
|
||||
while (nMask == *tmp && tmp < tmpLast)
|
||||
while (tmp < tmpLast && nMask == *tmp)
|
||||
{
|
||||
++tmp;
|
||||
nCount++;
|
||||
@ -537,12 +537,13 @@ namespace NSCommon
|
||||
pRenderer->put_FontFaceIndex(lFaceIndex);
|
||||
pManager->LoadFontFromFile(strFontPath, lFaceIndex, 14, dDpi, dDpi);
|
||||
|
||||
bool bIsSymbol = FALSE;
|
||||
bool bIsSymbol = false;
|
||||
NSFonts::IFontFile* pFile = pManager->GetFile();
|
||||
|
||||
if (pManager->GetFile())
|
||||
{
|
||||
bIsSymbol = pManager->GetFile()->IsSymbolic(false);
|
||||
}
|
||||
if (pFile)
|
||||
bIsSymbol = pFile->IsSymbolic(false);
|
||||
|
||||
std::wstring sFontName = pPair->second.m_sName;
|
||||
|
||||
if (bIsSymbol)
|
||||
{
|
||||
@ -557,6 +558,45 @@ namespace NSCommon
|
||||
pRenderer->put_FontPath(pInfoCur->m_wsFontPath);
|
||||
pRenderer->put_FontFaceIndex(0);
|
||||
}
|
||||
else if (pFile)
|
||||
{
|
||||
int nFontNameLen = (int)sFontName.length();
|
||||
bool bIsPresentAll = true;
|
||||
|
||||
for (int nC = 0; nC < nFontNameLen; nC++)
|
||||
{
|
||||
int nCMapIndex = 0;
|
||||
int nGid = pFile->SetCMapForCharCode(sFontName.at(nC), &nCMapIndex);
|
||||
if (0 >= nGid)
|
||||
{
|
||||
bIsPresentAll = false;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
double offsetG = pFile->GetCharWidth(nGid);
|
||||
if (offsetG < 0.0001)
|
||||
{
|
||||
bIsPresentAll = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!bIsPresentAll)
|
||||
{
|
||||
NSFonts::CFontSelectFormat oSelectFormat;
|
||||
oSelectFormat.wsName = new std::wstring(L"Arial");
|
||||
NSFonts::CFontInfo* pInfoCur = pManager->GetFontInfoByParams(oSelectFormat);
|
||||
|
||||
if (NULL != pInfoCur)
|
||||
{
|
||||
pManager->LoadFontFromFile(pInfoCur->m_wsFontPath, 0, 14, dDpi, dDpi);
|
||||
}
|
||||
pRenderer->put_FontPath(pInfoCur->m_wsFontPath);
|
||||
pRenderer->put_FontFaceIndex(0);
|
||||
}
|
||||
}
|
||||
|
||||
pRenderer->PathCommandStart();
|
||||
pRenderer->BeginCommand(c_nClipType);
|
||||
@ -568,7 +608,7 @@ namespace NSCommon
|
||||
pRenderer->put_FontCharSpace(0);
|
||||
pRenderer->put_FontSize(14);
|
||||
|
||||
pRenderer->CommandDrawText(pPair->second.m_sName, 5, 25.4 * (index * lH1_px + lH1_px) / dDpi - 2, 0, 0);
|
||||
pRenderer->CommandDrawText(sFontName, 5, 25.4 * (index * lH1_px + lH1_px) / dDpi - 2, 0, 0);
|
||||
|
||||
pRenderer->BeginCommand(c_nResetClipType);
|
||||
pRenderer->EndCommand(c_nResetClipType);
|
||||
|
||||
@ -488,6 +488,7 @@ namespace NSFonts
|
||||
virtual void SetFontMatrix(const double& fA, const double& fB, const double& fC, const double fD, double fE, double fF) = 0;
|
||||
|
||||
virtual int SetCMapForCharCode(long lUnicode, int *pnCMapIndex) = 0;
|
||||
virtual double GetCharWidth(int gid) = 0;
|
||||
};
|
||||
|
||||
namespace NSFontFile
|
||||
|
||||
@ -458,12 +458,12 @@ namespace MetaFile
|
||||
{
|
||||
// oOther слева, текущая матрица справа
|
||||
double dM11 = oOther.M11 * M11 + oOther.M12 * M21;
|
||||
double dM12 = oOther.M11 * M21 + oOther.M12 * M22;
|
||||
double dM12 = oOther.M11 * M12 + oOther.M12 * M22;
|
||||
double dM21 = oOther.M21 * M11 + oOther.M22 * M21;
|
||||
double dM22 = oOther.M21 * M21 + oOther.M22 * M22;
|
||||
double dM22 = oOther.M21 * M12 + oOther.M22 * M22;
|
||||
|
||||
double dDx = oOther.Dx * M11 + oOther.Dy * M21 + Dx;
|
||||
double dDy = oOther.Dx * M21 + oOther.Dy * M22 + Dy;
|
||||
double dDy = oOther.Dx * M12 + oOther.Dy * M22 + Dy;
|
||||
|
||||
M11 = dM11;
|
||||
M12 = dM12;
|
||||
@ -476,12 +476,12 @@ namespace MetaFile
|
||||
{
|
||||
// oOther справа, текущая матрица слева
|
||||
double dM11 = M11 * oOther.M11 + M12 * oOther.M21;
|
||||
double dM12 = M11 * oOther.M21 + M12 * oOther.M22;
|
||||
double dM12 = M11 * oOther.M12 + M12 * oOther.M22;
|
||||
double dM21 = M21 * oOther.M11 + M22 * oOther.M21;
|
||||
double dM22 = M21 * oOther.M21 + M22 * oOther.M22;
|
||||
double dM22 = M21 * oOther.M12 + M22 * oOther.M22;
|
||||
|
||||
double dDx = Dx * oOther.M11 + Dy * oOther.M21 + oOther.Dx;
|
||||
double dDy = Dx * oOther.M21 + Dy * oOther.M22 + oOther.Dy;
|
||||
double dDy = Dx * oOther.M12 + Dy * oOther.M22 + oOther.Dy;
|
||||
|
||||
M11 = dM11;
|
||||
M12 = dM12;
|
||||
|
||||
@ -434,6 +434,28 @@ namespace MetaFile
|
||||
|
||||
return *this;
|
||||
}
|
||||
CDataStream& operator>>(TEmfStretchBLT& oBitmap)
|
||||
{
|
||||
*this >> oBitmap.Bounds;
|
||||
*this >> oBitmap.xDest;
|
||||
*this >> oBitmap.yDest;
|
||||
*this >> oBitmap.cxDest;
|
||||
*this >> oBitmap.cyDest;
|
||||
*this >> oBitmap.BitBltRasterOperation;
|
||||
*this >> oBitmap.xSrc;
|
||||
*this >> oBitmap.ySrc;
|
||||
*this >> oBitmap.XformSrc;
|
||||
*this >> oBitmap.BkColorSrc;
|
||||
*this >> oBitmap.UsageSrc;
|
||||
*this >> oBitmap.offBmiSrc;
|
||||
*this >> oBitmap.cbBmiSrc;
|
||||
*this >> oBitmap.offBitsSrc;
|
||||
*this >> oBitmap.cbBitsSrc;
|
||||
*this >> oBitmap.cxSrc;
|
||||
*this >> oBitmap.cySrc;
|
||||
|
||||
return *this;
|
||||
}
|
||||
CDataStream& operator>>(TEmfSetDiBitsToDevice& oBitmap)
|
||||
{
|
||||
*this >> oBitmap.Bounds;
|
||||
|
||||
@ -229,6 +229,7 @@ static const struct ActionNamesEmf
|
||||
case EMR_BITBLT: Read_EMR_BITBLT(); break;
|
||||
case EMR_STRETCHDIBITS: Read_EMR_STRETCHDIBITS(); break;
|
||||
case EMR_SETDIBITSTODEVICE: Read_EMR_SETDIBITSTODEVICE(); break;
|
||||
case EMR_STRETCHBLT: Read_EMR_STRETCHBLT(); break;
|
||||
//-----------------------------------------------------------
|
||||
// 2.3.2 Clipping
|
||||
//-----------------------------------------------------------
|
||||
@ -376,24 +377,8 @@ static const struct ActionNamesEmf
|
||||
}
|
||||
void CEmfFile::TranslatePoint(int nX, int nY, double& dX, double &dY)
|
||||
{
|
||||
TEmfWindow* pWindow = m_pDC->GetWindow();
|
||||
TEmfWindow* pViewport = m_pDC->GetViewport();
|
||||
|
||||
dX = (double)((double)(nX - pWindow->lX) * m_pDC->GetPixelWidth()) + pViewport->lX;
|
||||
dY = (double)((double)(nY - pWindow->lY) * m_pDC->GetPixelHeight()) + pViewport->lY;
|
||||
|
||||
// Координаты приходят уже с примененной матрицей. Поэтому сначала мы умножаем на матрицу преобразования,
|
||||
// вычитаем начальные координаты и умножаем на обратную матрицу преобразования.
|
||||
TRect* pBounds = GetDCBounds();
|
||||
double dT = pBounds->nTop;
|
||||
double dL = pBounds->nLeft;
|
||||
|
||||
TEmfXForm* pInverse = GetInverseTransform();
|
||||
TEmfXForm* pTransform = GetTransform();
|
||||
pTransform->Apply(dX, dY);
|
||||
dX -= dL;
|
||||
dY -= dT;
|
||||
pInverse->Apply(dX, dY);
|
||||
dX = (double)nX;
|
||||
dY = (double)nY;
|
||||
}
|
||||
bool CEmfFile::ReadImage(unsigned int offBmi, unsigned int cbBmi, unsigned int offBits, unsigned int cbBits, unsigned int ulSkip, BYTE** ppBgraBuffer, unsigned int* pulWidth, unsigned int* pulHeight)
|
||||
{
|
||||
@ -943,6 +928,27 @@ static const struct ActionNamesEmf
|
||||
if (pBgraBuffer)
|
||||
delete[] pBgraBuffer;
|
||||
}
|
||||
void CEmfFile::Read_EMR_STRETCHBLT()
|
||||
{
|
||||
TEmfStretchBLT oBitmap;
|
||||
m_oStream >> oBitmap;
|
||||
|
||||
BYTE* pBgraBuffer = NULL;
|
||||
unsigned int ulWidth, ulHeight;
|
||||
|
||||
unsigned int unSkip = 108; // sizeof(TEmfStretchBLT) + 8 неправильно считает, из-з TXForm, там double, а в Emf они по 4 байта
|
||||
if (ReadImage(oBitmap.offBmiSrc, oBitmap.cbBmiSrc, oBitmap.offBitsSrc, oBitmap.cbBitsSrc, unSkip, &pBgraBuffer, &ulWidth, &ulHeight))
|
||||
{
|
||||
if (m_pOutput)
|
||||
{
|
||||
ProcessRasterOperation(oBitmap.BitBltRasterOperation, &pBgraBuffer, ulWidth, ulHeight);
|
||||
DrawImage(oBitmap.xDest, oBitmap.yDest, oBitmap.cxDest, oBitmap.cyDest, pBgraBuffer, ulWidth, ulHeight);
|
||||
}
|
||||
}
|
||||
|
||||
if (pBgraBuffer)
|
||||
delete[] pBgraBuffer;
|
||||
}
|
||||
void CEmfFile::Read_EMR_EOF()
|
||||
{
|
||||
unsigned int ulCount, ulOffset, ulSizeLast;
|
||||
|
||||
@ -142,7 +142,14 @@ namespace MetaFile
|
||||
}
|
||||
TXForm* GetTransform()
|
||||
{
|
||||
return m_pDC->GetTransform();
|
||||
TRect* pBounds = GetDCBounds();
|
||||
double dT = pBounds->nTop;
|
||||
double dL = pBounds->nLeft;
|
||||
|
||||
TXForm oShiftXForm(1, 0, 0, 1, -dL, -dT);
|
||||
m_oTransform.Copy(m_pDC->GetFinalTransform());
|
||||
m_oTransform.Multiply(oShiftXForm, MWT_RIGHTMULTIPLY);
|
||||
return &m_oTransform;
|
||||
}
|
||||
unsigned int GetMiterLimit()
|
||||
{
|
||||
@ -218,6 +225,7 @@ namespace MetaFile
|
||||
void Read_EMR_STRETCHDIBITS();
|
||||
void Read_EMR_BITBLT();
|
||||
void Read_EMR_SETDIBITSTODEVICE();
|
||||
void Read_EMR_STRETCHBLT();
|
||||
void Read_EMR_EOF();
|
||||
void Read_EMR_UNKNOWN();
|
||||
void Read_EMR_SAVEDC();
|
||||
@ -313,6 +321,7 @@ namespace MetaFile
|
||||
CEmfDC* m_pDC;
|
||||
CEmfPlayer m_oPlayer;
|
||||
CEmfPath* m_pPath;
|
||||
TEmfXForm m_oTransform;
|
||||
|
||||
friend class CEmfPlayer;
|
||||
};
|
||||
|
||||
@ -257,6 +257,7 @@ namespace MetaFile
|
||||
m_oTransform.Init();
|
||||
m_oInverseTransform.Init();
|
||||
m_oTextColor.Init();
|
||||
m_oFinalTransform.Init();
|
||||
m_oBgColor.Init();
|
||||
m_ulTextAlign = TA_TOP | TA_LEFT | TA_NOUPDATECP;
|
||||
m_ulBgMode = TRANSPARENT;
|
||||
@ -287,13 +288,14 @@ namespace MetaFile
|
||||
pNewDC->m_pPalette = m_pPalette;
|
||||
pNewDC->m_oTransform.Copy(&m_oTransform);
|
||||
pNewDC->m_oInverseTransform.Copy(&m_oInverseTransform);
|
||||
pNewDC->m_oFinalTransform.Copy(&m_oFinalTransform);
|
||||
pNewDC->m_oTextColor.Copy(&m_oTextColor);
|
||||
pNewDC->m_oBgColor.Copy(&m_oBgColor);
|
||||
pNewDC->m_ulTextAlign = m_ulTextAlign;
|
||||
pNewDC->m_ulBgMode = m_ulBgMode;
|
||||
pNewDC->m_ulMiterLimit = m_ulMiterLimit;
|
||||
pNewDC->m_ulFillMode = m_ulFillMode;
|
||||
pNewDC->m_ulStretchMode = m_ulStretchMode;
|
||||
pNewDC->m_ulStretchMode = m_ulStretchMode;
|
||||
pNewDC->m_ulRop2Mode = m_ulRop2Mode;
|
||||
pNewDC->m_dPixelHeight = m_dPixelHeight;
|
||||
pNewDC->m_dPixelWidth = m_dPixelWidth;
|
||||
@ -358,6 +360,8 @@ namespace MetaFile
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
unsigned int CEmfDC::GetMapMode()
|
||||
{
|
||||
@ -371,6 +375,10 @@ namespace MetaFile
|
||||
{
|
||||
return &m_oInverseTransform;
|
||||
}
|
||||
TEmfXForm* CEmfDC::GetFinalTransform()
|
||||
{
|
||||
return &m_oFinalTransform;
|
||||
}
|
||||
void CEmfDC::MultiplyTransform(TEmfXForm& oForm, unsigned int ulMode)
|
||||
{
|
||||
m_oTransform.Multiply(oForm, ulMode);
|
||||
@ -394,6 +402,8 @@ namespace MetaFile
|
||||
m_oInverseTransform.M22 = pT->M22 / dDet;
|
||||
m_oInverseTransform.Dx = pT->Dy * pT->M21 / dDet - pT->Dx * pT->M22 / dDet;
|
||||
m_oInverseTransform.Dy = pT->Dx * pT->M12 / dDet - pT->Dy * pT->M11 / dDet;
|
||||
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
void CEmfDC::SetTextColor(TEmfColor& oColor)
|
||||
{
|
||||
@ -511,12 +521,15 @@ namespace MetaFile
|
||||
m_oWindow.lX = oPoint.x;
|
||||
m_oWindow.lY = oPoint.y;
|
||||
UpdatePixelMetrics();
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
void CEmfDC::SetWindowExtents(TEmfSizeL& oPoint)
|
||||
{
|
||||
m_oWindow.ulW = oPoint.cx;
|
||||
m_oWindow.ulH = oPoint.cy;
|
||||
|
||||
UpdatePixelMetrics();
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
TEmfWindow* CEmfDC::GetWindow()
|
||||
{
|
||||
@ -527,12 +540,14 @@ namespace MetaFile
|
||||
m_oViewport.lX = oPoint.x;
|
||||
m_oViewport.lY = oPoint.y;
|
||||
UpdatePixelMetrics();
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
void CEmfDC::SetViewportExtents(TEmfSizeL& oPoint)
|
||||
{
|
||||
m_oViewport.ulW = oPoint.cx;
|
||||
m_oViewport.ulH = oPoint.cy;
|
||||
UpdatePixelMetrics();
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
TEmfWindow* CEmfDC::GetViewport()
|
||||
{
|
||||
@ -561,6 +576,44 @@ namespace MetaFile
|
||||
|
||||
return true;
|
||||
}
|
||||
void CEmfDC::UpdateFinalTransform()
|
||||
{
|
||||
TEmfWindow* pWindow = GetWindow();
|
||||
TEmfWindow* pViewPort = GetViewport();
|
||||
|
||||
int nWindowX = pWindow->lX;
|
||||
int nWindowY = pWindow->lY;
|
||||
|
||||
double dPixelW = GetPixelWidth();
|
||||
double dPixelH = GetPixelHeight();
|
||||
|
||||
// Вообще отрицательных высоты и ширины быть не должно, но если так встречается, то
|
||||
// мы считаем, что это не перевернутая система координат, а просто сдвинутая
|
||||
|
||||
if (pWindow->ulH < 0)
|
||||
{
|
||||
if (dPixelH < 0)
|
||||
dPixelH = -dPixelH;
|
||||
|
||||
nWindowY += pWindow->ulH;
|
||||
}
|
||||
|
||||
if (pWindow->ulW < 0)
|
||||
{
|
||||
if (dPixelW < 0)
|
||||
dPixelW = -dPixelW;
|
||||
|
||||
nWindowY += pWindow->ulW;
|
||||
}
|
||||
|
||||
TEmfXForm oWindowXForm(1, 0, 0, 1, -nWindowX, -nWindowY);
|
||||
TEmfXForm oViewportXForm(dPixelW, 0, 0, dPixelH, pViewPort->lX, pViewPort->lY);
|
||||
|
||||
m_oFinalTransform.Init();
|
||||
m_oFinalTransform.Multiply(oWindowXForm, MWT_RIGHTMULTIPLY);
|
||||
m_oFinalTransform.Multiply(m_oTransform, MWT_RIGHTMULTIPLY);
|
||||
m_oFinalTransform.Multiply(oViewportXForm, MWT_RIGHTMULTIPLY);
|
||||
}
|
||||
void CEmfDC::SetRop2Mode(unsigned int& nMode)
|
||||
{
|
||||
m_ulRop2Mode = nMode;
|
||||
@ -611,4 +664,4 @@ namespace MetaFile
|
||||
{
|
||||
return m_unArcDirection;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,6 +90,7 @@ namespace MetaFile
|
||||
unsigned int GetMapMode();
|
||||
TEmfXForm* GetTransform();
|
||||
TEmfXForm* GetInverseTransform();
|
||||
TEmfXForm* GetFinalTransform();
|
||||
void MultiplyTransform(TEmfXForm& oForm, unsigned int ulMode);
|
||||
void SetTextColor(TEmfColor& oColor);
|
||||
TEmfColor& GetTextColor();
|
||||
@ -140,6 +141,7 @@ namespace MetaFile
|
||||
void SetPixelWidth(double dPixelW);
|
||||
void SetPixelHeight(double dPixelH);
|
||||
bool UpdatePixelMetrics();
|
||||
void UpdateFinalTransform();
|
||||
|
||||
private:
|
||||
|
||||
@ -150,6 +152,7 @@ namespace MetaFile
|
||||
CEmfLogPalette* m_pPalette;
|
||||
TEmfXForm m_oTransform;
|
||||
TEmfXForm m_oInverseTransform;
|
||||
TEmfXForm m_oFinalTransform;
|
||||
TEmfColor m_oTextColor;
|
||||
TEmfColor m_oBgColor;
|
||||
unsigned int m_ulTextAlign;
|
||||
|
||||
@ -402,6 +402,7 @@ namespace MetaFile
|
||||
int cyDest;
|
||||
};
|
||||
|
||||
|
||||
#define TEmfXForm TXForm
|
||||
//struct TEmfXForm
|
||||
//{
|
||||
@ -487,6 +488,27 @@ namespace MetaFile
|
||||
// }
|
||||
//};
|
||||
|
||||
struct TEmfStretchBLT
|
||||
{
|
||||
TEmfRectL Bounds;
|
||||
int xDest;
|
||||
int yDest;
|
||||
int cxDest;
|
||||
int cyDest;
|
||||
unsigned int BitBltRasterOperation;
|
||||
int xSrc;
|
||||
int ySrc;
|
||||
TXForm XformSrc;
|
||||
TEmfColor BkColorSrc;
|
||||
unsigned int UsageSrc;
|
||||
unsigned int offBmiSrc;
|
||||
unsigned int cbBmiSrc;
|
||||
unsigned int offBitsSrc;
|
||||
unsigned int cbBitsSrc;
|
||||
int cxSrc;
|
||||
int cySrc;
|
||||
};
|
||||
|
||||
struct TEmfEmrText
|
||||
{
|
||||
TEmfPointL Reference;
|
||||
|
||||
@ -172,15 +172,24 @@ namespace PdfReader
|
||||
|
||||
if (pEncryptDict->DictLookup("OE", &oOwnerEncryptionKey))
|
||||
{
|
||||
m_seOwnerEncryptionKey = oOwnerEncryptionKey.GetString()->Copy();
|
||||
if (oOwnerEncryptionKey.IsString())
|
||||
{
|
||||
m_seOwnerEncryptionKey = oOwnerEncryptionKey.GetString()->Copy();
|
||||
}
|
||||
}
|
||||
if (pEncryptDict->DictLookup("UE", &oUserEncryptionKey))
|
||||
{
|
||||
m_seUserEncryptionKey = oUserEncryptionKey.GetString()->Copy();
|
||||
if (oUserEncryptionKey.IsString())
|
||||
{
|
||||
m_seUserEncryptionKey = oUserEncryptionKey.GetString()->Copy();
|
||||
}
|
||||
}
|
||||
if (pEncryptDict->DictLookup("Perms", &oPermsValue))
|
||||
{
|
||||
m_sePermsValue = oPermsValue.GetString()->Copy();
|
||||
if (oPermsValue.IsString())
|
||||
{
|
||||
m_sePermsValue = oPermsValue.GetString()->Copy();
|
||||
}
|
||||
}
|
||||
|
||||
if (oFileID.IsArray())
|
||||
|
||||
@ -498,6 +498,8 @@ private:
|
||||
m_nDashStyle = Aggplus::DashStyleSolid;
|
||||
m_lDashPatternSize = 0;
|
||||
m_pDashPattern = NULL;
|
||||
|
||||
m_dDashOffset = 0;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@ -113,6 +113,22 @@ namespace NExtractTools
|
||||
}
|
||||
return res;
|
||||
}
|
||||
int processEncryptionError(int hRes, const std::wstring &sFrom, InputParams& params)
|
||||
{
|
||||
if (AVS_ERROR_DRM == hRes)
|
||||
{
|
||||
if(!params.getDontSaveAdditional())
|
||||
{
|
||||
copyOrigin(sFrom, *params.m_sFileTo);
|
||||
}
|
||||
return AVS_FILEUTILS_ERROR_CONVERT_DRM;
|
||||
}
|
||||
else if (AVS_ERROR_PASSWORD == hRes)
|
||||
{
|
||||
return AVS_FILEUTILS_ERROR_CONVERT_PASSWORD;
|
||||
}
|
||||
return hRes;
|
||||
}
|
||||
// docx -> bin
|
||||
int docx2doct_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
|
||||
{
|
||||
@ -2351,6 +2367,7 @@ namespace NExtractTools
|
||||
NSDirectory::CreateDirectory(sTempUnpackedOox);
|
||||
|
||||
int nRes = ConvertODF2OOXml(sTempUnpackedOdf, sTempUnpackedOox, params.getFontPath(), sTemp, params.getPassword(), NULL);
|
||||
nRes = processEncryptionError(nRes, sFrom, params);
|
||||
if(SUCCEEDED_X2T(nRes))
|
||||
{
|
||||
BinDocxRW::CDocxSerializer m_oCDocxSerializer;
|
||||
@ -2401,7 +2418,9 @@ namespace NExtractTools
|
||||
if (S_OK != oCOfficeUtils.ExtractToDirectory(sFrom, sTempUnpackedOdf, NULL, 0))
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;;
|
||||
|
||||
return ConvertODF2OOXml(sTempUnpackedOdf, sTo, params.getFontPath(), sTemp, params.getPassword(), NULL);
|
||||
int nRes =ConvertODF2OOXml(sTempUnpackedOdf, sTo, params.getFontPath(), sTemp, params.getPassword(), NULL);
|
||||
nRes = processEncryptionError(nRes, sFrom, params);
|
||||
return nRes;
|
||||
}
|
||||
//odf flat
|
||||
int odf_flat2oot(const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
|
||||
@ -2429,6 +2448,7 @@ namespace NExtractTools
|
||||
NSDirectory::CreateDirectory(sTempUnpackedOox);
|
||||
|
||||
int nRes = ConvertODF2OOXml(sFrom, sTempUnpackedOox, params.getFontPath(), sTemp, params.getPassword(), NULL);
|
||||
nRes = processEncryptionError(nRes, sFrom, params);
|
||||
if(SUCCEEDED_X2T(nRes))
|
||||
{
|
||||
BinDocxRW::CDocxSerializer m_oCDocxSerializer;
|
||||
@ -2455,7 +2475,9 @@ namespace NExtractTools
|
||||
}
|
||||
int odf_flat2oox_dir(const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
|
||||
{
|
||||
return ConvertODF2OOXml(sFrom, sTo, params.getFontPath(), sTemp, params.getPassword(), NULL);
|
||||
int nRes = ConvertODF2OOXml(sFrom, sTo, params.getFontPath(), sTemp, params.getPassword(), NULL);
|
||||
nRes = processEncryptionError(nRes, sFrom, params);
|
||||
return nRes;
|
||||
}
|
||||
// docx -> odt
|
||||
int docx2odt (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params )
|
||||
|
||||
Reference in New Issue
Block a user