mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-15 04:15:53 +08:00
Compare commits
263 Commits
core-win-6
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| 1a3a73d0ec | |||
| 5a82c47fa0 | |||
| 65f7a4a170 | |||
| 413424bf62 | |||
| 01499a21f3 | |||
| a9215a867b | |||
| e9fd8205fa | |||
| f30a3c4ae8 | |||
| 615179f9da | |||
| 2fc5a4f37a | |||
| 25af6b2ecf | |||
| f0fdf9f86e | |||
| 5d5e7bce72 | |||
| 58903d92e1 | |||
| b7ea6bb376 | |||
| a1007d4522 | |||
| 4b68d3294c | |||
| 24b44f6b03 | |||
| 9f20ee6fef | |||
| 14921ca98d | |||
| 663bf866ed | |||
| 4894639c09 | |||
| 2314452d5a | |||
| 22c8ae9d0e | |||
| 996fa5c84d | |||
| 59d2dd2840 | |||
| 3727c2e982 | |||
| 1b67ebe9a6 | |||
| 967ab71adc | |||
| d7c7dadbba | |||
| a48322f1cc | |||
| bd41922f66 | |||
| ccd73c8c68 | |||
| 5b6659f816 | |||
| a5122a6a47 | |||
| 7a4cf11c62 | |||
| 9b9d7df4e2 | |||
| c9330ee0f1 | |||
| 2214362426 | |||
| bdce91fccf | |||
| dd65f70fcb | |||
| bf600c6eb0 | |||
| 0db6728463 | |||
| 03bccc6b10 | |||
| 09c43b1179 | |||
| e6134405cb | |||
| 0499c6ff4f | |||
| 1860c19539 | |||
| 2d5015bcf2 | |||
| 390ab3bcc8 | |||
| c0d16ed7c3 | |||
| 075f70c220 | |||
| 6abf1613ec | |||
| 0abc21d4ee | |||
| 7a7cdab770 | |||
| 7c6218ccb5 | |||
| 34c5a4b3af | |||
| 9256b0f9a3 | |||
| ce370581a8 | |||
| 39647894a8 | |||
| 3d456bcc80 | |||
| 7ae3c6f2ea | |||
| 404058354e | |||
| d398488f3d | |||
| 35bd2803a4 | |||
| c312a2b868 | |||
| 08f75771b9 | |||
| 060f695fb1 | |||
| de3261521e | |||
| e7bf661432 | |||
| 6470a3a8a4 | |||
| 14aed88307 | |||
| 132f770d28 | |||
| 8f5318a9a2 | |||
| 635265eaa2 | |||
| 038a687d01 | |||
| 69e8ea6f4b | |||
| 1393de8057 | |||
| 7636ff79cc | |||
| 2092aef589 | |||
| eff937699b | |||
| 3efc1f0432 | |||
| 69fee1ae0b | |||
| a0cc6b6274 | |||
| 31eb395858 | |||
| ed1019a004 | |||
| 4e554d128a | |||
| b8d441a327 | |||
| 8fb809bf4a | |||
| cabf6ab32a | |||
| 35c4d70cf5 | |||
| 58952393f0 | |||
| 688d5972ea | |||
| 81176e851c | |||
| 0b987aeed2 | |||
| c7315e2f21 | |||
| aefb229343 | |||
| ac080b3485 | |||
| eb9d69d1ec | |||
| eb4ffee9e7 | |||
| 763347d8ec | |||
| 9670d021c2 | |||
| 232115e684 | |||
| 79f18355fe | |||
| f86055c713 | |||
| ea82bea6f1 | |||
| 28f5b1251a | |||
| 39fbf06511 | |||
| a265d82dda | |||
| e68b550d1e | |||
| 0821edca07 | |||
| bc4faa26b9 | |||
| 668a89bbd1 | |||
| 832d35dc17 | |||
| 2d21d334cf | |||
| b23bc97fdb | |||
| f4df80ebf3 | |||
| 230c51689d | |||
| 799fcbc342 | |||
| 1d25f72ac9 | |||
| 9bfb0321b2 | |||
| 6c1bdc6ff8 | |||
| 826be463f5 | |||
| 469ce9aafb | |||
| 29bb606d04 | |||
| 8f8995cbe7 | |||
| fb1ae2c79a | |||
| 0f4d594248 | |||
| 152d05d5a5 | |||
| 942767eb79 | |||
| 5c070f0475 | |||
| 17c68ae414 | |||
| ab45804644 | |||
| 5f7288f66f | |||
| b308f53e76 | |||
| 0982b8fb11 | |||
| 4cca54900d | |||
| b66ed403e1 | |||
| 692fe69426 | |||
| 428b5971e8 | |||
| 32193b8a04 | |||
| 5bb1de7dbd | |||
| 97531fe80f | |||
| 84755143fa | |||
| 37ab11c58a | |||
| 22cdeaf821 | |||
| ee4d2079dc | |||
| 68606f4cb0 | |||
| dbb11a480e | |||
| 6c29f811d9 | |||
| eb157610d3 | |||
| 89ac698d35 | |||
| e1d910f952 | |||
| ef7331d803 | |||
| 5bb3ca6aff | |||
| bae655ba49 | |||
| e4b4949471 | |||
| 2bfcfbf21c | |||
| 1266382747 | |||
| 287059a891 | |||
| 966809a8f2 | |||
| d8f8720d05 | |||
| aa8471b024 | |||
| 27c9b40ad3 | |||
| 699eb731b4 | |||
| 0eb032a281 | |||
| f89174ded5 | |||
| ff1d53637a | |||
| e825b4359f | |||
| d11b74007d | |||
| 45d5f3b130 | |||
| 25022ceecc | |||
| 1a7476e465 | |||
| 0edc2729e8 | |||
| d898f0ef2f | |||
| d51f004b11 | |||
| c645ed6aeb | |||
| 79aa50d712 | |||
| 3dcb378de7 | |||
| 87c4ebe1d4 | |||
| fdef699b9b | |||
| 498d58e856 | |||
| 441aa277e3 | |||
| e8c314e535 | |||
| 12c8cf112a | |||
| c9fb5cbe4d | |||
| 8573513168 | |||
| 4e337b5ef1 | |||
| 7e0e30d00f | |||
| 72c4727a1e | |||
| 29c197f383 | |||
| c07bd58bda | |||
| ae9a7f7fad | |||
| 1157d6f97f | |||
| 5483547ee7 | |||
| b9608771a9 | |||
| b3d219ef58 | |||
| 46a6e35a35 | |||
| cfea717d20 | |||
| ae45b240a3 | |||
| 0ec79f2c2d | |||
| 6f0d22c3a4 | |||
| 8d074cadf8 | |||
| 4a3b56d0d5 | |||
| 195e9079db | |||
| 8e8fd1096f | |||
| b60811fd0d | |||
| 9eb82fa85e | |||
| 6d6cbd51c3 | |||
| 9e0ff699aa | |||
| 9c1b107998 | |||
| c0d38c97f8 | |||
| f2e003b12c | |||
| ee43592691 | |||
| a1b2979f0f | |||
| 00328e88b2 | |||
| ed2878a8cc | |||
| bc18304827 | |||
| 8d59eeabd5 | |||
| df894c0193 | |||
| 655c393a1b | |||
| 06b25e1cc6 | |||
| e4ed9cade7 | |||
| 47dc96ba3c | |||
| 3c4154b3ac | |||
| 455c8b3836 | |||
| a9252192e8 | |||
| e31f101021 | |||
| f34660291a | |||
| cebfe04802 | |||
| 746490cea1 | |||
| 18df04b508 | |||
| 0bd1fb972f | |||
| 7b92c7d079 | |||
| 7e3aebe79c | |||
| 34fc112d0e | |||
| 2d219d5a74 | |||
| 9d30e3ecab | |||
| c6de9b9e52 | |||
| affc65c679 | |||
| 2cff8d9804 | |||
| 28f8de794f | |||
| daac90f8dc | |||
| 30adbb0a24 | |||
| 94e59cfc82 | |||
| 9794d714d3 | |||
| 8d80005bab | |||
| a4d22be862 | |||
| 3f615c2ece | |||
| 95e1a1edf9 | |||
| f7f9346286 | |||
| c0c6baf636 | |||
| ccbc044f11 | |||
| a8668df5fd | |||
| cc228f3393 | |||
| 19904acd30 | |||
| 30d175144a | |||
| acf15abe41 | |||
| 5a7fc7f548 | |||
| e7326556e0 | |||
| c589d8fe8a | |||
| a28e8f1357 | |||
| 564b7f9c29 |
4
.gitignore
vendored
4
.gitignore
vendored
@ -63,4 +63,6 @@ X2tConverter/Common/DocxFormat/DocxFormatLib/Makefile
|
||||
*.zip
|
||||
*.tar.gz
|
||||
**/*.build/
|
||||
|
||||
*.dat
|
||||
*.txt
|
||||
*.log
|
||||
|
||||
@ -769,12 +769,18 @@ namespace DocFileFormat
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
static inline std::wstring IntToWideString(int value)
|
||||
static inline std::wstring IntToWideString(unsigned int value)
|
||||
{
|
||||
return (std::to_wstring(value));
|
||||
}
|
||||
|
||||
static inline std::wstring IntToWideString(int value)
|
||||
{
|
||||
return (std::to_wstring(value));
|
||||
}
|
||||
static inline std::wstring SizeTToWideString(size_t value)
|
||||
{
|
||||
return (std::to_wstring((unsigned int)value));
|
||||
}
|
||||
static inline std::wstring DoubleToWideString(double value)
|
||||
{
|
||||
std::wstringstream src;
|
||||
|
||||
@ -87,15 +87,14 @@ namespace DocFileFormat
|
||||
}
|
||||
else
|
||||
{
|
||||
m_nDTTM = reader->ReadUInt32();
|
||||
m_nDTTM = DateAndTime(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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "ByteStructure.h"
|
||||
#include "DateAndTime.h"
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
@ -72,7 +73,7 @@ namespace DocFileFormat
|
||||
return (nWordVersion > 0) ? STRUCTURE_SIZE_OLD : STRUCTURE_SIZE;
|
||||
}
|
||||
|
||||
AnnotationReferenceExDescriptor() : m_nDTTM(0), m_nDepth(0), m_nDiatrdParent(0), m_fInkAtn(false)
|
||||
AnnotationReferenceExDescriptor() : m_nDepth(0), m_nDiatrdParent(0), m_fInkAtn(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -82,7 +83,7 @@ namespace DocFileFormat
|
||||
|
||||
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length );
|
||||
|
||||
unsigned int m_nDTTM;
|
||||
DateAndTime m_nDTTM;
|
||||
unsigned int m_nDepth;
|
||||
unsigned int m_nDiatrdParent;
|
||||
bool m_fInkAtn;
|
||||
|
||||
@ -85,9 +85,11 @@ namespace DocFileFormat
|
||||
|
||||
if (author_str)
|
||||
{
|
||||
XMLTools::XMLAttribute author( L"w:author", FormatUtils::XmlEncode(*author_str));
|
||||
XMLTools::XMLAttribute author( L"w:author", FormatUtils::XmlEncode(*author_str));
|
||||
rPrChange.AppendAttribute( author );
|
||||
}
|
||||
XMLTools::XMLAttribute date( L"w:date", _revisionData->Dttm.getString());
|
||||
rPrChange.AppendAttribute( date );
|
||||
|
||||
//convert revision stack
|
||||
convertSprms( _revisionData->Changes, &rPrChange );
|
||||
|
||||
@ -85,34 +85,31 @@ namespace DocFileFormat
|
||||
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;
|
||||
AnnotationReferenceExDescriptor* atrdPost10 = NULL;
|
||||
if ((m_document->AnnotationsReferenceExPlex) && (index < m_document->AnnotationsReferenceExPlex->Elements.size()))
|
||||
{
|
||||
atrdPost10 = static_cast<AnnotationReferenceExDescriptor*>(m_document->AnnotationsReferenceExPlex->Elements[index]);
|
||||
}
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:comment", TRUE );
|
||||
if (atrdPre10->m_BookmarkId < 0)
|
||||
if (atrdPre10->m_BookmarkId < 0)//-1 - easy ref (not start/end comment ref)
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 + count + 1024 ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::SizeTToWideString( index + 1 + count + 1024 ));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::SizeTToWideString( 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));
|
||||
}*/
|
||||
m_pXmlWriter->WriteAttribute( L"w:date", atrdPost10->m_nDTTM.getString());
|
||||
}
|
||||
if (atrdPre10->m_AuthorIndex < m_document->AnnotationOwners->size()) //conv_253l2H1CehgKwsxCtNk__docx.doc
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:author",
|
||||
FormatUtils::XmlEncode(m_document->AnnotationOwners->at( atrdPre10->m_AuthorIndex ) ));
|
||||
}
|
||||
m_pXmlWriter->WriteAttribute( L"w:initials", atrdPre10->m_UserInitials);
|
||||
m_pXmlWriter->WriteAttribute( L"w:initials", FormatUtils::XmlEncode(atrdPre10->m_UserInitials));
|
||||
|
||||
|
||||
|
||||
|
||||
@ -83,6 +83,14 @@ namespace DocFileFormat
|
||||
//throw new ByteParseException("Cannot parse the struct DTTM, the length of the struct doesn't match");
|
||||
}
|
||||
}
|
||||
std::wstring getString()
|
||||
{
|
||||
return std::to_wstring(yr) + L"-" + (mon < 9 ? L"0" : L"" ) + std::to_wstring(mon) + L"-" +
|
||||
(dom < 9 ? L"0" : L"" ) + std::to_wstring(dom) + L"T" +
|
||||
(hr < 9 ? L"0" : L"" ) + std::to_wstring(hr) + L":" +
|
||||
(mint < 9 ? L"0" : L"" )+ std::to_wstring(mint) + L"Z";
|
||||
|
||||
}
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
SYSTEMTIME ToSYSTEMTIME()
|
||||
{
|
||||
|
||||
@ -406,8 +406,8 @@ namespace DocFileFormat
|
||||
//if it's a inserted run
|
||||
m_pXmlWriter->WriteNodeBegin(L"w:ins", true);
|
||||
m_pXmlWriter->WriteAttribute(L"w:author", FormatUtils::XmlEncode(*author));
|
||||
m_pXmlWriter->WriteAttribute(L"w:date", FormatUtils::XmlEncode(rev.Dttm.getString()));
|
||||
m_pXmlWriter->WriteNodeEnd(L"", true, false);
|
||||
//rev.Dttm.Convert(new DateMapping(m_pXmlWriter));
|
||||
}
|
||||
|
||||
//start run
|
||||
@ -716,7 +716,7 @@ namespace DocFileFormat
|
||||
RELEASEOBJECT( chpxs );
|
||||
}
|
||||
}
|
||||
oleWriter.WriteString( _lastOLEObject );
|
||||
oleWriter.WriteString( _lastOLEObject ); _lastOLEObject.clear();
|
||||
oleWriter.WriteNodeEnd( L"w:object" );
|
||||
|
||||
if (!oVmlMapper.m_isEmbedded && oVmlMapper.m_isEquation)
|
||||
@ -800,8 +800,9 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
XMLTools::XMLElement elem(L"w:br");
|
||||
elem.AppendAttribute(L"w:type", L"textWrapping");
|
||||
elem.AppendAttribute(L"w:clear", L"all");
|
||||
//СЗ в МРФ Техноград о предоставлении ТП 1 квартал 2019_MO_Q31.doc
|
||||
//elem.AppendAttribute(L"w:type", L"textWrapping");
|
||||
//elem.AppendAttribute(L"w:clear", L"all");
|
||||
|
||||
m_pXmlWriter->WriteString(elem.GetXMLString());
|
||||
}
|
||||
@ -912,6 +913,7 @@ namespace DocFileFormat
|
||||
pSpa = static_cast<Spa*>(m_document->OfficeDrawingPlexHeader->GetStruct(headerCp));
|
||||
}
|
||||
|
||||
bool bPicture = false;
|
||||
if (pSpa)
|
||||
{
|
||||
PictureDescriptor pictDiscr(chpx, m_document->WordDocumentStream, 0x7fffffff, m_document->nWordVersion);
|
||||
@ -925,6 +927,8 @@ namespace DocFileFormat
|
||||
|
||||
pShape->Convert(&oVmlWriter);
|
||||
m_pXmlWriter->WriteNodeEnd (L"w:pict");
|
||||
|
||||
bPicture = true;
|
||||
}
|
||||
|
||||
if (!pSpa->primitives.empty())
|
||||
@ -933,8 +937,13 @@ namespace DocFileFormat
|
||||
VMLShapeMapping oVmlWriter (m_context, m_pXmlWriter, pSpa, &pictDiscr, _caller);
|
||||
pSpa->primitives.Convert(&oVmlWriter);
|
||||
m_pXmlWriter->WriteNodeEnd (L"w:pict");
|
||||
|
||||
bPicture = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ((false == _fieldLevels.empty()) && (_fieldLevels.back().bSeparate))
|
||||
_fieldLevels.back().bResult = bPicture;
|
||||
}
|
||||
else if (TextMark::Picture == code && fSpec)
|
||||
{
|
||||
@ -1004,10 +1013,23 @@ namespace DocFileFormat
|
||||
oPicture.shapeContainer->Convert(&oVmlMapper);
|
||||
}
|
||||
|
||||
pictWriter.WriteNodeEnd (L"w:pict");
|
||||
pictWriter.WriteNodeEnd (L"w:pict");
|
||||
|
||||
if (!bFormula)
|
||||
m_pXmlWriter->WriteString(pictWriter.GetXmlString());
|
||||
{
|
||||
if (false == _fieldLevels.empty())
|
||||
{
|
||||
if (_fieldLevels.back().bSeparate && !_fieldLevels.back().bResult) //ege15.doc
|
||||
{
|
||||
m_pXmlWriter->WriteString(pictWriter.GetXmlString());
|
||||
_fieldLevels.back().bResult = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pXmlWriter->WriteString(pictWriter.GetXmlString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1058,7 +1080,15 @@ namespace DocFileFormat
|
||||
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++ ));
|
||||
|
||||
int index = _commentNr++;
|
||||
|
||||
AnnotationReferenceDescriptor* atrdPre10 = static_cast<AnnotationReferenceDescriptor*>(m_document->AnnotationsReferencePlex->Elements[index - 1]);
|
||||
|
||||
if (atrdPre10->m_BookmarkId < 0)
|
||||
index += m_document->AnnotationsReferencePlex->Elements.size() + 1024;
|
||||
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString(index));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true );
|
||||
}
|
||||
}
|
||||
@ -1771,7 +1801,7 @@ namespace DocFileFormat
|
||||
if (m_document->AnnotStartEndCPs[i].second == cp)
|
||||
{
|
||||
result = writeAnnotationEnd(i + 1);
|
||||
_commentNr = i + 1;
|
||||
//_commentNr = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -161,6 +161,7 @@ namespace DocFileFormat
|
||||
{
|
||||
bool bBegin = false;
|
||||
bool bSeparate = false;
|
||||
bool bResult = false;
|
||||
//bool bInstrText = false;
|
||||
bool bEnd = false;
|
||||
};
|
||||
|
||||
@ -92,7 +92,7 @@ namespace DocFileFormat
|
||||
{
|
||||
//start abstractNum
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:abstractNum", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::IntToWideString( i /*+ 1 */));
|
||||
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::SizeTToWideString( i /*+ 1 */));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
//nsid
|
||||
@ -140,7 +140,7 @@ namespace DocFileFormat
|
||||
{
|
||||
//start abstractNum
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:abstractNum", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::IntToWideString( rglst->listNumbering[i]->id ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::SizeTToWideString( rglst->listNumbering[i]->id ));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
////nsid
|
||||
@ -169,7 +169,7 @@ namespace DocFileFormat
|
||||
|
||||
//start num
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:num", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:numId", FormatUtils::IntToWideString(i + 1));
|
||||
m_pXmlWriter->WriteAttribute( L"w:numId", FormatUtils::SizeTToWideString(i + 1));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
int index = FindIndexbyId( rglst->listData, lfo->lsid );
|
||||
@ -205,12 +205,12 @@ namespace DocFileFormat
|
||||
for (size_t i = 0; i < rglst->listNumbering.size(); ++i)
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:num", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:numId", FormatUtils::IntToWideString(rglst->listNumbering[i]->id));
|
||||
m_pXmlWriter->WriteAttribute( L"w:numId", FormatUtils::SizeTToWideString(rglst->listNumbering[i]->id));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:abstractNumId", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToWideString( rglst->listNumbering[i]->id ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::SizeTToWideString( rglst->listNumbering[i]->id ));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd(L"w:num");
|
||||
@ -285,7 +285,7 @@ namespace DocFileFormat
|
||||
newResult = find_if((result + 1), lvl->xst.end(), &NumberingMapping::IsPlaceholder);
|
||||
|
||||
ret += L"%";
|
||||
ret += FormatUtils::IntToWideString(*result + 1);
|
||||
ret += FormatUtils::SizeTToWideString(*result + 1);
|
||||
ret += std::wstring((result + 1), newResult);
|
||||
result = newResult;
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ namespace DocFileFormat
|
||||
GroupContainer* group = static_cast<GroupContainer*>(groupChild);
|
||||
if (group)
|
||||
{
|
||||
group->Index = i;
|
||||
group->Index = (int)i;
|
||||
}
|
||||
}
|
||||
else if (ShapeContainer::TYPE_CODE_0xF004 == groupChild->TypeCode)
|
||||
|
||||
@ -85,19 +85,19 @@ namespace DocFileFormat
|
||||
|
||||
struct ImageFileStructure
|
||||
{
|
||||
ImageFileStructure()
|
||||
ImageFileStructure(const std::wstring& _ext, boost::shared_array<unsigned char> _data, unsigned int _size, Global::BlipType _blipType = Global::msoblipUNKNOWN) : ext(_ext), data(_data), size(_size), blipType(_blipType)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ImageFileStructure(const std::wstring& _ext, const std::vector<unsigned char>& _data, Global::BlipType _blipType = Global::msoblipUNKNOWN) : ext(_ext), data(_data), blipType(_blipType)
|
||||
ImageFileStructure(const std::wstring& _ext, unsigned char* _data, unsigned int _size, Global::BlipType _blipType = Global::msoblipUNKNOWN) : ext(_ext), size(_size), blipType(_blipType)
|
||||
{
|
||||
|
||||
data = boost::shared_array<unsigned char>(new unsigned char[size]);
|
||||
memcpy(data.get(), _data, size);
|
||||
}
|
||||
|
||||
std::wstring ext;
|
||||
std::vector<unsigned char> data;
|
||||
Global::BlipType blipType;
|
||||
std::wstring ext;
|
||||
boost::shared_array<unsigned char> data;
|
||||
unsigned int size;
|
||||
Global::BlipType blipType;
|
||||
};
|
||||
|
||||
struct OleObjectFileStructure
|
||||
|
||||
@ -33,6 +33,8 @@
|
||||
#include "PictureDescriptor.h"
|
||||
#include "OfficeDrawing/MetafilePictBlip.h"
|
||||
|
||||
#include "../../DesktopEditor/raster/BgraFrame.h"
|
||||
|
||||
#ifndef MM_ISOTROPIC
|
||||
#define MM_ISOTROPIC 7
|
||||
#endif
|
||||
@ -41,6 +43,111 @@
|
||||
#define MM_ANISOTROPIC 8
|
||||
#endif
|
||||
|
||||
namespace ImageHelper
|
||||
{
|
||||
Global::_BlipType SaveImageToFileFromDIB(unsigned char* data, int size, const std::wstring& file_name)//without ext
|
||||
{
|
||||
Global::_BlipType result = Global::msoblipERROR;
|
||||
|
||||
CBgraFrame oFrame;
|
||||
int offset = 0, biSizeImage = 0;
|
||||
|
||||
__BITMAPINFOHEADER * header = (__BITMAPINFOHEADER*)data;
|
||||
if (!header) return result;
|
||||
|
||||
result = Global::msoblipDIB;
|
||||
|
||||
if (header->biWidth > 100000 || header->biHeight > 100000 || header->biSize != 40)
|
||||
{
|
||||
__BITMAPCOREHEADER * header_core = (__BITMAPCOREHEADER *)data;
|
||||
if (header_core->bcSize != 12)
|
||||
{
|
||||
result = Global::msoblipWMF;
|
||||
}
|
||||
else
|
||||
{
|
||||
offset = 12; //sizeof(BITMAPCOREHEADER)
|
||||
|
||||
oFrame.put_Height (header_core->bcHeight );
|
||||
oFrame.put_Width (header_core->bcWidth );
|
||||
|
||||
int sz_bitmap = header_core->bcHeight * header_core->bcWidth * header_core->bcBitCount/ 8;
|
||||
|
||||
//if (header_core->bcWidth % 2 != 0 && sz_bitmap < size - offset)
|
||||
// header_core->bcWidth++;
|
||||
///???? todooo непонятно .. в biff5 нужно флипать картинку, в biff8 не ясно ( -
|
||||
|
||||
int stride = -(size - offset) / header_core->bcHeight;
|
||||
oFrame.put_Stride (stride/*header_core->bcBitCount * header_core->bcWidth /8 */);
|
||||
|
||||
biSizeImage = size - offset;
|
||||
|
||||
if (-stride >= header_core->bcWidth && header_core->bcBitCount >=24 )
|
||||
{
|
||||
result = Global::msoblipPNG;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
offset = 40; //sizeof(BITMAPINFOHEADER)
|
||||
|
||||
oFrame.put_Height (header->biHeight );
|
||||
oFrame.put_Width (header->biWidth );
|
||||
|
||||
int sz_bitmap = header->biHeight * header->biWidth * header->biBitCount/ 8;
|
||||
|
||||
//if (header->biWidth % 2 != 0 && sz_bitmap < size -offset)
|
||||
// header->biWidth++;
|
||||
|
||||
int stride = -(size - offset) / header->biHeight;
|
||||
|
||||
if (-stride >= header->biWidth && header->biBitCount >= 24)
|
||||
{
|
||||
result = Global::msoblipPNG;
|
||||
}
|
||||
oFrame.put_Stride (stride/*header->biBitCount * header->biWidth /8*/);
|
||||
|
||||
biSizeImage = header->biSizeImage > 0 ? header->biSizeImage : (size - offset);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
if (result == Global::msoblipPNG)
|
||||
{
|
||||
oFrame.put_Data((unsigned char*)data + offset);
|
||||
|
||||
if (!oFrame.SaveFile(file_name + L".png", 4/*CXIMAGE_FORMAT_PNG*/))
|
||||
result = Global::msoblipERROR;
|
||||
|
||||
oFrame.put_Data(NULL);
|
||||
}
|
||||
else if (result == Global::msoblipWMF)
|
||||
{
|
||||
NSFile::CFileBinary file;
|
||||
if (file.CreateFileW(file_name + L".wmf"))
|
||||
{
|
||||
file.WriteFile((BYTE*)data, size);
|
||||
file.CloseFile();
|
||||
}
|
||||
}
|
||||
else if (biSizeImage > 0)
|
||||
{
|
||||
NSFile::CFileBinary file;
|
||||
if (file.CreateFileW(file_name + L".bmp"))
|
||||
{
|
||||
_UINT16 vtType = 0x4D42; file.WriteFile((BYTE*)&vtType, 2);
|
||||
_UINT32 dwLen = biSizeImage; file.WriteFile((BYTE*)&dwLen, 4);
|
||||
_UINT32 dwRes = 0; file.WriteFile((BYTE*)&dwRes, 4);
|
||||
_UINT32 dwOffset = 2; file.WriteFile((BYTE*)&dwOffset, 4);
|
||||
|
||||
file.WriteFile((BYTE*)data, size);
|
||||
file.CloseFile();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
namespace DocFileFormat
|
||||
{
|
||||
/// Parses the CHPX for a fcPic an loads the PictureDescriptor at this offset
|
||||
|
||||
@ -134,3 +134,34 @@ namespace DocFileFormat
|
||||
int embeddedDataSize;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
namespace ImageHelper
|
||||
{
|
||||
struct __BITMAPINFOHEADER
|
||||
{
|
||||
_UINT32 biSize;
|
||||
_INT32 biWidth;
|
||||
_INT32 biHeight;
|
||||
_UINT16 biPlanes;
|
||||
_UINT16 biBitCount;
|
||||
_UINT32 biCompression;
|
||||
_UINT32 biSizeImage;
|
||||
_INT32 biXPelsPerMeter;
|
||||
_INT32 biYPelsPerMeter;
|
||||
_UINT32 biClrUsed;
|
||||
_UINT32 biClrImportant;
|
||||
};
|
||||
|
||||
struct __BITMAPCOREHEADER
|
||||
{
|
||||
_UINT32 bcSize; /* used to get to color table */
|
||||
_UINT16 bcWidth;
|
||||
_UINT16 bcHeight;
|
||||
_UINT16 bcPlanes;
|
||||
_UINT16 bcBitCount;
|
||||
};
|
||||
|
||||
Global::_BlipType SaveImageToFileFromDIB(unsigned char* data, int size, const std::wstring& file_name);
|
||||
}
|
||||
|
||||
|
||||
@ -67,7 +67,7 @@ namespace DocFileFormat
|
||||
XMLTools::XMLAttribute layoutType ( L"w:type", L"fixed");
|
||||
bool bLayoutFixed = true;
|
||||
|
||||
short tblIndent = 0;
|
||||
_CP_OPT(short) tblIndent;
|
||||
short gabHalf = 0;
|
||||
short marginLeft = 0;
|
||||
short marginRight = 0;
|
||||
@ -98,8 +98,7 @@ namespace DocFileFormat
|
||||
//For this cases we can calculate the indent of the table by getting the
|
||||
//first boundary of the TDef and adding the padding of the cells
|
||||
|
||||
tblIndent = FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize );
|
||||
tblIndent += gabHalf;
|
||||
tblIndent = gabHalf + FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize );
|
||||
//If there follows a real sprmTWidthIndent, this value will be overwritten
|
||||
|
||||
//tblIndent = (std::max)((int)tblIndent,0); //cerere.doc
|
||||
@ -404,11 +403,11 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
//indent
|
||||
if ( tblIndent != 0 )
|
||||
if ( tblIndent )
|
||||
{
|
||||
XMLTools::XMLElement tblInd( L"w:tblInd");
|
||||
|
||||
XMLTools::XMLAttribute tblIndW( L"w:w", FormatUtils::IntToWideString( tblIndent ) );
|
||||
XMLTools::XMLAttribute tblIndW( L"w:w", FormatUtils::IntToWideString( *tblIndent ) );
|
||||
tblInd.AppendAttribute( tblIndW );
|
||||
|
||||
XMLTools::XMLAttribute tblIndType( L"w:type", L"dxa");
|
||||
|
||||
@ -220,15 +220,12 @@ namespace DocFileFormat
|
||||
return res;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
void VMLPictureMapping::appendStyleProperty(std::wstring* b, const std::wstring& propName, const std::wstring& propValue) const
|
||||
void VMLPictureMapping::appendStyleProperty(std::wstring& style, const std::wstring& propName, const std::wstring& propValue) const
|
||||
{
|
||||
if ( b != NULL )
|
||||
{
|
||||
b->operator += ( propName );
|
||||
b->operator += ( L":" );
|
||||
b->operator += ( propValue );
|
||||
b->operator +=( L";" );
|
||||
}
|
||||
style += ( propName );
|
||||
style += ( L":" );
|
||||
style += ( propValue );
|
||||
style +=( L";" );
|
||||
}
|
||||
|
||||
VMLPictureMapping::VMLPictureMapping(ConversionContext* ctx, XMLTools::CStringXmlWriter* writer, bool olePreview, IMapping* caller, bool isInlinePicture) : PropertiesMapping(writer)
|
||||
@ -295,6 +292,7 @@ namespace DocFileFormat
|
||||
|
||||
type.Convert( vmlShapeTypeMapping );
|
||||
RELEASEOBJECT( vmlShapeTypeMapping );
|
||||
|
||||
}
|
||||
else if (pict->embeddedData)
|
||||
{
|
||||
@ -420,23 +418,23 @@ namespace DocFileFormat
|
||||
std::wstring v = strHeight;
|
||||
strHeight = strWidth; strWidth = v;
|
||||
|
||||
appendStyleProperty(&strStyle, L"rotation", FormatUtils::DoubleToWideString(dAngle));
|
||||
appendStyleProperty(strStyle, L"rotation", FormatUtils::DoubleToWideString(dAngle));
|
||||
}break;
|
||||
case posh:
|
||||
{
|
||||
appendStyleProperty(&strStyle, L"mso-position-horizontal", VMLShapeMapping::mapHorizontalPosition((PositionHorizontal)iter->op));
|
||||
appendStyleProperty(strStyle, L"mso-position-horizontal", VMLShapeMapping::mapHorizontalPosition((PositionHorizontal)iter->op));
|
||||
}break;
|
||||
case posrelh:
|
||||
{
|
||||
appendStyleProperty(&strStyle, L"mso-position-horizontal-relative", VMLShapeMapping::mapHorizontalPositionRelative((PositionHorizontalRelative)iter->op));
|
||||
appendStyleProperty(strStyle, L"mso-position-horizontal-relative", VMLShapeMapping::mapHorizontalPositionRelative((PositionHorizontalRelative)iter->op));
|
||||
}break;
|
||||
case posv:
|
||||
{
|
||||
appendStyleProperty(&strStyle, L"mso-position-vertical", VMLShapeMapping::mapVerticalPosition((PositionVertical)iter->op));
|
||||
appendStyleProperty(strStyle, L"mso-position-vertical", VMLShapeMapping::mapVerticalPosition((PositionVertical)iter->op));
|
||||
}break;
|
||||
case posrelv:
|
||||
{
|
||||
appendStyleProperty(&strStyle, L"mso-position-vertical-relative", VMLShapeMapping::mapVerticalPositionRelative((PositionVerticalRelative)iter->op));
|
||||
appendStyleProperty(strStyle, L"mso-position-vertical-relative", VMLShapeMapping::mapVerticalPositionRelative((PositionVerticalRelative)iter->op));
|
||||
}break;
|
||||
case groupShapeBooleans:
|
||||
{
|
||||
@ -445,7 +443,7 @@ namespace DocFileFormat
|
||||
if (booleans->fUsefBehindDocument && booleans->fBehindDocument)
|
||||
{
|
||||
//The shape is behind the text, so the z-index must be negative.
|
||||
appendStyleProperty(&strStyle, L"z-index", L"-1" );
|
||||
appendStyleProperty(strStyle, L"z-index", L"-1" );
|
||||
}
|
||||
//else if (!m_isInlinePicture)
|
||||
//{
|
||||
@ -454,7 +452,7 @@ namespace DocFileFormat
|
||||
|
||||
if (booleans->fHidden && booleans->fUsefHidden)
|
||||
{
|
||||
appendStyleProperty(&strStyle, L"visibility", L"hidden");
|
||||
appendStyleProperty(strStyle, L"visibility", L"hidden");
|
||||
}
|
||||
}break;
|
||||
default:
|
||||
@ -499,7 +497,8 @@ namespace DocFileFormat
|
||||
appendValueAttribute(m_imageData, L"o:title", L"" );
|
||||
m_pXmlWriter->WriteString(m_imageData->GetXMLString());
|
||||
}
|
||||
|
||||
else
|
||||
m_isPictureBroken = true;
|
||||
|
||||
{//borders
|
||||
writePictureBorder( L"bordertop", pict->brcTop );
|
||||
@ -558,10 +557,10 @@ namespace DocFileFormat
|
||||
pict->embeddedDataSize += lLenHeader;
|
||||
delete []pict->embeddedData;
|
||||
pict->embeddedData = newData;
|
||||
|
||||
}
|
||||
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(Global::msoblipDIB),
|
||||
std::vector<unsigned char>(pict->embeddedData, (pict->embeddedData + pict->embeddedDataSize)), Global::msoblipDIB));
|
||||
pict->embeddedData, pict->embeddedDataSize, Global::msoblipDIB));
|
||||
|
||||
m_nImageId = m_context->_docx->RegisterImage(m_caller, btWin32);
|
||||
result = true;
|
||||
@ -578,26 +577,44 @@ namespace DocFileFormat
|
||||
if (metaBlip)
|
||||
{//decompress inside MetafilePictBlip
|
||||
unsigned char *newData = NULL;
|
||||
int newDataSize = metaBlip->oMetaFile.ToBuffer(newData);
|
||||
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlipEntry->btWin32), std::vector<unsigned char>(newData, (newData + newDataSize))));
|
||||
|
||||
RELEASEARRAYOBJECTS(newData);
|
||||
}
|
||||
}
|
||||
break;
|
||||
unsigned int newDataSize = metaBlip->oMetaFile.ToBuffer(newData);
|
||||
|
||||
boost::shared_array<unsigned char> arData(newData);
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlipEntry->btWin32), arData, newDataSize));
|
||||
}
|
||||
}break;
|
||||
case Global::msoblipDIB:
|
||||
{//user_manual_v52.doc
|
||||
|
||||
BitmapBlip* bitBlip = static_cast<BitmapBlip*>(oBlipEntry->Blip);
|
||||
if (bitBlip)
|
||||
{
|
||||
std::wstring file_name = m_context->_doc->m_sTempFolder + L"tmp_image";
|
||||
oBlipEntry->btWin32 = ImageHelper::SaveImageToFileFromDIB(bitBlip->m_pvBits, bitBlip->pvBitsSize, file_name);
|
||||
|
||||
if (oBlipEntry->btWin32 == Global::msoblipPNG)
|
||||
{
|
||||
unsigned char* pData = NULL;
|
||||
DWORD nData = 0;
|
||||
if (NSFile::CFileBinary::ReadAllBytes(file_name, &pData, nData))
|
||||
{
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(Global::msoblipPNG),
|
||||
boost::shared_array<unsigned char>(pData), nData, Global::msoblipPNG));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}//в случае ошибки конвертации -храним оригинальный dib
|
||||
case Global::msoblipJPEG:
|
||||
case Global::msoblipCMYKJPEG:
|
||||
case Global::msoblipPNG:
|
||||
case Global::msoblipTIFF:
|
||||
case Global::msoblipDIB:
|
||||
{
|
||||
BitmapBlip* bitBlip = static_cast<BitmapBlip*>(oBlipEntry->Blip);
|
||||
if (bitBlip)
|
||||
{
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlipEntry->btWin32),
|
||||
std::vector<unsigned char>(bitBlip->m_pvBits, (bitBlip->m_pvBits + bitBlip->pvBitsSize)), oBlipEntry->btWin32));
|
||||
bitBlip->m_pvBits, bitBlip->pvBitsSize, oBlipEntry->btWin32));
|
||||
}
|
||||
}break;
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ namespace DocFileFormat
|
||||
private:
|
||||
/// Writes a border element
|
||||
void writePictureBorder (const std::wstring & name, const BorderCode* brc);
|
||||
void appendStyleProperty( std::wstring* b, const std::wstring& propName, const std::wstring& propValue ) const;
|
||||
void appendStyleProperty( std::wstring& style, const std::wstring& propName, const std::wstring& propValue ) const;
|
||||
bool ParseEmbeddedEquation( const std::string & xmlString, std::wstring & newXmlString );
|
||||
bool ParseEmbeddedBlob(const std::string & xmlString, std::wstring & newXmlString);
|
||||
std::wstring GetShapeID(const Shape* pShape) const;
|
||||
@ -74,6 +74,7 @@ namespace DocFileFormat
|
||||
bool m_isBullete;
|
||||
bool m_isEquation;
|
||||
bool m_isEmbedded;
|
||||
bool m_isPictureBroken;
|
||||
std::string m_embeddedData;
|
||||
std::wstring m_equationXml;
|
||||
std::wstring m_blobXml;
|
||||
|
||||
@ -52,6 +52,7 @@ namespace DocFileFormat
|
||||
{
|
||||
m_isInlineShape = isInlineShape;
|
||||
m_isBullete = false;
|
||||
m_isPictureBroken = false;
|
||||
|
||||
m_pSpa = pSpa;
|
||||
m_pCaller = pCaller;
|
||||
@ -277,6 +278,7 @@ namespace DocFileFormat
|
||||
bool layoutInCell = true; //anmeldebogenfos.doc
|
||||
bool b3D = false;
|
||||
bool bShadow = false;
|
||||
bool bPicturePresent = false;
|
||||
|
||||
int ndxTextLeft = -1;
|
||||
int ndyTextTop = -1;
|
||||
@ -565,6 +567,8 @@ namespace DocFileFormat
|
||||
{
|
||||
appendValueAttribute(&m_fill, L"r:id", std::wstring(( L"rId" ) + FormatUtils::IntToWideString(m_nImageId) ));
|
||||
}
|
||||
|
||||
bPicturePresent = true;
|
||||
}break;
|
||||
case fillBlipName:
|
||||
{
|
||||
@ -647,6 +651,7 @@ namespace DocFileFormat
|
||||
appendValueAttribute(&m_imagedata, L"r:id", ( std::wstring( L"rId" ) + FormatUtils::IntToWideString(m_nImageId) ));
|
||||
}
|
||||
}
|
||||
bPicturePresent = true;
|
||||
}break;
|
||||
case pibName:
|
||||
{
|
||||
@ -665,7 +670,7 @@ namespace DocFileFormat
|
||||
{
|
||||
ODRAW::ThreeDObjectBooleanProperties* booleans = dynamic_cast<ODRAW::ThreeDObjectBooleanProperties*>(iter.get());
|
||||
|
||||
if (booleans->fUsef3D && !booleans->f3D)
|
||||
if ((booleans) && (booleans->fUsef3D && !booleans->f3D))
|
||||
b3D = false;
|
||||
}break;
|
||||
case c3DRenderMode:
|
||||
@ -751,11 +756,11 @@ namespace DocFileFormat
|
||||
break;
|
||||
case 1:
|
||||
case 5://верт (склони голову направо)
|
||||
appendStyleProperty(&sTextboxStyle, L"layout-flow", L"vertical");
|
||||
appendStyleProperty(sTextboxStyle, L"layout-flow", L"vertical");
|
||||
break;
|
||||
case 2://верт (склони голову налево)
|
||||
appendStyleProperty(&sTextboxStyle, L"layout-flow", L"vertical");
|
||||
appendStyleProperty(&sTextboxStyle, L"mso-layout-flow-alt", L"bottom-to-top");
|
||||
appendStyleProperty(sTextboxStyle, L"layout-flow", L"vertical");
|
||||
appendStyleProperty(sTextboxStyle, L"mso-layout-flow-alt", L"bottom-to-top");
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
@ -789,18 +794,18 @@ namespace DocFileFormat
|
||||
if (i < font.size()) font.erase(font.begin() + i, font.end());
|
||||
|
||||
font = std::wstring(L"\"") + font + std::wstring(L"\"");
|
||||
appendStyleProperty(&m_textPathStyle, L"font-family", font);
|
||||
appendStyleProperty(m_textPathStyle, L"font-family", font);
|
||||
}
|
||||
}break;
|
||||
case gtextSize:
|
||||
{
|
||||
std::wstring fontSize = FormatUtils::IntToWideString(iter->op/65535);
|
||||
appendStyleProperty(&m_textPathStyle, L"font-size", fontSize + L"pt");
|
||||
appendStyleProperty(m_textPathStyle, L"font-size", fontSize + L"pt");
|
||||
}break;
|
||||
case gtextSpacing:
|
||||
{
|
||||
std::wstring spacing = FormatUtils::IntToWideString(iter->op);
|
||||
appendStyleProperty(&m_textPathStyle, L"v-text-spacing", spacing + L"f");
|
||||
appendStyleProperty(m_textPathStyle, L"v-text-spacing", spacing + L"f");
|
||||
}break;
|
||||
case geometryTextBooleanProperties:
|
||||
{
|
||||
@ -815,20 +820,20 @@ namespace DocFileFormat
|
||||
}
|
||||
if (props->fUsegFVertical && props->fVertical)
|
||||
{
|
||||
appendStyleProperty(&m_textPathStyle, L"v-rotate-letters", L"t");
|
||||
appendStyleProperty(m_textPathStyle, L"v-rotate-letters", L"t");
|
||||
//_twistDimension = true;
|
||||
}
|
||||
if (props->fUsegFKern && props->fKern)
|
||||
{
|
||||
appendStyleProperty(&m_textPathStyle, L"v-text-kern", L"t");
|
||||
appendStyleProperty(m_textPathStyle, L"v-text-kern", L"t");
|
||||
}
|
||||
if (props->fUsegFItalic && props->fItalic)
|
||||
{
|
||||
appendStyleProperty(&m_textPathStyle, L"font-style", L"italic");
|
||||
appendStyleProperty(m_textPathStyle, L"font-style", L"italic");
|
||||
}
|
||||
if (props->fUsegFBold && props->fBold)
|
||||
{
|
||||
appendStyleProperty(&m_textPathStyle, L"font-weight", L"bold");
|
||||
appendStyleProperty(m_textPathStyle, L"font-weight", L"bold");
|
||||
}
|
||||
}break;
|
||||
default:
|
||||
@ -873,10 +878,10 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteAttribute( L"coordsize", ( FormatUtils::IntToWideString( *xCoord ) + L"," + FormatUtils::IntToWideString( *yCoord ) ));
|
||||
}
|
||||
|
||||
int nCode = 0;
|
||||
int nCode = 0;
|
||||
if (pShape->GetShapeType())
|
||||
{
|
||||
nCode = pShape->GetShapeType()->GetTypeCode();
|
||||
nCode = pShape->GetShapeType()->GetTypeCode();
|
||||
}
|
||||
|
||||
if (DocFileFormat::msosptRoundRectangle == nCode)
|
||||
@ -886,6 +891,11 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteAttribute(L"arcsize", m_nAdjValues[0]);
|
||||
}
|
||||
}
|
||||
else if (DocFileFormat::msosptPictureFrame == nCode)
|
||||
{
|
||||
if (bPicturePresent == false)
|
||||
m_isPictureBroken = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nAdjValues > 0)
|
||||
@ -1262,7 +1272,9 @@ namespace DocFileFormat
|
||||
std::wstring VMLShapeMapping::GetWrapCoords(const ODRAW::OfficeArtFOPTEPtr& pOpt) const
|
||||
{
|
||||
ODRAW::PWrapPolygonVertices* pWrapPolygonVertices = dynamic_cast<ODRAW::PWrapPolygonVertices*>(pOpt.get());
|
||||
|
||||
if (!pWrapPolygonVertices) return L"";
|
||||
if (pWrapPolygonVertices->complex.data.empty()) return L"";
|
||||
|
||||
std::wstring coords;
|
||||
|
||||
@ -1281,7 +1293,7 @@ namespace DocFileFormat
|
||||
|
||||
/// Copies the picture from the binary stream to the zip archive
|
||||
/// and creates the relationships for the image.
|
||||
bool VMLShapeMapping::copyPicture(const BlipStoreEntry* oBlip)
|
||||
bool VMLShapeMapping::copyPicture(BlipStoreEntry* oBlip)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
@ -1292,9 +1304,9 @@ namespace DocFileFormat
|
||||
|
||||
switch (oBlip->btWin32)
|
||||
{
|
||||
case Global::msoblipEMF:
|
||||
case Global::msoblipWMF:
|
||||
case Global::msoblipPICT:
|
||||
case Global::msoblipEMF:
|
||||
case Global::msoblipWMF:
|
||||
case Global::msoblipPICT:
|
||||
{
|
||||
//it's a meta image
|
||||
MetafilePictBlip* metaBlip = static_cast<MetafilePictBlip*>(RecordFactory::ReadRecord(&reader, 0));
|
||||
@ -1302,38 +1314,53 @@ namespace DocFileFormat
|
||||
{
|
||||
//meta images can be compressed
|
||||
unsigned char* decompressed = NULL;
|
||||
int decompressedSize = 0;
|
||||
unsigned int decompressedSize = 0;
|
||||
|
||||
decompressedSize = metaBlip->Decompress(&decompressed);
|
||||
|
||||
if (0 != decompressedSize && NULL != decompressed)
|
||||
{
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlip->btWin32), std::vector<unsigned char>(decompressed, (decompressed + decompressedSize))));
|
||||
RELEASEARRAYOBJECTS(decompressed);
|
||||
boost::shared_array<unsigned char> arDecompressed(decompressed);
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlip->btWin32), arDecompressed, decompressedSize));
|
||||
}
|
||||
|
||||
RELEASEOBJECT(metaBlip);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Global::msoblipJPEG:
|
||||
case Global::msoblipCMYKJPEG:
|
||||
case Global::msoblipPNG:
|
||||
case Global::msoblipTIFF:
|
||||
case Global::msoblipDIB:
|
||||
{
|
||||
//it's a bitmap image
|
||||
case Global::msoblipJPEG:
|
||||
case Global::msoblipCMYKJPEG:
|
||||
case Global::msoblipPNG:
|
||||
case Global::msoblipTIFF:
|
||||
case Global::msoblipDIB:
|
||||
{//it's a bitmap image
|
||||
BitmapBlip* bitBlip = static_cast<BitmapBlip*>(RecordFactory::ReadRecord(&reader, 0));
|
||||
if ((bitBlip) && (bitBlip->m_pvBits))
|
||||
{
|
||||
if (oBlip->btWin32 == Global::msoblipDIB)
|
||||
{
|
||||
std::wstring file_name = m_context->_doc->m_sTempFolder + L"tmp_image";
|
||||
|
||||
if (Global::msoblipPNG == ImageHelper::SaveImageToFileFromDIB(bitBlip->m_pvBits, bitBlip->pvBitsSize, file_name))
|
||||
{
|
||||
oBlip->btWin32 = Global::msoblipPNG;
|
||||
|
||||
unsigned char* pData = NULL;
|
||||
DWORD nData = 0;
|
||||
if (NSFile::CFileBinary::ReadAllBytes(file_name, &pData, nData))
|
||||
{
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(Global::msoblipPNG),
|
||||
boost::shared_array<unsigned char>(pData), nData, Global::msoblipPNG));
|
||||
break;
|
||||
}
|
||||
}//в случае ошибки конвертации -храним оригинальный dib
|
||||
}
|
||||
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlip->btWin32),
|
||||
std::vector<unsigned char>(bitBlip->m_pvBits, (bitBlip->m_pvBits + bitBlip->pvBitsSize)), oBlip->btWin32));
|
||||
bitBlip->m_pvBits, bitBlip->pvBitsSize, oBlip->btWin32));
|
||||
RELEASEOBJECT (bitBlip);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
}break;
|
||||
default:
|
||||
{
|
||||
result = false;
|
||||
return result;
|
||||
@ -1389,9 +1416,9 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
void VMLShapeMapping::AppendDimensionToStyle(std::wstring* style, const PictureDescriptor* pict, bool twistDimensions) const
|
||||
void VMLShapeMapping::AppendDimensionToStyle(std::wstring& style, const PictureDescriptor* pict, bool twistDimensions) const
|
||||
{
|
||||
if ( ( style != NULL ) && ( pict != NULL ) )
|
||||
if ( pict != NULL )
|
||||
{
|
||||
double xScaling = pict->mx / 1000.0;
|
||||
double yScaling = pict->my / 1000.0;
|
||||
@ -1408,26 +1435,23 @@ namespace DocFileFormat
|
||||
std::wstring widthString = FormatUtils::DoubleToWideString( width.ToPoints() );
|
||||
std::wstring heightString = FormatUtils::DoubleToWideString( height.ToPoints() );
|
||||
|
||||
style->operator += ( std::wstring( L"width:" ) + widthString + std::wstring( L"pt;" ) );
|
||||
style->operator += ( std::wstring( L"height:" ) + heightString + std::wstring( L"pt;" ) );
|
||||
style += L"width:" + widthString + L"pt;" ;
|
||||
style += L"height:" + heightString + L"pt;";
|
||||
}
|
||||
}
|
||||
|
||||
void VMLShapeMapping::AppendDimensionToStyle(std::wstring* style, const Spa* pSpa, bool twistDimensions) const
|
||||
void VMLShapeMapping::AppendDimensionToStyle(std::wstring& style, const Spa* pSpa, bool twistDimensions) const
|
||||
{
|
||||
if ( ( style != NULL ) && (pSpa != NULL ) )
|
||||
if (pSpa != NULL )
|
||||
{
|
||||
//append size and position ...
|
||||
|
||||
//if (pSpa->fAnchorLock )
|
||||
//if (pSpa->bx == TEXT && pSpa->by == TEXT)
|
||||
//{
|
||||
if (m_isInlineShape)
|
||||
{
|
||||
// appendStyleProperty( style, L"position", L"static" );
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
appendStyleProperty( style, L"position", L"absolute" );
|
||||
//}
|
||||
}
|
||||
else
|
||||
appendStylePropertyFirst( style, L"position", L"absolute" );
|
||||
|
||||
TwipsValue left (pSpa->xaLeft);
|
||||
TwipsValue top (pSpa->yaTop);
|
||||
@ -1450,9 +1474,9 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
void VMLShapeMapping::AppendDimensionToStyle(std::wstring* style, const ChildAnchor* anchor, bool twistDimensions) const
|
||||
void VMLShapeMapping::AppendDimensionToStyle(std::wstring& style, const ChildAnchor* anchor, bool twistDimensions) const
|
||||
{
|
||||
if ((style != NULL) && (anchor != NULL))
|
||||
if (anchor != NULL)
|
||||
{
|
||||
DocFileFormat::Rectangle bounds = anchor->rcgBounds;
|
||||
|
||||
@ -1462,34 +1486,40 @@ namespace DocFileFormat
|
||||
bounds.topLeftAngle.y = static_cast<LONG>(((anchor->Bottom + anchor->Top) * 0.5 - (anchor->Right - anchor->Left) * 0.5));
|
||||
}
|
||||
|
||||
appendStyleProperty(style, L"position", L"absolute");
|
||||
appendStyleProperty(style, L"left", FormatUtils::IntToWideString(bounds.topLeftAngle.x));
|
||||
appendStyleProperty(style, L"top", FormatUtils::IntToWideString(bounds.topLeftAngle.y));
|
||||
appendStylePropertyFirst(style, L"top", FormatUtils::IntToWideString(bounds.topLeftAngle.y));
|
||||
appendStylePropertyFirst(style, L"left", FormatUtils::IntToWideString(bounds.topLeftAngle.x));
|
||||
appendStylePropertyFirst(style, L"position", L"absolute");
|
||||
|
||||
if (twistDimensions)
|
||||
{
|
||||
appendStyleProperty(style, L"width", FormatUtils::IntToWideString(bounds.size.cy));
|
||||
appendStyleProperty(style, L"height", FormatUtils::IntToWideString(bounds.size.cx));
|
||||
appendStylePropertyFirst(style, L"width", FormatUtils::IntToWideString(bounds.size.cy));
|
||||
appendStylePropertyFirst(style, L"height", FormatUtils::IntToWideString(bounds.size.cx));
|
||||
}
|
||||
else
|
||||
{
|
||||
appendStyleProperty(style, L"width", FormatUtils::IntToWideString(bounds.size.cx));
|
||||
appendStyleProperty(style, L"height", FormatUtils::IntToWideString(bounds.size.cy));
|
||||
appendStylePropertyFirst(style, L"width", FormatUtils::IntToWideString(bounds.size.cx));
|
||||
appendStylePropertyFirst(style, L"height", FormatUtils::IntToWideString(bounds.size.cy));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VMLShapeMapping::appendStyleProperty(std::wstring* b, const std::wstring& propName, const std::wstring& propValue) const
|
||||
void VMLShapeMapping::appendStyleProperty(std::wstring& style, const std::wstring& propName, const std::wstring& propValue) const
|
||||
{
|
||||
if ( b != NULL )
|
||||
{
|
||||
b->operator += ( propName );
|
||||
b->operator += ( L":" );
|
||||
b->operator += ( propValue );
|
||||
b->operator +=( L";" );
|
||||
}
|
||||
style += ( propName );
|
||||
style += ( L":" );
|
||||
style += ( propValue );
|
||||
style +=( L";" );
|
||||
}
|
||||
void VMLShapeMapping::appendStylePropertyFirst(std::wstring& style, const std::wstring& propName, const std::wstring& propValue) const
|
||||
{
|
||||
std::wstring s;
|
||||
s += ( propName );
|
||||
s += ( L":" );
|
||||
s += ( propValue );
|
||||
s +=( L";" );
|
||||
|
||||
style = s + style;
|
||||
}
|
||||
|
||||
std::wstring VMLShapeMapping::getTextboxAnchor(unsigned int anchor) const
|
||||
{
|
||||
switch ( anchor )
|
||||
@ -1558,22 +1588,22 @@ namespace DocFileFormat
|
||||
PositionHorizontalRelative hRel = (PositionHorizontalRelative )hRel_;
|
||||
switch ( hRel )
|
||||
{
|
||||
case msoprhMargin: return L"margin";
|
||||
case msoprhPage: return L"page";
|
||||
case msoprhText: return L"text";
|
||||
case msoprhChar: return L"char";
|
||||
case msoprhMargin: return L"margin"; //0 //MARGIN = anchor
|
||||
case msoprhPage: return L"page"; //1 //PAGE
|
||||
case msoprhText: return L"text"; //2 //TEXT
|
||||
case msoprhChar: return L"char"; //3
|
||||
default:
|
||||
return L"margin";
|
||||
}
|
||||
}
|
||||
|
||||
void VMLShapeMapping::AppendOptionsToStyle (std::wstring* oStyle, const std::vector<ODRAW::OfficeArtFOPTEPtr>& options, int zIndex) const
|
||||
void VMLShapeMapping::AppendOptionsToStyle (std::wstring& oStyle, const std::vector<ODRAW::OfficeArtFOPTEPtr>& options, int zIndex) const
|
||||
{
|
||||
bool bRelH = false;
|
||||
bool bRelV = false;
|
||||
int nRelH = -1;
|
||||
int nRelV = -1;
|
||||
|
||||
bool bPosH = false;
|
||||
bool bPosV = false;
|
||||
int nPosH = -1;
|
||||
int nPosV = -1;
|
||||
|
||||
bool bZIndex = false;
|
||||
|
||||
@ -1585,36 +1615,40 @@ namespace DocFileFormat
|
||||
// POSITIONING
|
||||
case posh:
|
||||
{
|
||||
appendStyleProperty(oStyle, L"mso-position-horizontal", mapHorizontalPosition((PositionHorizontal)iter->op));
|
||||
bPosH = true;
|
||||
nPosH = iter->op;
|
||||
}break;
|
||||
case posrelh:
|
||||
{
|
||||
nRelH = iter->op;
|
||||
appendStyleProperty(oStyle, L"mso-position-horizontal-relative", mapHorizontalPositionRelative((PositionHorizontalRelative)iter->op));
|
||||
bRelH = true;
|
||||
}break;
|
||||
case posv:
|
||||
{
|
||||
appendStyleProperty(oStyle, L"mso-position-vertical", mapVerticalPosition((PositionVertical)iter->op));
|
||||
bPosV = true;
|
||||
nPosV = iter->op;
|
||||
}break;
|
||||
case posrelv:
|
||||
{
|
||||
nRelV = iter->op;
|
||||
appendStyleProperty(oStyle, L"mso-position-vertical-relative", mapVerticalPositionRelative((PositionVerticalRelative)iter->op));
|
||||
bRelV = true;
|
||||
}break;
|
||||
// BOOLEANS
|
||||
case groupShapeBooleans:
|
||||
{
|
||||
ODRAW::GroupShapeBooleanProperties* booleans = dynamic_cast<ODRAW::GroupShapeBooleanProperties*>(iter.get());
|
||||
|
||||
if (booleans->fUsefBehindDocument && booleans->fBehindDocument && !bZIndex)
|
||||
if (booleans->fUsefBehindDocument && booleans->fBehindDocument)
|
||||
{
|
||||
//The shape is behind the text, so the z-index must be negative.
|
||||
appendStyleProperty(oStyle, L"z-index", L"-1" );
|
||||
bZIndex = true;
|
||||
//за текстом (The shape is behind the text, so the z-index must be negative.)
|
||||
m_isInlineShape = false;
|
||||
|
||||
if (!bZIndex)
|
||||
{
|
||||
appendStyleProperty(oStyle, L"z-index", FormatUtils::IntToWideString(-zIndex - 0x7ffff));
|
||||
bZIndex = true;
|
||||
}
|
||||
}
|
||||
else if (!m_isInlineShape && !bZIndex)
|
||||
|
||||
if (!m_isInlineShape && !bZIndex)
|
||||
{
|
||||
appendStyleProperty( oStyle, L"z-index", FormatUtils::IntToWideString(zIndex + 0x7ffff));
|
||||
bZIndex = true;
|
||||
@ -1662,13 +1696,25 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
if (!bRelH && m_pSpa)
|
||||
if (nRelH < 0 && m_pSpa)
|
||||
{
|
||||
appendStyleProperty(oStyle, L"mso-position-horizontal-relative", mapHorizontalPositionRelative(m_pSpa->bx));
|
||||
if (m_pSpa->bx == TEXT && bZIndex)
|
||||
{
|
||||
m_pSpa->bx = PAGE;
|
||||
}
|
||||
else
|
||||
{//rel column
|
||||
}
|
||||
}
|
||||
if (!bRelV && m_pSpa)
|
||||
if (nRelV < 0 && m_pSpa)
|
||||
{
|
||||
appendStyleProperty(oStyle, L"mso-position-vertical-relative", mapVerticalPositionRelative(m_pSpa->by));
|
||||
if (m_pSpa->by == TEXT && bZIndex)
|
||||
{
|
||||
m_pSpa->by = PAGE;
|
||||
}
|
||||
else
|
||||
{//rel paragraph
|
||||
}
|
||||
}
|
||||
if (!m_isInlineShape && !bZIndex)
|
||||
{
|
||||
@ -1676,6 +1722,19 @@ namespace DocFileFormat
|
||||
bZIndex = true;
|
||||
}
|
||||
|
||||
if (nRelH == 3 && nRelV == 3)
|
||||
{
|
||||
m_isInlineShape = true;
|
||||
}
|
||||
|
||||
if (nPosH >= 0 && !m_isInlineShape)
|
||||
{
|
||||
appendStyleProperty(oStyle, L"mso-position-horizontal", mapHorizontalPosition((PositionHorizontal)nPosH));
|
||||
}
|
||||
if (nPosV >= 0 && !m_isInlineShape)
|
||||
{
|
||||
appendStyleProperty(oStyle, L"mso-position-vertical", mapVerticalPosition((PositionVertical)nPosV));
|
||||
}
|
||||
//if (!bPosH)
|
||||
//{
|
||||
// appendStyleProperty(oStyle, L"mso-position-horizontal", L"absolute" );
|
||||
@ -1719,26 +1778,38 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
if ( shape->fFlipH )
|
||||
{
|
||||
appendStyleProperty( style, L"flip", L"x" );
|
||||
}
|
||||
|
||||
if ( shape->fFlipV )
|
||||
{
|
||||
appendStyleProperty( style, L"flip", L"y" );
|
||||
}
|
||||
|
||||
AppendOptionsToStyle( style, options, zIndex );
|
||||
|
||||
//don't append the dimension info to lines,
|
||||
// because they have "from" and "to" attributes to decline the dimension
|
||||
if(!shape->is<LineType>())
|
||||
if(false == shape->is<LineType>())
|
||||
{
|
||||
if ( (m_pSpa != NULL) && ( anchor == NULL ) )
|
||||
{
|
||||
//this shape is placed directly in the document,
|
||||
//so use the FSPA to build the style
|
||||
AppendDimensionToStyle(&style, m_pSpa, twistDimensions);
|
||||
AppendDimensionToStyle( style, m_pSpa, twistDimensions);
|
||||
}
|
||||
else if (anchor)
|
||||
{
|
||||
//the style is part of a group,
|
||||
//so use the anchor
|
||||
AppendDimensionToStyle(&style, anchor, twistDimensions);
|
||||
AppendDimensionToStyle( style, anchor, twistDimensions);
|
||||
}
|
||||
else if (m_pict)
|
||||
{
|
||||
// it is some kind of PICT shape (e.g. WordArt)
|
||||
AppendDimensionToStyle(&style, m_pict, twistDimensions);
|
||||
AppendDimensionToStyle( style, m_pict, twistDimensions);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1746,36 +1817,23 @@ namespace DocFileFormat
|
||||
//если не написать тип позиции, то будет inline
|
||||
if ( anchor != NULL )
|
||||
{
|
||||
appendStyleProperty( &style, L"position", L"absolute" );
|
||||
appendStylePropertyFirst( style, L"position", L"absolute" );
|
||||
}
|
||||
else if (m_pSpa)
|
||||
{
|
||||
//append size and position ...
|
||||
//if (m_pSpa->fAnchorLock)//это возможность смены привязки , а не ее тип
|
||||
|
||||
//if (m_pSpa->bx == TEXT && m_pSpa->by == TEXT)
|
||||
//{
|
||||
// appendStyleProperty( &style, L"position", L"static" );
|
||||
//}
|
||||
//else
|
||||
if (m_isInlineShape)/*m_pSpa->bx == TEXT && m_pSpa->by == TEXT*/
|
||||
{
|
||||
appendStyleProperty( &style, L"position", L"absolute" );
|
||||
// appendStyleProperty( style, L"position", L"static" );
|
||||
}
|
||||
else
|
||||
{
|
||||
appendStylePropertyFirst( style, L"position", L"absolute" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( shape->fFlipH )
|
||||
{
|
||||
appendStyleProperty( &style, L"flip", L"x" );
|
||||
}
|
||||
|
||||
if ( shape->fFlipV )
|
||||
{
|
||||
appendStyleProperty( &style, L"flip", L"y" );
|
||||
}
|
||||
|
||||
AppendOptionsToStyle( &style, options, zIndex );
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
|
||||
@ -67,6 +67,7 @@ namespace DocFileFormat
|
||||
static std::wstring mapHorizontalPositionRelative(int hRel );
|
||||
|
||||
bool m_isBullete;
|
||||
bool m_isPictureBroken;
|
||||
std::wstring m_shapeId;
|
||||
private:
|
||||
|
||||
@ -79,18 +80,19 @@ namespace DocFileFormat
|
||||
void WriteShape (const ShapeContainer* pContainer);
|
||||
|
||||
std::wstring GenShapeId(const Shape* pShape) const;
|
||||
bool copyPicture( const BlipStoreEntry* bse );
|
||||
bool copyPicture( BlipStoreEntry* bse );
|
||||
std::wstring GetTargetExt( Global::BlipType _type ) const;
|
||||
|
||||
void AppendDimensionToStyle ( std::wstring* style, const PictureDescriptor* pict, bool twistDimensions ) const;
|
||||
void AppendDimensionToStyle ( std::wstring* style, const Spa* pSpa, bool twistDimensions ) const;
|
||||
void AppendDimensionToStyle ( std::wstring* style, const ChildAnchor* anchor, bool twistDimensions ) const;
|
||||
void appendStyleProperty ( std::wstring* b, const std::wstring& propName, const std::wstring& propValue ) const;
|
||||
void AppendDimensionToStyle ( std::wstring& style, const PictureDescriptor* pict, bool twistDimensions ) const;
|
||||
void AppendDimensionToStyle ( std::wstring& style, const Spa* pSpa, bool twistDimensions ) const;
|
||||
void AppendDimensionToStyle ( std::wstring& style, const ChildAnchor* anchor, bool twistDimensions ) const;
|
||||
void appendStyleProperty ( std::wstring& style, const std::wstring& propName, const std::wstring& propValue ) const;
|
||||
void appendStylePropertyFirst( std::wstring& style, const std::wstring& propName, const std::wstring& propValue ) const;
|
||||
|
||||
std::wstring getTextboxAnchor( unsigned int anchor ) const;
|
||||
|
||||
std::wstring buildStyle ( const Shape* shape, const ChildAnchor* anchor, const std::vector<ODRAW::OfficeArtFOPTEPtr>& options, int zIndex ) const;
|
||||
void AppendOptionsToStyle ( std::wstring* style, const std::vector<ODRAW::OfficeArtFOPTEPtr>& options, int zIndex ) const;
|
||||
void AppendOptionsToStyle ( std::wstring& style, const std::vector<ODRAW::OfficeArtFOPTEPtr>& options, int zIndex ) const;
|
||||
|
||||
int UpdateFromGuides(const int val) const;
|
||||
|
||||
@ -122,7 +124,7 @@ namespace DocFileFormat
|
||||
int m_nAdjValues[8];
|
||||
std::vector<ODRAW::MSOSG> m_arrGuides;
|
||||
|
||||
bool m_isInlineShape;
|
||||
mutable bool m_isInlineShape;
|
||||
Spa* m_pSpa;
|
||||
IMapping* m_pCaller;
|
||||
BlipStoreContainer* m_pBlipStore;
|
||||
|
||||
@ -173,12 +173,16 @@ namespace DocFileFormat
|
||||
|
||||
//Lock ???
|
||||
ODRAW::ProtectionBooleanProperties *prot = dynamic_cast<ODRAW::ProtectionBooleanProperties*>(pShape->Lock.get());
|
||||
if ((prot) && (prot->fUsefLockAspectRatio && prot->fLockAspectRatio))
|
||||
if ((prot) && (prot->fUsefLockAspectRatio))
|
||||
{
|
||||
appendValueAttribute( _lock, L"aspectratio", L"t" );
|
||||
appendValueAttribute( _lock, L"aspectratio", prot->fLockAspectRatio ? L"t" : L"f" );
|
||||
}
|
||||
else
|
||||
{
|
||||
appendValueAttribute( _lock, L"aspectratio", L"t");
|
||||
}
|
||||
|
||||
if ( _lock->GetAttributeCount() > 1 )
|
||||
if ( _lock->GetAttributeCount() > 0 )
|
||||
{
|
||||
m_pXmlWriter->WriteString( _lock->GetXMLString() );
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ namespace DocFileFormat
|
||||
Text(NULL), RevisionAuthorTable(NULL), FontTable(NULL), BookmarkNames(NULL), AutoTextNames(NULL),
|
||||
IndividualFootnotesPlex(NULL), FootnoteReferenceCharactersPlex(NULL), IndividualEndnotesPlex(NULL),
|
||||
EndnoteReferenceCharactersPlex(NULL), FieldsPlex(NULL), FootnoteDocumentFieldsPlex(NULL),
|
||||
EndnoteDocumentFieldsPlex(NULL), HeadersAndFootersDocumentFieldsPlex(NULL), HeaderStoriesPlex(NULL),
|
||||
EndnoteDocumentFieldsPlex(NULL), HeadersAndFootersDocumentFieldsPlex(NULL), HeaderStoriesPlex(NULL), AnnotationsFieldsPlex(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),
|
||||
@ -353,7 +353,7 @@ namespace DocFileFormat
|
||||
|
||||
TextboxIndividualPlex = new Plex<FTXBXS> (FTXBXS::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcftxbxTxt, FIB->m_FibWord97.lcbPlcftxbxTxt, nWordVersion);
|
||||
|
||||
SectionPlex = new Plex<SectionDescriptor> (SectionDescriptor::GetSize(nWordVersion), TableStream, FIB->m_FibWord97.fcPlcfSed, FIB->m_FibWord97.lcbPlcfSed, nWordVersion);
|
||||
SectionPlex = new Plex<SectionDescriptor> (SectionDescriptor::GetSize(nWordVersion), TableStream, FIB->m_FibWord97.fcPlcfSed,FIB->m_FibWord97.lcbPlcfSed, nWordVersion);
|
||||
|
||||
BookmarkStartPlex = new Plex<BookmarkFirst> (BookmarkFirst::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBkf, FIB->m_FibWord97.lcbPlcfBkf, nWordVersion);
|
||||
BookmarkEndPlex = new Plex<EmptyStructure> (EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBkl, FIB->m_FibWord97.lcbPlcfBkl, nWordVersion);
|
||||
@ -387,10 +387,13 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
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);
|
||||
EndnoteDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldEdn, FIB->m_FibWord97.lcbPlcfFldEdn, nWordVersion);
|
||||
HeadersAndFootersDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldHdr, FIB->m_FibWord97.lcbPlcfFldHdr, nWordVersion);
|
||||
AnnotationsFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldAtn, FIB->m_FibWord97.lcbPlcfFldAtn, nWordVersion);
|
||||
|
||||
ListPlex = new Plex<ListNumCache> (ListNumCache::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBteLvc, FIB->m_FibWord97.lcbPlcfBteLvc, nWordVersion);
|
||||
|
||||
if (m_pCallFunc)
|
||||
@ -872,6 +875,7 @@ namespace DocFileFormat
|
||||
RELEASEOBJECT(FootnoteDocumentFieldsPlex);
|
||||
RELEASEOBJECT(EndnoteDocumentFieldsPlex);
|
||||
RELEASEOBJECT(HeadersAndFootersDocumentFieldsPlex);
|
||||
RELEASEOBJECT(AnnotationsFieldsPlex);
|
||||
RELEASEOBJECT(HeaderStoriesPlex);
|
||||
RELEASEOBJECT(IndividualCommentsPlex);
|
||||
RELEASEOBJECT(AnnotationsReferencePlex);
|
||||
|
||||
@ -224,6 +224,7 @@ namespace DocFileFormat
|
||||
Plex<FieldCharacter> *FootnoteDocumentFieldsPlex;
|
||||
Plex<FieldCharacter> *EndnoteDocumentFieldsPlex;
|
||||
Plex<FieldCharacter> *HeadersAndFootersDocumentFieldsPlex;
|
||||
Plex<FieldCharacter> *AnnotationsFieldsPlex;
|
||||
Plex<AnnotationReferenceDescriptor> *AnnotationsReferencePlex;
|
||||
Plex<AnnotationReferenceExDescriptor> *AnnotationsReferenceExPlex;
|
||||
Plex<EmptyStructure> *AutoTextPlex;
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
|
||||
#include "WordprocessingDocument.h"
|
||||
|
||||
#include "../../DesktopEditor/raster/BgraFrame.h"
|
||||
#include "../../DesktopEditor/common/Directory.h"
|
||||
#include "../../DesktopEditor/common/SystemUtils.h"
|
||||
|
||||
@ -40,136 +39,6 @@
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Core.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/ContentTypes.h"
|
||||
|
||||
namespace ImageHelper
|
||||
{
|
||||
struct __BITMAPINFOHEADER
|
||||
{
|
||||
_UINT32 biSize;
|
||||
_INT32 biWidth;
|
||||
_INT32 biHeight;
|
||||
_UINT16 biPlanes;
|
||||
_UINT16 biBitCount;
|
||||
_UINT32 biCompression;
|
||||
_UINT32 biSizeImage;
|
||||
_INT32 biXPelsPerMeter;
|
||||
_INT32 biYPelsPerMeter;
|
||||
_UINT32 biClrUsed;
|
||||
_UINT32 biClrImportant;
|
||||
};
|
||||
|
||||
struct __BITMAPCOREHEADER
|
||||
{
|
||||
_UINT32 bcSize; /* used to get to color table */
|
||||
_UINT16 bcWidth;
|
||||
_UINT16 bcHeight;
|
||||
_UINT16 bcPlanes;
|
||||
_UINT16 bcBitCount;
|
||||
};
|
||||
|
||||
inline Global::_BlipType SaveImageToFileFromDIB(unsigned char* data, int size, const std::wstring& file_name)//without ext
|
||||
{
|
||||
Global::_BlipType result = Global::msoblipERROR;
|
||||
|
||||
CBgraFrame oFrame;
|
||||
int offset = 0, biSizeImage = 0;
|
||||
|
||||
__BITMAPINFOHEADER * header = (__BITMAPINFOHEADER*)data;
|
||||
if (!header) return result;
|
||||
|
||||
result = Global::msoblipDIB;
|
||||
|
||||
if (header->biWidth > 100000 || header->biHeight > 100000 || header->biSize != 40)
|
||||
{
|
||||
__BITMAPCOREHEADER * header_core = (__BITMAPCOREHEADER *)data;
|
||||
if (header_core->bcSize != 12)
|
||||
{
|
||||
result = Global::msoblipWMF;
|
||||
}
|
||||
else
|
||||
{
|
||||
offset = 12; //sizeof(BITMAPCOREHEADER)
|
||||
|
||||
oFrame.put_Height (header_core->bcHeight );
|
||||
oFrame.put_Width (header_core->bcWidth );
|
||||
|
||||
int sz_bitmap = header_core->bcHeight * header_core->bcWidth * header_core->bcBitCount/ 8;
|
||||
|
||||
//if (header_core->bcWidth % 2 != 0 && sz_bitmap < size - offset)
|
||||
// header_core->bcWidth++;
|
||||
///???? todooo непонятно .. в biff5 нужно флипать картинку, в biff8 не ясно ( -
|
||||
|
||||
int stride = -(size - offset) / header_core->bcHeight;
|
||||
oFrame.put_Stride (stride/*header_core->bcBitCount * header_core->bcWidth /8 */);
|
||||
|
||||
biSizeImage = size - offset;
|
||||
|
||||
if (-stride >= header_core->bcWidth && header_core->bcBitCount >=24 )
|
||||
{
|
||||
result = Global::msoblipPNG;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
offset = 40; //sizeof(BITMAPINFOHEADER)
|
||||
|
||||
oFrame.put_Height (header->biHeight );
|
||||
oFrame.put_Width (header->biWidth );
|
||||
|
||||
int sz_bitmap = header->biHeight * header->biWidth * header->biBitCount/ 8;
|
||||
|
||||
//if (header->biWidth % 2 != 0 && sz_bitmap < size -offset)
|
||||
// header->biWidth++;
|
||||
|
||||
int stride = -(size - offset) / header->biHeight;
|
||||
|
||||
if (-stride >= header->biWidth && header->biBitCount >= 24)
|
||||
{
|
||||
result = Global::msoblipPNG;
|
||||
}
|
||||
oFrame.put_Stride (stride/*header->biBitCount * header->biWidth /8*/);
|
||||
|
||||
biSizeImage = header->biSizeImage > 0 ? header->biSizeImage : (size - offset);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
if (result == Global::msoblipPNG)
|
||||
{
|
||||
oFrame.put_Data((unsigned char*)data + offset);
|
||||
|
||||
if (!oFrame.SaveFile(file_name + L".png", 4/*CXIMAGE_FORMAT_PNG*/))
|
||||
result = Global::msoblipERROR;
|
||||
|
||||
oFrame.put_Data(NULL);
|
||||
}
|
||||
else if (result == Global::msoblipWMF)
|
||||
{
|
||||
NSFile::CFileBinary file;
|
||||
if (file.CreateFileW(file_name + L".wmf"))
|
||||
{
|
||||
file.WriteFile((BYTE*)data, size);
|
||||
file.CloseFile();
|
||||
}
|
||||
}
|
||||
else if (biSizeImage > 0)
|
||||
{
|
||||
NSFile::CFileBinary file;
|
||||
if (file.CreateFileW(file_name + L".bmp"))
|
||||
{
|
||||
_UINT16 vtType = 0x4D42; file.WriteFile((BYTE*)&vtType, 2);
|
||||
_UINT32 dwLen = biSizeImage; file.WriteFile((BYTE*)&dwLen, 4);
|
||||
_UINT32 dwRes = 0; file.WriteFile((BYTE*)&dwRes, 4);
|
||||
_UINT32 dwOffset = 2; file.WriteFile((BYTE*)&dwOffset, 4);
|
||||
|
||||
file.WriteFile((BYTE*)data, size);
|
||||
file.CloseFile();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
WordprocessingDocument::WordprocessingDocument(const std::wstring & _pathOutput, const WordDocument* _docFile) :
|
||||
@ -275,24 +144,7 @@ namespace DocFileFormat
|
||||
|
||||
for (std::list<ImageFileStructure>::iterator iter = ImagesList.begin(); iter != ImagesList.end(); ++iter)
|
||||
{
|
||||
unsigned char* bytes = NULL;
|
||||
bytes = new unsigned char[iter->data.size()];
|
||||
if (bytes)
|
||||
{
|
||||
copy(iter->data.begin(), iter->data.end(), bytes);
|
||||
|
||||
if (Global::msoblipDIB == iter->blipType)
|
||||
{//user_manual_v52.doc
|
||||
std::wstring file_name = pathMedia + FILE_SEPARATOR_STR + L"image" + FormatUtils::IntToWideString(i++);
|
||||
iter->blipType = ImageHelper::SaveImageToFileFromDIB(bytes, iter->data.size(), file_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
SaveToFile(pathMedia, std::wstring(L"image" ) + FormatUtils::IntToWideString(i++) + iter->ext, (void*)bytes, (unsigned int)iter->data.size());
|
||||
}
|
||||
|
||||
RELEASEARRAYOBJECTS(bytes);
|
||||
}
|
||||
SaveToFile(pathMedia, std::wstring(L"image" ) + FormatUtils::IntToWideString(i++) + iter->ext, (void*)iter->data.get(), iter->size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,20 +2,17 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocFormatLib", "..\DocFormatLib\Win32\DocFormatLib.vcproj", "{C5371405-338F-4B70-83BD-2A5CDF64F383}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C} = {C27E9A9F-3A17-4482-9C5F-BF15C01E747C}
|
||||
{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D} = {77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XlsFormat", "..\..\ASCOfficeXlsFile2\source\win32\XlsFormat.vcproj", "{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocFormatTest", "DocFormatTest.vcproj", "{0F49D5D1-A8D3-4F97-8BC1-E2F65BB00C10}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{C5371405-338F-4B70-83BD-2A5CDF64F383} = {C5371405-338F-4B70-83BD-2A5CDF64F383}
|
||||
{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D} = {77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}
|
||||
{36636678-AE25-4BE6-9A34-2561D1BCF302} = {36636678-AE25-4BE6-9A34-2561D1BCF302}
|
||||
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
|
||||
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF} = {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}
|
||||
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C} = {C27E9A9F-3A17-4482-9C5F-BF15C01E747C}
|
||||
{C5371405-338F-4B70-83BD-2A5CDF64F383} = {C5371405-338F-4B70-83BD-2A5CDF64F383}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocxFormat", "..\..\Common\DocxFormat\Projects\DocxFormat2005.vcproj", "{A100103A-353E-45E8-A9B8-90B87CC5C0B0}"
|
||||
|
||||
@ -345,6 +345,14 @@
|
||||
RelativePath="..\..\DesktopEditor\common\Base64.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\XlsxSerializerCom\Writer\BinaryReader.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\XlsxSerializerCom\Reader\BinaryWriter.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ASCOfficeDocxFile2\BinWriter\BinWriters.cpp"
|
||||
>
|
||||
|
||||
@ -41,6 +41,8 @@ namespace Writers
|
||||
static std::wstring g_string_comment_End = _T("</w:comments>");
|
||||
static std::wstring g_string_commentExt_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w15:commentsEx xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 w15 wp14\">");
|
||||
static std::wstring g_string_commentExt_End = _T("</w15:commentsEx>");
|
||||
static std::wstring g_string_commentsIds_Start = _T("<w16cid:commentsIds mc:Ignorable=\"w16cid\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:w16cid=\"http://schemas.microsoft.com/office/word/2016/wordml/cid\">");
|
||||
static std::wstring g_string_commentsIds_End = _T("</w16cid:commentsIds>");
|
||||
static std::wstring g_string_people_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w15:people xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 w15 wp14\">");
|
||||
static std::wstring g_string_people_End = _T("</w15:people>");
|
||||
|
||||
@ -50,21 +52,25 @@ namespace Writers
|
||||
public:
|
||||
std::wstring m_sComment;
|
||||
std::wstring m_sCommentExt;
|
||||
std::wstring m_sCommentsIds;
|
||||
std::wstring m_sPeople;
|
||||
std::wstring m_sDocumentComment;
|
||||
std::wstring m_sDocumentCommentExt;
|
||||
std::wstring m_sDocumentCommentsIds;
|
||||
std::wstring m_sDocumentPeople;
|
||||
|
||||
CommentsWriter(std::wstring sDir) : m_sDir(sDir)
|
||||
{
|
||||
}
|
||||
void setElements(std::wstring& sComment, std::wstring& sCommentExt, std::wstring& sPeople, std::wstring& sDocumentComment, std::wstring& sDocumentCommentExt, std::wstring& sDocumentPeople)
|
||||
void setElements(std::wstring& sComment, std::wstring& sCommentExt, std::wstring& sCommentsIds, std::wstring& sPeople, std::wstring& sDocumentComment, std::wstring& sDocumentCommentExt, std::wstring& sDocumentCommentsIds, std::wstring& sDocumentPeople)
|
||||
{
|
||||
m_sComment = sComment;
|
||||
m_sCommentExt = sCommentExt;
|
||||
m_sCommentsIds = sCommentsIds;
|
||||
m_sPeople = sPeople;
|
||||
m_sDocumentComment = sDocumentComment;
|
||||
m_sDocumentCommentExt = sDocumentCommentExt;
|
||||
m_sDocumentCommentsIds = sDocumentCommentsIds;
|
||||
m_sDocumentPeople = sDocumentPeople;
|
||||
}
|
||||
void Write()
|
||||
@ -90,6 +96,15 @@ namespace Writers
|
||||
oFile.WriteStringUTF8(g_string_commentExt_End);
|
||||
oFile.CloseFile();
|
||||
}
|
||||
if(false == m_sCommentsIds.empty())
|
||||
{
|
||||
NSFile::CFileBinary oFile;
|
||||
oFile.CreateFileW(sDir + OOX::FileTypes::CommentsIds.DefaultFileName().GetPath());
|
||||
oFile.WriteStringUTF8(g_string_commentsIds_Start);
|
||||
oFile.WriteStringUTF8(m_sCommentsIds);
|
||||
oFile.WriteStringUTF8(g_string_commentsIds_End);
|
||||
oFile.CloseFile();
|
||||
}
|
||||
if(false == m_sPeople.empty())
|
||||
{
|
||||
NSFile::CFileBinary oFile;
|
||||
@ -120,6 +135,15 @@ namespace Writers
|
||||
oFile.WriteStringUTF8(g_string_commentExt_End);
|
||||
oFile.CloseFile();
|
||||
}
|
||||
if(false == m_sDocumentCommentsIds.empty())
|
||||
{
|
||||
NSFile::CFileBinary oFile;
|
||||
oFile.CreateFileW(sDir + OOX::FileTypes::DocumentCommentsIds.DefaultFileName().GetPath());
|
||||
oFile.WriteStringUTF8(g_string_commentsIds_Start);
|
||||
oFile.WriteStringUTF8(m_sDocumentCommentsIds);
|
||||
oFile.WriteStringUTF8(g_string_commentsIds_End);
|
||||
oFile.CloseFile();
|
||||
}
|
||||
if(false == m_sDocumentPeople.empty())
|
||||
{
|
||||
NSFile::CFileBinary oFile;
|
||||
|
||||
@ -29,6 +29,8 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifndef READER_CLASSES
|
||||
#define READER_CLASSES
|
||||
|
||||
@ -60,6 +62,8 @@ public:
|
||||
std::wstring pgBorders;
|
||||
std::wstring footnotePr;
|
||||
std::wstring endnotePr;
|
||||
bool RtlGutter;
|
||||
long Gutter;
|
||||
|
||||
bool bW;
|
||||
bool bH;
|
||||
@ -74,6 +78,8 @@ public:
|
||||
bool bEvenAndOddHeaders;
|
||||
bool bSectionType;
|
||||
bool bPageNumStart;
|
||||
bool bRtlGutter;
|
||||
bool bGutter;
|
||||
SectPr()
|
||||
{
|
||||
sHeaderFooterReference = _T("");
|
||||
@ -92,6 +98,7 @@ public:
|
||||
bEvenAndOddHeaders = false;
|
||||
bSectionType = false;
|
||||
bPageNumStart = false;
|
||||
bRtlGutter = false;
|
||||
}
|
||||
std::wstring Write()
|
||||
{
|
||||
@ -150,7 +157,9 @@ public:
|
||||
sRes += L" w:header=\"" + std::to_wstring(Header) + L"\"";
|
||||
if(bFooter)
|
||||
sRes += L" w:footer=\"" + std::to_wstring(Footer) + L"\"";
|
||||
sRes += L" w:gutter=\"0\"/>";
|
||||
if(bGutter)
|
||||
sRes += L" w:gutter=\"" + std::to_wstring(Gutter) + L"\"";
|
||||
sRes += L"/>";
|
||||
}
|
||||
if(!pgBorders.empty())
|
||||
sRes += pgBorders;
|
||||
@ -158,6 +167,14 @@ public:
|
||||
if(bPageNumStart)
|
||||
sRes += L"<w:pgNumType w:start=\"" + std::to_wstring(PageNumStart) + L"\"/>";
|
||||
|
||||
if(bRtlGutter)
|
||||
{
|
||||
if(RtlGutter)
|
||||
sRes += L"<w:rtlGutter/>";
|
||||
else
|
||||
sRes += L"<w:rtlGutter w:val=\"0\"/>";
|
||||
}
|
||||
|
||||
if(!cols.empty())
|
||||
sRes += cols;
|
||||
sRes += L"<w:docGrid w:linePitch=\"360\"/>";
|
||||
@ -1479,14 +1496,25 @@ public:
|
||||
std::wstring sFormat;
|
||||
switch(Format)
|
||||
{
|
||||
case numbering_numfmt_None:sFormat = _T("none");break;
|
||||
case numbering_numfmt_Bullet:sFormat = _T("bullet");break;
|
||||
case numbering_numfmt_Decimal:sFormat = _T("decimal");break;
|
||||
case numbering_numfmt_LowerRoman:sFormat = _T("lowerRoman");break;
|
||||
case numbering_numfmt_UpperRoman:sFormat = _T("upperRoman");break;
|
||||
case numbering_numfmt_LowerLetter:sFormat = _T("lowerLetter");break;
|
||||
case numbering_numfmt_UpperLetter:sFormat = _T("upperLetter");break;
|
||||
case numbering_numfmt_DecimalZero:sFormat = _T("decimalZero");break;
|
||||
case numbering_numfmt_None: sFormat = L"none"; break;
|
||||
case numbering_numfmt_Bullet: sFormat = L"bullet"; break;
|
||||
case numbering_numfmt_Decimal: sFormat = L"decimal"; break;
|
||||
case numbering_numfmt_LowerRoman: sFormat = L"lowerRoman"; break;
|
||||
case numbering_numfmt_UpperRoman: sFormat = L"upperRoman"; break;
|
||||
case numbering_numfmt_LowerLetter: sFormat = L"lowerLetter"; break;
|
||||
case numbering_numfmt_UpperLetter: sFormat = L"upperLetter"; break;
|
||||
case numbering_numfmt_DecimalZero: sFormat = L"decimalZero"; break;
|
||||
default:
|
||||
{
|
||||
Format -= 0x2008;
|
||||
if (Format >= 0)
|
||||
{
|
||||
SimpleTypes::CNumberFormat<> numFormat;
|
||||
numFormat.SetValue((SimpleTypes::ENumberFormat)Format);
|
||||
|
||||
sFormat = numFormat.ToString();
|
||||
}
|
||||
}break;
|
||||
}
|
||||
if(!sFormat.empty())
|
||||
{
|
||||
@ -1878,6 +1906,7 @@ public:
|
||||
std::wstring Date;
|
||||
std::wstring OOData;
|
||||
bool Solved;
|
||||
unsigned int DurableId;
|
||||
std::wstring Text;
|
||||
std::wstring m_sParaId;
|
||||
std::wstring m_sParaIdParent;
|
||||
@ -1886,12 +1915,14 @@ public:
|
||||
bool bIdOpen;
|
||||
bool bIdFormat;
|
||||
bool bSolved;
|
||||
bool bDurableId;
|
||||
public:
|
||||
CComment(IdCounter& oParaIdCounter, IdCounter& oFormatIdCounter):m_oParaIdCounter(oParaIdCounter),m_oFormatIdCounter(oFormatIdCounter)
|
||||
{
|
||||
bIdOpen = false;
|
||||
bIdFormat = false;
|
||||
bSolved = false;
|
||||
bDurableId = false;
|
||||
}
|
||||
~CComment()
|
||||
{
|
||||
@ -1928,15 +1959,6 @@ public:
|
||||
}
|
||||
return sRes;
|
||||
}
|
||||
std::wstring writeTemplates(bool isExt)
|
||||
{
|
||||
std::wstring sRes;
|
||||
sRes += isExt ? writeContentExt(this) : writeContent(this);
|
||||
|
||||
for(size_t i = 0; i < replies.size(); ++i)
|
||||
sRes += isExt ? writeContentExt(replies[i]) : writeContent(replies[i]);
|
||||
return sRes;
|
||||
}
|
||||
static std::wstring writeRef(CComment* pComment, const std::wstring& sBefore, const std::wstring& sRef, const std::wstring& sAfter)
|
||||
{
|
||||
std::wstring sRes;
|
||||
@ -1950,7 +1972,7 @@ public:
|
||||
sRes += (sAfter);
|
||||
return sRes;
|
||||
}
|
||||
static bool writeContentWritePart(CComment* pComment, std::wstring& sText, int nPrevIndex, int nCurIndex, bool bFirst, std::wstring& sRes)
|
||||
static void writeContentWritePart(CComment* pComment, std::wstring& sText, int nPrevIndex, int nCurIndex, std::wstring& sRes)
|
||||
{
|
||||
std::wstring sPart;
|
||||
if(nPrevIndex < nCurIndex)
|
||||
@ -1958,17 +1980,11 @@ public:
|
||||
|
||||
int nId = pComment->m_oParaIdCounter.getNextId();
|
||||
|
||||
std::wstring sId = XmlUtils::IntToString(nId, L"%08X");
|
||||
if(bFirst)
|
||||
{
|
||||
bFirst = false;
|
||||
pComment->m_sParaId = sId;
|
||||
}
|
||||
sRes += L"<w:p w14:paraId=\"" + sId + L"\" w14:textId=\"" + sId + L"\">";
|
||||
pComment->m_sParaId = XmlUtils::IntToString(nId, L"%08X");
|
||||
sRes += L"<w:p w14:paraId=\"" + pComment->m_sParaId + L"\" w14:textId=\"" + pComment->m_sParaId + L"\">";
|
||||
sRes += L"<w:pPr><w:spacing w:line=\"240\" w:after=\"0\" w:lineRule=\"auto\" w:before=\"0\"/><w:ind w:firstLine=\"0\" w:left=\"0\" w:right=\"0\"/><w:jc w:val=\"left\"/></w:pPr><w:r><w:rPr><w:rFonts w:eastAsia=\"Arial\" w:ascii=\"Arial\" w:hAnsi=\"Arial\" w:cs=\"Arial\"/><w:sz w:val=\"22\"/></w:rPr><w:t xml:space=\"preserve\">";
|
||||
sRes += sPart;
|
||||
sRes += L"</w:t></w:r></w:p>";
|
||||
return bFirst;
|
||||
}
|
||||
static std::wstring writeContent(CComment* pComment)
|
||||
{
|
||||
@ -2022,18 +2038,17 @@ public:
|
||||
|
||||
XmlUtils::replace_all(sText, L"\r", L"");
|
||||
|
||||
bool bFirst = true;
|
||||
int nPrevIndex = 0;
|
||||
for (int i = 0; i < (int)sText.length(); i++)
|
||||
{
|
||||
wchar_t cToken = sText[i];
|
||||
if('\n' == cToken)
|
||||
{
|
||||
bFirst = writeContentWritePart(pComment, sText, nPrevIndex, i, bFirst, sRes);
|
||||
writeContentWritePart(pComment, sText, nPrevIndex, i, sRes);
|
||||
nPrevIndex = i + 1;
|
||||
}
|
||||
}
|
||||
writeContentWritePart(pComment, sText, nPrevIndex, (int)sText.length(), bFirst, sRes);
|
||||
writeContentWritePart(pComment, sText, nPrevIndex, (int)sText.length(), sRes);
|
||||
sRes += L"</w:comment>";
|
||||
return sRes;
|
||||
}
|
||||
@ -2056,6 +2071,15 @@ w15:paraIdParent=\"" + pComment->m_sParaIdParent + L"\" w15:done=\"" + sDone + L
|
||||
}
|
||||
return sRes;
|
||||
}
|
||||
static std::wstring writeContentsIds(CComment* pComment)
|
||||
{
|
||||
std::wstring sRes;
|
||||
if(!pComment->m_sParaId.empty() && pComment->bDurableId)
|
||||
{
|
||||
sRes += L"<w16cid:commentId w16cid:paraId=\"" + pComment->m_sParaId + L"\" w16cid:durableId=\"" + XmlUtils::IntToString(pComment->DurableId, L"%08X") + L"\"/>";
|
||||
}
|
||||
return sRes;
|
||||
}
|
||||
static std::wstring writePeople(CComment* pComment)
|
||||
{
|
||||
std::wstring sRes;
|
||||
@ -2123,7 +2147,9 @@ public:
|
||||
std::wstring sRes;
|
||||
for (boost::unordered_map<int, CComment*>::const_iterator it = m_mapComments.begin(); it != m_mapComments.end(); ++it)
|
||||
{
|
||||
sRes += it->second->writeTemplates(false);
|
||||
sRes += CComment::writeContent(it->second);
|
||||
for(size_t i = 0; i < it->second->replies.size(); ++i)
|
||||
sRes += CComment::writeContent(it->second->replies[i]);
|
||||
}
|
||||
return sRes;
|
||||
}
|
||||
@ -2132,7 +2158,20 @@ public:
|
||||
std::wstring sRes;
|
||||
for (boost::unordered_map<int, CComment*>::const_iterator it = m_mapComments.begin(); it != m_mapComments.end(); ++it)
|
||||
{
|
||||
sRes += it->second->writeTemplates(true);
|
||||
sRes += CComment::writeContentExt(it->second);
|
||||
for(size_t i = 0; i < it->second->replies.size(); ++i)
|
||||
sRes += CComment::writeContentExt(it->second->replies[i]);
|
||||
}
|
||||
return sRes;
|
||||
}
|
||||
std::wstring writeContentsIds()
|
||||
{
|
||||
std::wstring sRes;
|
||||
for (boost::unordered_map<int, CComment*>::const_iterator it = m_mapComments.begin(); it != m_mapComments.end(); ++it)
|
||||
{
|
||||
sRes += CComment::writeContentsIds(it->second);
|
||||
for(size_t i = 0; i < it->second->replies.size(); ++i)
|
||||
sRes += CComment::writeContentsIds(it->second->replies[i]);
|
||||
}
|
||||
return sRes;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -34,8 +34,9 @@
|
||||
|
||||
#include "BinReaderWriterDefines.h"
|
||||
|
||||
#include "../../Common/DocxFormat/Source/Common/SimpleTypes_OMath.h"
|
||||
#include "../../Common/DocxFormat/Source/MathEquation/OutputDev.h"
|
||||
#include "../../Common/DocxFormat/Source/Common/SimpleTypes_OMath.h"
|
||||
#include "../../Common/DocxFormat/Source/Common/SimpleTypes_Shared.h"
|
||||
#include <stack>
|
||||
|
||||
namespace MathEquation
|
||||
|
||||
@ -467,7 +467,8 @@ extern int g_nCurFormatVersion;
|
||||
cols = 8,
|
||||
pgBorders = 9,
|
||||
footnotePr = 10,
|
||||
endnotePr = 11
|
||||
endnotePr = 11,
|
||||
rtlGutter = 12
|
||||
};}
|
||||
namespace c_oSerProp_secPrSettingsType{enum c_oSerProp_secPrSettingsType
|
||||
{
|
||||
@ -524,7 +525,11 @@ extern int g_nCurFormatVersion;
|
||||
Sdt = 10,
|
||||
BookmarkStart = 11,
|
||||
BookmarkEnd = 12,
|
||||
tblGrid_ItemTwips = 13
|
||||
tblGrid_ItemTwips = 13,
|
||||
MoveFromRangeStart = 14,
|
||||
MoveFromRangeEnd = 15,
|
||||
MoveToRangeStart = 16,
|
||||
MoveToRangeEnd = 17
|
||||
};}
|
||||
namespace c_oSerRunType{enum c_oSerRunType
|
||||
{
|
||||
@ -778,7 +783,8 @@ extern int g_nCurFormatVersion;
|
||||
RightTwips = 8,
|
||||
BottomTwips = 9,
|
||||
HeaderTwips = 10,
|
||||
FooterTwips = 11
|
||||
FooterTwips = 11,
|
||||
GutterTwips = 12
|
||||
};}
|
||||
namespace c_oSer_ColorType{enum c_oSer_ColorType
|
||||
{
|
||||
@ -797,7 +803,8 @@ extern int g_nCurFormatVersion;
|
||||
QuoteText = 7,
|
||||
Solved = 8,
|
||||
Replies = 9,
|
||||
OOData = 10
|
||||
OOData = 10,
|
||||
DurableId = 11
|
||||
};}
|
||||
namespace c_oSer_SettingsType{enum c_oSer_SettingsType
|
||||
{
|
||||
@ -812,7 +819,13 @@ extern int g_nCurFormatVersion;
|
||||
Compat = 8,
|
||||
DefaultTabStopTwips = 9,
|
||||
DecimalSymbol = 10,
|
||||
ListSeparator = 11
|
||||
ListSeparator = 11,
|
||||
GutterAtTop = 12,
|
||||
MirrorMargins = 13,
|
||||
PrintTwoOnOne = 14,
|
||||
BookFoldPrinting = 15,
|
||||
BookFoldPrintingSheets = 16,
|
||||
BookFoldRevPrinting = 17
|
||||
};}
|
||||
namespace c_oSer_MathPrType{enum c_oSer_SettingsType
|
||||
{
|
||||
@ -979,7 +992,11 @@ extern int g_nCurFormatVersion;
|
||||
columnbreak = 64,
|
||||
ARPr = 65,
|
||||
BookmarkStart = 66,
|
||||
BookmarkEnd = 67
|
||||
BookmarkEnd = 67,
|
||||
MoveFromRangeStart = 68,
|
||||
MoveFromRangeEnd = 69,
|
||||
MoveToRangeStart = 70,
|
||||
MoveToRangeEnd = 71
|
||||
};}
|
||||
namespace c_oSer_FramePrType{ enum c_oSer_FramePrType
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -277,13 +277,20 @@ namespace BinXlsxRW{
|
||||
pTable->m_oTable->m_oTableStyleInfo->m_oShowColumnStripes.Init();
|
||||
pTable->m_oTable->m_oTableStyleInfo->m_oShowColumnStripes->FromBool(false);
|
||||
pTable->m_oTable->m_oTableColumns.Init();
|
||||
|
||||
for(size_t i = 0; i < m_aTableNames.size(); ++i)
|
||||
{
|
||||
OOX::Spreadsheet::CTableColumn* pTableColumn = new OOX::Spreadsheet::CTableColumn();
|
||||
pTableColumn->m_oId.Init();
|
||||
pTableColumn->m_oId->SetValue((unsigned int)i + 1);
|
||||
pTableColumn->m_oName.Init();
|
||||
pTableColumn->m_oName->append(m_aTableNames[i]);
|
||||
|
||||
if (!pTableColumn->m_oId.IsInit())
|
||||
{
|
||||
pTableColumn->m_oId.Init();
|
||||
pTableColumn->m_oId->SetValue((unsigned int)i + 1);
|
||||
}
|
||||
if (!pTableColumn->m_oName.IsInit())
|
||||
{
|
||||
pTableColumn->m_oName = m_aTableNames[i];
|
||||
}
|
||||
pTable->m_oTable->m_oTableColumns->m_arrItems.push_back(pTableColumn);
|
||||
}
|
||||
pTable->m_oTable->m_oTableColumns->m_oCount.Init();
|
||||
|
||||
@ -30,15 +30,20 @@
|
||||
*
|
||||
*/
|
||||
#include "DocxSerializer.h"
|
||||
|
||||
#include "../BinWriter/BinWriters.h"
|
||||
#include "../BinReader/Readers.h"
|
||||
|
||||
#include "../../ASCOfficePPTXFile/ASCOfficeDrawingConverter.h"
|
||||
#include "../../ASCOfficePPTXFile/Editor/FontPicker.h"
|
||||
|
||||
#include "FontProcessor.h"
|
||||
#include "../../OfficeUtils/src/OfficeUtils.h"
|
||||
|
||||
#include "../../DesktopEditor/common/Directory.h"
|
||||
#include "../../DesktopEditor/common/File.h"
|
||||
#include "../../DesktopEditor/common/Path.h"
|
||||
#include "../../DesktopEditor/common/SystemUtils.h"
|
||||
#include "../BinWriter/BinWriters.h"
|
||||
#include "../BinReader/Readers.h"
|
||||
#include "../../ASCOfficePPTXFile/Editor/FontPicker.h"
|
||||
#include "../../OfficeUtils/src/OfficeUtils.h"
|
||||
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/App.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Core.h"
|
||||
|
||||
@ -32,6 +32,8 @@ SOURCES += \
|
||||
../../XlsxSerializerCom/Reader/ChartFromToBinary.cpp \
|
||||
../../XlsxSerializerCom/Reader/CommonWriter.cpp \
|
||||
../../XlsxSerializerCom/Reader/CSVReader.cpp \
|
||||
../../XlsxSerializerCom/Reader/BinaryWriter.cpp \
|
||||
../../XlsxSerializerCom/Writer/BinaryReader.cpp \
|
||||
../../XlsxSerializerCom/Writer/CSVWriter.cpp \
|
||||
../../OfficeCryptReader/source/ECMACryptFile.cpp \
|
||||
../../OfficeCryptReader/source/CryptTransform.cpp \
|
||||
|
||||
@ -55,6 +55,8 @@
|
||||
8A404FD5208A01CE00F2D5CF /* FileDownloader_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A404FD4208A01CE00F2D5CF /* FileDownloader_private.h */; };
|
||||
8AB24BFD213004E400E80DDD /* CustormXmlWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AB24BFB213004E300E80DDD /* CustormXmlWriter.cpp */; };
|
||||
8AB24BFE213004E400E80DDD /* CustormXmlWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 8AB24BFC213004E300E80DDD /* CustormXmlWriter.h */; };
|
||||
8AE10E6E222824F400A542DE /* BinaryWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AE10E6D222824F400A542DE /* BinaryWriter.cpp */; };
|
||||
8AE10E702228251000A542DE /* BinaryReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AE10E6F2228251000A542DE /* BinaryReader.cpp */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
@ -107,6 +109,8 @@
|
||||
8A404FD4208A01CE00F2D5CF /* FileDownloader_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileDownloader_private.h; path = ../../../Common/FileDownloader/FileDownloader_private.h; sourceTree = "<group>"; };
|
||||
8AB24BFB213004E300E80DDD /* CustormXmlWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CustormXmlWriter.cpp; sourceTree = "<group>"; };
|
||||
8AB24BFC213004E300E80DDD /* CustormXmlWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustormXmlWriter.h; sourceTree = "<group>"; };
|
||||
8AE10E6D222824F400A542DE /* BinaryWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BinaryWriter.cpp; sourceTree = "<group>"; };
|
||||
8AE10E6F2228251000A542DE /* BinaryReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BinaryReader.cpp; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -215,6 +219,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
17E17F211AC4549B00BEA2EA /* BinaryWriter.h */,
|
||||
8AE10E6D222824F400A542DE /* BinaryWriter.cpp */,
|
||||
17E17F221AC4549B00BEA2EA /* ChartFromToBinary.cpp */,
|
||||
17E17F231AC4549B00BEA2EA /* ChartFromToBinary.h */,
|
||||
17E17F241AC4549B00BEA2EA /* CommonWriter.cpp */,
|
||||
@ -230,6 +235,7 @@
|
||||
children = (
|
||||
17E17F2D1AC4549B00BEA2EA /* BinaryCommonReader.h */,
|
||||
17E17F2E1AC4549B00BEA2EA /* BinaryReader.h */,
|
||||
8AE10E6F2228251000A542DE /* BinaryReader.cpp */,
|
||||
17E17F2F1AC4549B00BEA2EA /* CSVWriter.cpp */,
|
||||
17E17F301AC4549B00BEA2EA /* CSVWriter.h */,
|
||||
);
|
||||
@ -336,6 +342,7 @@
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
English,
|
||||
en,
|
||||
);
|
||||
mainGroup = 17E17ED31AC453F800BEA2EA;
|
||||
@ -362,11 +369,13 @@
|
||||
17C1FE9B1ACC42C4006B99B3 /* CSVWriter.cpp in Sources */,
|
||||
69414A301CB51666003E771B /* ChartWriter.cpp in Sources */,
|
||||
6967917E1D9E8AEE002CA4BA /* BinWriters.cpp in Sources */,
|
||||
8AE10E702228251000A542DE /* BinaryReader.cpp in Sources */,
|
||||
69BBDF251F0B8AAC00EB1BF7 /* FileDownloader_mac.mm in Sources */,
|
||||
17C1FE9C1ACC42C4006B99B3 /* XlsxSerializer.cpp in Sources */,
|
||||
690FE0851E9BBD68004B26D0 /* Readers.cpp in Sources */,
|
||||
17C1FE9D1ACC42C4006B99B3 /* FontProcessor.cpp in Sources */,
|
||||
8A404FD3208A01AF00F2D5CF /* FileDownloader.cpp in Sources */,
|
||||
8AE10E6E222824F400A542DE /* BinaryWriter.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -376,7 +385,7 @@
|
||||
17C1FEC01ACC42C4006B99B3 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ENABLE_BITCODE = NO;
|
||||
ENABLE_BITCODE = YES;
|
||||
EXECUTABLE_PREFIX = lib;
|
||||
GCC_ENABLE_CPP_EXCEPTIONS = YES;
|
||||
GCC_ENABLE_CPP_RTTI = YES;
|
||||
@ -408,7 +417,7 @@
|
||||
17C1FEC11ACC42C4006B99B3 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ENABLE_BITCODE = NO;
|
||||
ENABLE_BITCODE = YES;
|
||||
EXECUTABLE_PREFIX = lib;
|
||||
GCC_ENABLE_CPP_EXCEPTIONS = YES;
|
||||
GCC_ENABLE_CPP_RTTI = YES;
|
||||
|
||||
@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1010"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "17C1FE921ACC42C4006B99B3"
|
||||
BuildableName = "libASCOfficeDocxFile2Lib_ios.a"
|
||||
BlueprintName = "ASCOfficeDocxFile2Lib"
|
||||
ReferencedContainer = "container:ASCOfficeDocxFile2Lib.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "17C1FE921ACC42C4006B99B3"
|
||||
BuildableName = "libASCOfficeDocxFile2Lib_ios.a"
|
||||
BlueprintName = "ASCOfficeDocxFile2Lib"
|
||||
ReferencedContainer = "container:ASCOfficeDocxFile2Lib.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "17C1FE921ACC42C4006B99B3"
|
||||
BuildableName = "libASCOfficeDocxFile2Lib_ios.a"
|
||||
BlueprintName = "ASCOfficeDocxFile2Lib"
|
||||
ReferencedContainer = "container:ASCOfficeDocxFile2Lib.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@ -14,8 +14,8 @@
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "17E17EDB1AC453F800BEA2EA"
|
||||
BuildableName = "libASCOfficeDocxFile2Lib.a"
|
||||
BlueprintIdentifier = "17C1FE921ACC42C4006B99B3"
|
||||
BuildableName = "libASCOfficeDocxFile2Lib_ios.a"
|
||||
BlueprintName = "ASCOfficeDocxFile2Lib"
|
||||
ReferencedContainer = "container:ASCOfficeDocxFile2Lib.xcodeproj">
|
||||
</BuildableReference>
|
||||
@ -23,27 +23,30 @@
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Debug"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "17E17EDB1AC453F800BEA2EA"
|
||||
BuildableName = "libASCOfficeDocxFile2Lib.a"
|
||||
BlueprintIdentifier = "17C1FE921ACC42C4006B99B3"
|
||||
BuildableName = "libASCOfficeDocxFile2Lib_ios.a"
|
||||
BlueprintName = "ASCOfficeDocxFile2Lib"
|
||||
ReferencedContainer = "container:ASCOfficeDocxFile2Lib.xcodeproj">
|
||||
</BuildableReference>
|
||||
@ -52,16 +55,16 @@
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "17E17EDB1AC453F800BEA2EA"
|
||||
BuildableName = "libASCOfficeDocxFile2Lib.a"
|
||||
BlueprintIdentifier = "17C1FE921ACC42C4006B99B3"
|
||||
BuildableName = "libASCOfficeDocxFile2Lib_ios.a"
|
||||
BlueprintName = "ASCOfficeDocxFile2Lib"
|
||||
ReferencedContainer = "container:ASCOfficeDocxFile2Lib.xcodeproj">
|
||||
</BuildableReference>
|
||||
|
||||
@ -92,8 +92,9 @@ public:
|
||||
std::wstring convert_conditional_formula(std::wstring const & expr);
|
||||
|
||||
// Лист1!$A$1 -> $Лист1.$A$1
|
||||
std::wstring convert_named_ref (std::wstring const & expr);
|
||||
std::wstring convert_named_ref(std::wstring const & expr);
|
||||
std::wstring convert_named_formula(std::wstring const & expr);
|
||||
bool is_simple_ref(std::wstring const & expr);
|
||||
|
||||
std::wstring get_table_name();
|
||||
|
||||
|
||||
@ -122,27 +122,64 @@ namespace formulasconvert {
|
||||
XmlUtils::replace_all( expr, L"SCOBCAIN", L"(");
|
||||
XmlUtils::replace_all( expr, L"SCOBCAOUT", L")");
|
||||
|
||||
XmlUtils::replace_all( expr, L"KVADRATIN", L"[");
|
||||
XmlUtils::replace_all( expr, L"KVADRATOUT", L"]");
|
||||
//XmlUtils::replace_all( expr, L"KVADRATIN", L"[");
|
||||
//XmlUtils::replace_all( expr, L"KVADRATOUT", L"]");
|
||||
|
||||
XmlUtils::replace_all( expr, L"PROBEL", L" ");
|
||||
XmlUtils::replace_all( expr, L"APOSTROF", L"'");
|
||||
XmlUtils::replace_all( expr, L"KAVYCHKA", L"\"");
|
||||
//XmlUtils::replace_all( expr, L"APOSTROF", L"'");
|
||||
//XmlUtils::replace_all( expr, L"KAVYCHKA", L"\"");
|
||||
}
|
||||
static void replace_tmp(std::wstring &expr)
|
||||
{
|
||||
XmlUtils::replace_all( expr, L".", L"ТОСHKA");
|
||||
XmlUtils::replace_all( expr, L"!", L"VOSKL");
|
||||
// XmlUtils::replace_all( expr, L".", L"ТОСHKA");
|
||||
// XmlUtils::replace_all( expr, L"!", L"VOSKL");
|
||||
|
||||
XmlUtils::replace_all( expr, L"(", L"SCOBCAIN");
|
||||
XmlUtils::replace_all( expr, L")", L"SCOBCAOUT");
|
||||
// XmlUtils::replace_all( expr, L"(", L"SCOBCAIN");
|
||||
// XmlUtils::replace_all( expr, L")", L"SCOBCAOUT");
|
||||
|
||||
//XmlUtils::replace_all( expr, L"[", L"KVADRATIN");
|
||||
//XmlUtils::replace_all( expr, L"]", L"KVADRATOUT");
|
||||
|
||||
XmlUtils::replace_all( expr, L" ", L"PROBEL");
|
||||
// XmlUtils::replace_all( expr, L"'", L"APOSTROF");
|
||||
// XmlUtils::replace_all( expr, L"\"", L"KAVYCHKA");
|
||||
// //XmlUtils::replace_all( expr, L"[", L"KVADRATIN");
|
||||
// //XmlUtils::replace_all( expr, L"]", L"KVADRATOUT");
|
||||
//
|
||||
// XmlUtils::replace_all( expr, L" ", L"PROBEL");
|
||||
//// XmlUtils::replace_all( expr, L"'", L"APOSTROF");
|
||||
//// XmlUtils::replace_all( expr, L"\"", L"KAVYCHKA");
|
||||
|
||||
std::wstring result;
|
||||
|
||||
size_t pos = 0, size = expr.length();
|
||||
|
||||
while(pos < size)
|
||||
{
|
||||
switch(expr[pos])
|
||||
{
|
||||
case '.':
|
||||
{
|
||||
result += L"ТОСHKA";
|
||||
}break;
|
||||
case '!':
|
||||
{
|
||||
result += L"VOSKL";
|
||||
}break;
|
||||
case '(':
|
||||
{
|
||||
result += L"SCOBCAIN";
|
||||
}break;
|
||||
case ')':
|
||||
{
|
||||
result += L"SCOBCAOUT";
|
||||
}break;
|
||||
case ' ':
|
||||
{
|
||||
result += L"PROBEL";
|
||||
}break;
|
||||
default:
|
||||
{
|
||||
result += expr[pos];
|
||||
}break;
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
expr = result;
|
||||
}
|
||||
static std::wstring convert_scobci(boost::wsmatch const & what)
|
||||
{
|
||||
@ -210,25 +247,41 @@ namespace formulasconvert {
|
||||
|
||||
bool odf2oox_converter::Impl::find_first_last_ref(std::wstring const & expr, std::wstring & table,std::wstring & ref_first,std::wstring & ref_last)
|
||||
{
|
||||
std::wstring workstr = expr;
|
||||
workstr = boost::regex_replace(
|
||||
workstr,
|
||||
boost::wregex(L"('.*?')|(\".*?\")"),
|
||||
&convert_scobci, boost::match_default | boost::format_all);
|
||||
|
||||
std::vector< std::wstring > splitted;
|
||||
|
||||
boost::algorithm::split(splitted, expr, boost::algorithm::is_any_of(L".:"), boost::algorithm::token_compress_on);
|
||||
|
||||
boost::algorithm::split(splitted, workstr, boost::algorithm::is_any_of(L".:"), boost::algorithm::token_compress_on);
|
||||
|
||||
bool res = false;
|
||||
if (splitted.size() == 2)
|
||||
{
|
||||
table = splitted[0];
|
||||
ref_first = splitted[1];
|
||||
ref_last = splitted[1];
|
||||
res = true;
|
||||
}
|
||||
if (splitted.size() == 3)
|
||||
{
|
||||
table = splitted[0];
|
||||
ref_first = splitted[1];
|
||||
ref_last = splitted[2];
|
||||
return true;
|
||||
res = true;
|
||||
}
|
||||
if (splitted.size() == 4)
|
||||
{
|
||||
table = splitted[0];
|
||||
ref_first = splitted[1];
|
||||
ref_last = splitted[3];
|
||||
return true;
|
||||
res = true;
|
||||
}
|
||||
return false;
|
||||
replace_tmp_back( table );
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
bool odf2oox_converter::Impl::find_first_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref)
|
||||
|
||||
@ -133,34 +133,202 @@ public:
|
||||
}
|
||||
static void oox_replace_tmp_back(std::wstring &expr)
|
||||
{
|
||||
XmlUtils::replace_all( expr, L"ТОСHKA", L".");
|
||||
XmlUtils::replace_all( expr, L"VOSKL", L"!");
|
||||
std::wstring result;
|
||||
|
||||
XmlUtils::replace_all( expr, L"SCOBCAIN", L"(");
|
||||
XmlUtils::replace_all( expr, L"SCOBCAOUT", L")");
|
||||
size_t pos = 0, size = expr.length();
|
||||
|
||||
XmlUtils::replace_all( expr, L"KVADRATIN", L"[");
|
||||
XmlUtils::replace_all( expr, L"KVADRATOUT", L"]");
|
||||
|
||||
XmlUtils::replace_all( expr, L"PROBEL", L" ");
|
||||
XmlUtils::replace_all( expr, L"APOSTROF", L"'");
|
||||
XmlUtils::replace_all( expr, L"KAVYCHKA", L"\"");
|
||||
while(pos < size)
|
||||
{
|
||||
if (pos + 5 >= size)
|
||||
{
|
||||
result += expr[pos++];
|
||||
continue;
|
||||
}
|
||||
switch(expr[pos])
|
||||
{
|
||||
case 'M':
|
||||
{
|
||||
if ((pos + 5 < size) && (expr.substr(pos, 5) == L"MINYS"))
|
||||
{
|
||||
result += L"-"; pos += 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
result += expr[pos++];
|
||||
}
|
||||
}break;
|
||||
case 'T':
|
||||
{
|
||||
if ((pos + 6 < size) && (expr.substr(pos, 6) == L"ТОСHKA"))
|
||||
{
|
||||
result += L"."; pos += 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
result += expr[pos++];
|
||||
}
|
||||
}break;
|
||||
case 'V':
|
||||
{
|
||||
if ((pos + 5 < size) && (expr.substr(pos, 5) == L"VOSKL"))
|
||||
{
|
||||
result += L"!"; pos += 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
result += expr[pos++];
|
||||
}
|
||||
}break;
|
||||
case 'S':
|
||||
{
|
||||
if ((pos + 8 < size) && (expr.substr(pos, 8) == L"SCOBCAIN"))
|
||||
{
|
||||
result += L"("; pos += 8;
|
||||
}
|
||||
else if ((pos + 9 < size) && (expr.substr(pos, 9) == L"SCOBCAOUT"))
|
||||
{
|
||||
result += L")"; pos += 9;
|
||||
}
|
||||
else
|
||||
{
|
||||
result += expr[pos++];
|
||||
}
|
||||
}break;
|
||||
case 'K':
|
||||
{
|
||||
if ((pos + 9 < size) && (expr.substr(pos, 9) == L"KVADRATIN"))
|
||||
{
|
||||
result += L"["; pos += 9;
|
||||
}
|
||||
else if ((pos + 10 < size) && (expr.substr(pos, 10) == L"KVADRATOUT"))
|
||||
{
|
||||
result += L"]"; pos += 10;
|
||||
}
|
||||
else if ((pos + 8 < size) && (expr.substr(pos, 8) == L"KAVYCHKA"))
|
||||
{
|
||||
result += L"\""; pos += 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
result += expr[pos++];
|
||||
}
|
||||
}break;
|
||||
case 'P':
|
||||
{
|
||||
if ((pos + 6 < size) && (expr.substr(pos, 6) == L"PROBEL"))
|
||||
{
|
||||
result += L" "; pos += 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
result += expr[pos++];
|
||||
}
|
||||
}break;
|
||||
case 'A':
|
||||
{
|
||||
if ((pos + 8 < size) && (expr.substr(pos, 8) == L"APOSTROF"))
|
||||
{
|
||||
result += L"'"; pos += 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
result += expr[pos++];
|
||||
}
|
||||
}break;
|
||||
default:
|
||||
{
|
||||
result += expr[pos++];
|
||||
}break;
|
||||
}
|
||||
}
|
||||
expr = result;
|
||||
//XmlUtils::replace_all( expr, L"MINYS", L"-");
|
||||
//XmlUtils::replace_all( expr, L"ТОСHKA", L".");
|
||||
//XmlUtils::replace_all( expr, L"VOSKL", L"!");
|
||||
|
||||
//XmlUtils::replace_all( expr, L"SCOBCAIN", L"(");
|
||||
//XmlUtils::replace_all( expr, L"SCOBCAOUT", L")");
|
||||
|
||||
//XmlUtils::replace_all( expr, L"KVADRATIN", L"[");
|
||||
//XmlUtils::replace_all( expr, L"KVADRATOUT", L"]");
|
||||
//
|
||||
//XmlUtils::replace_all( expr, L"PROBEL", L" ");
|
||||
//XmlUtils::replace_all( expr, L"APOSTROF", L"'");
|
||||
//XmlUtils::replace_all( expr, L"KAVYCHKA", L"\"");
|
||||
}
|
||||
|
||||
static void oox_replace_tmp(std::wstring &expr)
|
||||
{
|
||||
XmlUtils::replace_all( expr, L".", L"ТОСHKA");
|
||||
XmlUtils::replace_all( expr, L"!", L"VOSKL");
|
||||
std::wstring result;
|
||||
|
||||
XmlUtils::replace_all( expr, L"(", L"SCOBCAIN");
|
||||
XmlUtils::replace_all( expr, L")", L"SCOBCAOUT");
|
||||
size_t pos = 0, size = expr.length();
|
||||
|
||||
XmlUtils::replace_all( expr, L"[", L"KVADRATIN");
|
||||
XmlUtils::replace_all( expr, L"]", L"KVADRATOUT");
|
||||
|
||||
XmlUtils::replace_all( expr, L" ", L"PROBEL");
|
||||
XmlUtils::replace_all( expr, L"'", L"APOSTROF");
|
||||
XmlUtils::replace_all( expr, L"\"", L"KAVYCHKA");
|
||||
while(pos < size)
|
||||
{
|
||||
switch(expr[pos])
|
||||
{
|
||||
case '-':
|
||||
{
|
||||
result += L"MINYS";
|
||||
}break;
|
||||
case '.':
|
||||
{
|
||||
result += L"ТОСHKA";
|
||||
}break;
|
||||
case '!':
|
||||
{
|
||||
result += L"VOSKL";
|
||||
}break;
|
||||
case '(':
|
||||
{
|
||||
result += L"SCOBCAIN";
|
||||
}break;
|
||||
case ')':
|
||||
{
|
||||
result += L"SCOBCAOUT";
|
||||
}break;
|
||||
case '[':
|
||||
{
|
||||
result += L"KVADRATIN";
|
||||
}break;
|
||||
case ']':
|
||||
{
|
||||
result += L"KVADRATOUT";
|
||||
}break;
|
||||
case ' ':
|
||||
{
|
||||
result += L"PROBEL";
|
||||
}break;
|
||||
case '\'':
|
||||
{
|
||||
result += L"APOSTROF";
|
||||
}break;
|
||||
case '\"':
|
||||
{
|
||||
result += L"KAVYCHKA";
|
||||
}break;
|
||||
default:
|
||||
{
|
||||
result += expr[pos];
|
||||
}break;
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
expr = result;
|
||||
|
||||
//XmlUtils::replace_all( expr, L"-", L"MINYS");
|
||||
//XmlUtils::replace_all( expr, L".", L"ТОСHKA");
|
||||
//XmlUtils::replace_all( expr, L"!", L"VOSKL");
|
||||
|
||||
//XmlUtils::replace_all( expr, L"(", L"SCOBCAIN");
|
||||
//XmlUtils::replace_all( expr, L")", L"SCOBCAOUT");
|
||||
|
||||
//XmlUtils::replace_all( expr, L"[", L"KVADRATIN");
|
||||
//XmlUtils::replace_all( expr, L"]", L"KVADRATOUT");
|
||||
//
|
||||
//XmlUtils::replace_all( expr, L" ", L"PROBEL");
|
||||
//XmlUtils::replace_all( expr, L"'", L"APOSTROF");
|
||||
//XmlUtils::replace_all( expr, L"\"", L"KAVYCHKA");
|
||||
}
|
||||
|
||||
static bool is_forbidden1(const std::wstring & formula)
|
||||
@ -174,6 +342,7 @@ public:
|
||||
}
|
||||
void replace_named_ref(std::wstring & expr);
|
||||
void replace_named_formula(std::wstring & expr);
|
||||
bool is_simple_ref(std::wstring const & expr);
|
||||
|
||||
static bool isFindBaseCell_;
|
||||
|
||||
@ -188,14 +357,14 @@ void oox2odf_converter::Impl::replace_cells_range(std::wstring& expr, bool bSele
|
||||
if ((0 == expr.find(L"KAVYCHKA")) && (expr.length() - 8 == expr.rfind(L"KAVYCHKA") ))
|
||||
return;
|
||||
|
||||
boost::wregex re(L"([:$!])+");
|
||||
boost::wregex re(L"(([:$!])+)|(\\S+\\d+)");
|
||||
|
||||
boost::wsmatch result;
|
||||
bool b = boost::regex_search(expr, result, re);
|
||||
|
||||
if (b)
|
||||
{
|
||||
boost::wregex re1(L"(\\$?[^\']+\\!)?([\\w^0-9$]*\\d*)\\:?([\\w^0-9$]*\\d*)?");
|
||||
boost::wregex re1(L"(\\$?[^\\']+\\!)?([a-zA-Z$]+\\d*)(\\:[a-zA-Z$]+\\d*)?");
|
||||
// $ Sheet2 ! $ A1 : $ B5
|
||||
// $ Sheet2 ! $ A : $ A
|
||||
// $ Sheet2 ! $ 1 : $ 1
|
||||
@ -238,9 +407,11 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater1(boost::wsmat
|
||||
|
||||
if (isFindBaseCell_ && table_name_.empty() && !sheet.empty())
|
||||
{
|
||||
table_name_ = sheet + L".$A$1";
|
||||
table_name_ = L"$" + sheet + L".$A$1";
|
||||
}
|
||||
if (!sheet.empty() && (std::wstring::npos != c1.find(L"$"))) sheet = L"$" + sheet;
|
||||
if (!c2.empty() && c2.substr(0, 1) == L":")
|
||||
c2 = c2.substr(1);
|
||||
|
||||
|
||||
s = L"[" + sheet + L"." + c1 + (c2.empty() ? L"" : (L":" + sheet + L"." + c2)) + std::wstring(L"]");
|
||||
@ -281,10 +452,12 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater2(boost::wsmat
|
||||
|
||||
if (isFindBaseCell_ && table_name_.empty() && !sheet.empty())
|
||||
{
|
||||
table_name_ = sheet + L".$A$1";
|
||||
table_name_ = L"$" + sheet + L".$A$1";
|
||||
}
|
||||
if (!sheet.empty() && (std::wstring::npos != c1.find(L"$"))) sheet = L"$" + sheet;
|
||||
|
||||
|
||||
if (!c2.empty() && c2.substr(0, 1) == L":")
|
||||
c2 = c2.substr(1);
|
||||
|
||||
s = sheet + L"." + c1 + (c2.empty() ? L"" : (L":" + sheet + L"." + c2)) + std::wstring(L"");
|
||||
}
|
||||
@ -310,6 +483,19 @@ void oox2odf_converter::Impl::replace_named_formula(std::wstring & expr)
|
||||
expr = convert_formula(expr);
|
||||
isFindBaseCell_ = false;
|
||||
}
|
||||
bool oox2odf_converter::Impl::is_simple_ref(std::wstring const & expr)
|
||||
{
|
||||
if (expr.find(L"(") != std::wstring::npos) return false;
|
||||
if (expr.find(L" ") != std::wstring::npos) return false;
|
||||
if (expr.find(L";") != std::wstring::npos) return false;
|
||||
|
||||
boost::wsmatch match;
|
||||
if (boost::regex_search(expr, match, boost::wregex(L"([\\w]+\\!)?\\$?[a-zA-Z]+\\$?\\d+(\\:\\$?[a-zA-Z]+\\$?\\d+)?")))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr)
|
||||
{
|
||||
@ -644,6 +830,11 @@ std::wstring oox2odf_converter::convert_named_formula(const std::wstring& expr)
|
||||
impl_->replace_named_formula(workstr);
|
||||
return workstr;
|
||||
}
|
||||
bool oox2odf_converter::is_simple_ref(std::wstring const & expr)
|
||||
{
|
||||
return impl_->is_simple_ref(expr);
|
||||
}
|
||||
|
||||
std::wstring oox2odf_converter::get_table_name()
|
||||
{
|
||||
return impl_->table_name_;
|
||||
|
||||
@ -63,8 +63,9 @@ public:
|
||||
|
||||
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) = 0;
|
||||
private:
|
||||
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes ) = 0;
|
||||
virtual void add_attributes (const xml::attributes_wc_ptr & Attributes) = 0;
|
||||
virtual void add_text (const std::wstring & Text) = 0;
|
||||
virtual void add_space (const std::wstring & Text) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -468,6 +468,7 @@ enum ElementType
|
||||
typeDrawHandle,
|
||||
typeDrawEquation,
|
||||
typeDrawEnhancedGeometry,
|
||||
typeDrawGluePoint,
|
||||
|
||||
typeDr3dScene,
|
||||
typeDr3dLight,
|
||||
@ -506,6 +507,7 @@ enum ElementType
|
||||
typeFormTime,
|
||||
typeFormValueRange,
|
||||
typeFormItem,
|
||||
typeFormOption,
|
||||
|
||||
typeDrawPage,
|
||||
typePresentationFooterDecl,
|
||||
|
||||
@ -82,6 +82,11 @@ bool read_doc_element::read_sax( xml::sax * Reader )
|
||||
}
|
||||
break;
|
||||
case xml::typeWhitespace:
|
||||
{
|
||||
const std::wstring value = Reader->value();
|
||||
add_space(value);
|
||||
}
|
||||
break;
|
||||
case xml::typeText:
|
||||
{
|
||||
const std::wstring value = Reader->value();
|
||||
|
||||
@ -47,6 +47,7 @@
|
||||
#include "../odf/style_graphic_properties.h"
|
||||
|
||||
#include "docx_package.h"
|
||||
#include "xlsx_package.h"
|
||||
#include "oox_rels.h"
|
||||
#include "logging.h"
|
||||
|
||||
@ -130,7 +131,7 @@ text_tracked_context::_state & text_tracked_context::get_tracked_change(std::wst
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------
|
||||
docx_conversion_context::docx_conversion_context(odf_reader::odf_document * OdfDocument) :
|
||||
docx_conversion_context::docx_conversion_context(odf_reader::odf_document * _odf_document) :
|
||||
last_dump_page_properties_ (true),
|
||||
next_dump_page_properties_ (false),
|
||||
page_break_ (false),
|
||||
@ -143,19 +144,22 @@ docx_conversion_context::docx_conversion_context(odf_reader::odf_document * OdfD
|
||||
text_tracked_context_ (*this),
|
||||
table_context_ (*this),
|
||||
output_document_ (NULL),
|
||||
process_note_ (noNote),
|
||||
current_process_note_ (noNote),
|
||||
new_list_style_number_ (0),
|
||||
current_margin_left_ (0),
|
||||
current_outline_level_ (-1),
|
||||
is_rtl_ (false),
|
||||
is_delete_text_ (false),
|
||||
delayed_converting_ (false),
|
||||
process_headers_footers_ (false),
|
||||
process_comment_ (false),
|
||||
mediaitems_ (OdfDocument->get_folder() ),
|
||||
math_context_ (OdfDocument->odf_context().fontContainer(), false),
|
||||
odf_document_ (OdfDocument)
|
||||
current_process_comment_ (false),
|
||||
odf_document_ (_odf_document),
|
||||
math_context_ (_odf_document->odf_context().fontContainer(), false)
|
||||
{
|
||||
streams_man_ = streams_man::create(temp_stream_);
|
||||
mediaitems_ = boost::make_shared<mediaitems>(odf_document_->get_folder());
|
||||
chart_drawing_handle_ = boost::make_shared<xlsx_drawing_context_handle>(mediaitems_);
|
||||
|
||||
streams_man_ = streams_man::create(temp_stream_);
|
||||
}
|
||||
docx_conversion_context::~docx_conversion_context()
|
||||
{
|
||||
@ -166,7 +170,7 @@ void docx_conversion_context::set_output_document(package::docx_document * docum
|
||||
}
|
||||
void docx_conversion_context::set_font_directory(std::wstring pathFonts)
|
||||
{
|
||||
mediaitems_.set_font_directory(pathFonts);
|
||||
mediaitems_->set_font_directory(pathFonts);
|
||||
}
|
||||
std::wstring styles_map::get(const std::wstring & Name, odf_types::style_family::type Type)
|
||||
{
|
||||
@ -369,6 +373,9 @@ void docx_conversion_context::start_index_content()
|
||||
sInstrText += L" \\n "+ std::to_wstring(table_content_context_.min_outline_level) + L"-" +
|
||||
std::to_wstring(table_content_context_.max_outline_level);
|
||||
}
|
||||
else if (table_content_context_.type_table_content == 1)
|
||||
sInstrText += L" \\o";
|
||||
|
||||
if (false == table_content_context_.outline_level_styles.empty())
|
||||
{
|
||||
sInstrText += L" \\t \"";
|
||||
@ -615,9 +622,9 @@ std::wstring docx_conversion_context::add_hyperlink(const std::wstring & href, b
|
||||
{
|
||||
hyperlinks::_type_place type = hyperlinks::document_place;
|
||||
|
||||
if (process_comment_ == true) type = hyperlinks::comment_place;
|
||||
else if (process_note_ == footNote || process_note_ == footNoteRefSet) type = hyperlinks::footnote_place;
|
||||
else if (process_note_ == endNote || process_note_ == endNoteRefSet ) type = hyperlinks::endnote_place;
|
||||
if (current_process_comment_ == true) type = hyperlinks::comment_place;
|
||||
else if (current_process_note_ == footNote || current_process_note_ == footNoteRefSet) type = hyperlinks::footnote_place;
|
||||
else if (current_process_note_ == endNote || current_process_note_ == endNoteRefSet ) type = hyperlinks::endnote_place;
|
||||
|
||||
std::wstring href_correct = xml::utils::replace_text_to_xml(href);
|
||||
XmlUtils::replace_all( href_correct, L" .", L".");//1 (130).odt
|
||||
@ -681,11 +688,14 @@ void docx_conversion_context::end_document()
|
||||
{
|
||||
output_stream() << L"</w:document>";
|
||||
|
||||
output_document_->get_word_files().set_document ( package::simple_element::create(L"document.xml", document_xml_.str()) );
|
||||
output_document_->get_word_files().set_document ( package::simple_element::create(L"document.xml", document_xml_.str()) );
|
||||
output_document_->get_word_files().set_settings ( package::simple_element::create(L"settings.xml", dump_settings_document()));
|
||||
output_document_->get_word_files().set_media ( mediaitems_);
|
||||
output_document_->get_word_files().set_comments ( comments_context_);
|
||||
output_document_->get_word_files().set_headers_footers( headers_footers_);
|
||||
output_document_->get_word_files().set_headers_footers( headers_footers_);
|
||||
|
||||
package::xl_drawings_ptr drawings = package::xl_drawings::create(chart_drawing_handle_->content(), chart_drawing_handle_->content_vml());
|
||||
output_document_->get_word_files().set_drawings(drawings);
|
||||
|
||||
package::content_types_file & content_file_ = output_document_->get_content_types_file();
|
||||
content_file_.set_media( mediaitems_);
|
||||
@ -1067,7 +1077,7 @@ void docx_conversion_context::process_styles()
|
||||
|
||||
const std::wstring displayName = StyleDisplayName(arStyles[i]->name(), arStyles[i]->display_name(), arStyles[i]->type());
|
||||
|
||||
_Wostream << L"<w:name w:val=\"" << displayName << L"\"/>";
|
||||
_Wostream << L"<w:name w:val=\"" << XmlUtils::EncodeXmlString(displayName) << L"\"/>";
|
||||
|
||||
if (odf_reader::style_instance * baseOn = arStyles[i]->parent())
|
||||
{
|
||||
@ -1341,6 +1351,7 @@ void docx_conversion_context::end_automatic_style()
|
||||
in_automatic_style_ = false;
|
||||
automatic_parent_style_.clear();
|
||||
tabs_context_.clear();
|
||||
current_outline_level_ = -1;
|
||||
}
|
||||
|
||||
bool docx_conversion_context::in_automatic_style()
|
||||
@ -1459,7 +1470,7 @@ void docx_conversion_context::end_text_list_style()
|
||||
text_list_style_name_ = L"";
|
||||
}
|
||||
|
||||
const std::wstring & docx_conversion_context::get_text_list_style_name()
|
||||
std::wstring docx_conversion_context::get_text_list_style_name()
|
||||
{
|
||||
return text_list_style_name_;
|
||||
}
|
||||
@ -1485,9 +1496,9 @@ void docx_conversion_context::end_list()
|
||||
list_style_stack_.pop_back();
|
||||
}
|
||||
|
||||
const std::wstring docx_conversion_context::current_list_style() const
|
||||
std::wstring docx_conversion_context::current_list_style()
|
||||
{
|
||||
if (!list_style_stack_.empty())
|
||||
if (false == list_style_stack_.empty())
|
||||
return list_style_stack_.back();
|
||||
else
|
||||
return L"";
|
||||
@ -1540,6 +1551,93 @@ int docx_conversion_context::process_text_attr(odf_reader::text::paragraph_attrs
|
||||
push_text_properties(styleContent->get_style_text_properties());
|
||||
return 1;
|
||||
}
|
||||
int docx_conversion_context::process_paragraph_style(const std::wstring & style_name)
|
||||
{
|
||||
if (style_name.empty()) return 0;
|
||||
|
||||
if (odf_reader::style_instance * styleInst =
|
||||
root()->odf_context().styleContainer().style_by_name(style_name, odf_types::style_family::Paragraph, process_headers_footers_))
|
||||
{
|
||||
double font_size = odf_reader::text_format_properties_content::process_font_size_impl(odf_types::font_size(odf_types::percent(100.0)), styleInst);
|
||||
if (font_size > 0) current_fontSize.push_back(font_size);
|
||||
|
||||
process_page_break_after(styleInst);
|
||||
|
||||
if (styleInst->is_automatic())
|
||||
{
|
||||
if (odf_reader::style_content * styleContent = styleInst->content())
|
||||
{
|
||||
std::wstring id;
|
||||
//office_element_ptr parent_tab_stops_;
|
||||
if (const odf_reader::style_instance * parentStyleContent = styleInst->parent())
|
||||
{
|
||||
std::wstring parent_name = parentStyleContent->name();
|
||||
id = styles_map_.get( parent_name, parentStyleContent->type() );
|
||||
|
||||
if (in_table_content_ && table_content_context_.empty_current_table_content_level_index())
|
||||
{
|
||||
table_content_context_.set_current_level(parent_name);
|
||||
}
|
||||
}
|
||||
|
||||
start_automatic_style(id);
|
||||
|
||||
calc_tab_stops(styleInst, get_tabs_context());
|
||||
|
||||
//вытаскивает rtl c цепочки стилей !! - просто прописать в наследуемом НЕЛЬЗЯ !!
|
||||
odf_reader::paragraph_format_properties properties = odf_reader::calc_paragraph_properties_content(styleInst);
|
||||
if (properties.style_writing_mode_)
|
||||
{
|
||||
odf_types::writing_mode::type type = properties.style_writing_mode_->get_type();
|
||||
switch(type)
|
||||
{
|
||||
case odf_types::writing_mode::RlTb:
|
||||
case odf_types::writing_mode::TbRl:
|
||||
case odf_types::writing_mode::Rl:
|
||||
set_rtl(true);
|
||||
break;
|
||||
default:
|
||||
set_rtl(false);
|
||||
}
|
||||
}
|
||||
set_margin_left(properties.fo_margin_left_? 20.0 * properties.fo_margin_left_->get_length().get_value_unit(odf_types::length::pt) : 0);
|
||||
|
||||
styleContent->docx_convert(*this);
|
||||
|
||||
end_automatic_style();
|
||||
|
||||
//push_text_properties(styleContent->get_style_text_properties());
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::wstring id = styles_map_.get( styleInst->name(), styleInst->type() );
|
||||
output_stream() << L"<w:pPr>";
|
||||
|
||||
output_stream() << L"<w:pStyle w:val=\"" << id << L"\" />";
|
||||
|
||||
if (!get_text_tracked_context().dumpPPr_.empty())
|
||||
{
|
||||
output_stream() << get_text_tracked_context().dumpPPr_;
|
||||
get_text_tracked_context().dumpPPr_.clear();
|
||||
}
|
||||
|
||||
serialize_list_properties(output_stream());
|
||||
|
||||
if (!get_text_tracked_context().dumpRPrInsDel_.empty())
|
||||
{
|
||||
output_stream() << L"<w:rPr>";
|
||||
output_stream() << get_text_tracked_context().dumpRPrInsDel_;
|
||||
get_text_tracked_context().dumpRPrInsDel_.clear();
|
||||
output_stream() << L"</w:rPr>";
|
||||
}
|
||||
output_stream() << L"</w:pPr>";
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_attrs *Attr)
|
||||
{
|
||||
if (!Attr) return 0;
|
||||
@ -1560,19 +1658,22 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
|
||||
if (odf_reader::style_instance * styleInst =
|
||||
root()->odf_context().styleContainer().style_by_name(Attr->text_style_name_, odf_types::style_family::Paragraph, process_headers_footers_)
|
||||
)
|
||||
{
|
||||
process_page_break_after(styleInst);
|
||||
{
|
||||
double font_size = odf_reader::text_format_properties_content::process_font_size_impl(odf_types::font_size(odf_types::percent(100.0)), styleInst);
|
||||
if (font_size > 0) current_fontSize.push_back(font_size);
|
||||
|
||||
process_page_break_after(styleInst);
|
||||
|
||||
if (styleInst->is_automatic())
|
||||
{
|
||||
if (odf_reader::style_content * styleContent = styleInst->content())
|
||||
{
|
||||
std::wstring id;
|
||||
{
|
||||
if (odf_reader::style_content * styleContent = styleInst->content())
|
||||
{
|
||||
std::wstring id;
|
||||
//office_element_ptr parent_tab_stops_;
|
||||
if (const odf_reader::style_instance * parentStyleContent = styleInst->parent())
|
||||
if (const odf_reader::style_instance * parentStyleContent = styleInst->parent())
|
||||
{
|
||||
std::wstring parent_name = parentStyleContent->name();
|
||||
id = styles_map_.get( parent_name, parentStyleContent->type() );
|
||||
id = styles_map_.get( parent_name, parentStyleContent->type() );
|
||||
|
||||
if (in_table_content_ && table_content_context_.empty_current_table_content_level_index())
|
||||
{
|
||||
@ -1580,7 +1681,7 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
|
||||
}
|
||||
}
|
||||
|
||||
start_automatic_style(id);
|
||||
start_automatic_style(id);
|
||||
|
||||
calc_tab_stops(styleInst, get_tabs_context());
|
||||
|
||||
@ -1601,16 +1702,15 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
|
||||
}
|
||||
}
|
||||
set_margin_left(properties.fo_margin_left_? 20.0 * properties.fo_margin_left_->get_length().get_value_unit(odf_types::length::pt) : 0);
|
||||
|
||||
styleContent->docx_convert(*this);
|
||||
if ((Attr->outline_level_) && (*Attr->outline_level_ > 0))
|
||||
{
|
||||
std::wstringstream & _pPr = get_styles_context().paragraph_nodes();
|
||||
_pPr << L"<w:outlineLvl w:val=\"" << *Attr->outline_level_ - 1 << L"\"/>";
|
||||
}
|
||||
set_outline_level(*Attr->outline_level_ - 1);
|
||||
}
|
||||
styleContent->docx_convert(*this);
|
||||
|
||||
end_automatic_style();
|
||||
|
||||
push_text_properties(styleContent->get_style_text_properties());
|
||||
push_text_properties(styleContent->get_style_text_properties());
|
||||
|
||||
if (!get_section_context().dump_.empty()
|
||||
&& !get_table_context().in_table()
|
||||
@ -1626,6 +1726,8 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
|
||||
output_stream() << L"</w:pPr>";
|
||||
finish_paragraph();
|
||||
start_paragraph();
|
||||
//process_paragraph_style(Context.get_current_paragraph_style()); ??
|
||||
|
||||
if ((Attr->outline_level_) && (*Attr->outline_level_ > 0))
|
||||
{
|
||||
output_stream() << L"<w:pPr>";
|
||||
@ -1645,58 +1747,58 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::wstring id = styles_map_.get( styleInst->name(), styleInst->type() );
|
||||
output_stream() << L"<w:pPr>";
|
||||
//todooo причесать
|
||||
if (!get_section_context().dump_.empty()
|
||||
&& !get_table_context().in_table()
|
||||
&& (get_process_note() == oox::docx_conversion_context::noNote)
|
||||
&& !in_drawing)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::wstring id = styles_map_.get( styleInst->name(), styleInst->type() );
|
||||
output_stream() << L"<w:pPr>";
|
||||
//todooo причесать
|
||||
if (!get_section_context().dump_.empty()
|
||||
&& !get_table_context().in_table()
|
||||
&& (get_process_note() == oox::docx_conversion_context::noNote)
|
||||
&& !in_drawing)
|
||||
{
|
||||
if (is_paragraph_header() )
|
||||
{
|
||||
if (is_paragraph_header() )
|
||||
{
|
||||
output_stream() << get_section_context().dump_;
|
||||
get_section_context().dump_.clear();
|
||||
output_stream() << get_section_context().dump_;
|
||||
get_section_context().dump_.clear();
|
||||
|
||||
output_stream() << L"</w:pPr>";
|
||||
finish_paragraph();
|
||||
start_paragraph();
|
||||
output_stream() << L"<w:pPr>";
|
||||
}
|
||||
else
|
||||
{
|
||||
output_stream() << get_section_context().dump_;
|
||||
get_section_context().dump_.clear();
|
||||
}
|
||||
output_stream() << L"</w:pPr>";
|
||||
finish_paragraph();
|
||||
start_paragraph();
|
||||
output_stream() << L"<w:pPr>";
|
||||
}
|
||||
|
||||
output_stream() << L"<w:pStyle w:val=\"" << id << L"\" />";
|
||||
|
||||
if (!get_text_tracked_context().dumpPPr_.empty())
|
||||
else
|
||||
{
|
||||
output_stream() << get_text_tracked_context().dumpPPr_;
|
||||
get_text_tracked_context().dumpPPr_.clear();
|
||||
output_stream() << get_section_context().dump_;
|
||||
get_section_context().dump_.clear();
|
||||
}
|
||||
}
|
||||
|
||||
serialize_list_properties(output_stream());
|
||||
|
||||
if ((Attr->outline_level_) && (*Attr->outline_level_ > 0))
|
||||
{
|
||||
output_stream() << L"<w:outlineLvl w:val=\"" << *Attr->outline_level_ - 1 << L"\" />";
|
||||
}
|
||||
output_stream() << L"<w:pStyle w:val=\"" << id << L"\" />";
|
||||
|
||||
if (!get_text_tracked_context().dumpRPrInsDel_.empty())
|
||||
{
|
||||
output_stream() << L"<w:rPr>";
|
||||
output_stream() << get_text_tracked_context().dumpRPrInsDel_;
|
||||
get_text_tracked_context().dumpRPrInsDel_.clear();
|
||||
output_stream() << L"</w:rPr>";
|
||||
}
|
||||
output_stream() << L"</w:pPr>";
|
||||
if (!get_text_tracked_context().dumpPPr_.empty())
|
||||
{
|
||||
output_stream() << get_text_tracked_context().dumpPPr_;
|
||||
get_text_tracked_context().dumpPPr_.clear();
|
||||
}
|
||||
|
||||
serialize_list_properties(output_stream());
|
||||
|
||||
if ((Attr->outline_level_) && (*Attr->outline_level_ > 0))
|
||||
{
|
||||
output_stream() << L"<w:outlineLvl w:val=\"" << *Attr->outline_level_ - 1 << L"\" />";
|
||||
}
|
||||
|
||||
if (!get_text_tracked_context().dumpRPrInsDel_.empty())
|
||||
{
|
||||
output_stream() << L"<w:rPr>";
|
||||
output_stream() << get_text_tracked_context().dumpRPrInsDel_;
|
||||
get_text_tracked_context().dumpRPrInsDel_.clear();
|
||||
output_stream() << L"</w:rPr>";
|
||||
}
|
||||
output_stream() << L"</w:pPr>";
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
@ -1747,28 +1849,27 @@ void docx_conversion_context::process_page_break_after(const odf_reader::style_i
|
||||
}
|
||||
void docx_conversion_context::serialize_list_properties(std::wostream & strm)
|
||||
{
|
||||
if (!list_style_stack_.empty())
|
||||
if (list_style_stack_.empty()) return;
|
||||
|
||||
if (first_element_list_item_)
|
||||
{
|
||||
if (first_element_list_item_)
|
||||
{
|
||||
const int id = root()->odf_context().listStyleContainer().id_by_name( current_list_style() );
|
||||
const int id = root()->odf_context().listStyleContainer().id_by_name( current_list_style() );
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"w:numPr")
|
||||
{
|
||||
CP_XML_NODE(L"w:numPr")
|
||||
CP_XML_NODE(L"w:ilvl")
|
||||
{
|
||||
CP_XML_NODE(L"w:ilvl")
|
||||
{
|
||||
CP_XML_ATTR(L"w:val", (list_style_stack_.size() - 1));
|
||||
}
|
||||
CP_XML_NODE(L"w:numId")
|
||||
{
|
||||
CP_XML_ATTR(L"w:val", id );
|
||||
}
|
||||
CP_XML_ATTR(L"w:val", (list_style_stack_.size() - 1));
|
||||
}
|
||||
CP_XML_NODE(L"w:numId")
|
||||
{
|
||||
CP_XML_ATTR(L"w:val", id );
|
||||
}
|
||||
}
|
||||
first_element_list_item_ = false;
|
||||
}
|
||||
}
|
||||
first_element_list_item_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1824,7 +1925,7 @@ namespace
|
||||
//слить если есть mediaitems, добавить релсы и обнулить их для основного документа.
|
||||
rels internal_rels;
|
||||
|
||||
Context.get_mediaitems().dump_rels(internal_rels);
|
||||
Context.get_mediaitems()->dump_rels(internal_rels);
|
||||
Context.dump_hyperlinks(internal_rels, hyperlinks::document_place);
|
||||
|
||||
Context.get_headers_footers().add(styleName, dbgStr, type, internal_rels);
|
||||
@ -1934,12 +2035,12 @@ void notes_context::dump_rels(rels & Rels) const
|
||||
|
||||
void docx_conversion_context::add_note_reference ()
|
||||
{
|
||||
if (process_note_ == footNote || process_note_ == endNote)
|
||||
if (current_process_note_ == footNote || current_process_note_ == endNote)
|
||||
{
|
||||
add_element_to_run(_T(""));
|
||||
output_stream() << ((process_note_ == footNote) ? L"<w:footnoteRef />" : L"<w:endnoteRef />");
|
||||
output_stream() << ((current_process_note_ == footNote) ? L"<w:footnoteRef />" : L"<w:endnoteRef />");
|
||||
finish_run();
|
||||
process_note_ = (NoteType) (process_note_ + 1); //add ref set
|
||||
current_process_note_ = (NoteType) (current_process_note_ + 1); //add ref set
|
||||
}
|
||||
}
|
||||
|
||||
@ -1988,7 +2089,7 @@ void docx_conversion_context::start_text_changes (const std::wstring &id)
|
||||
void docx_conversion_context::start_changes()
|
||||
{
|
||||
if (map_current_changes_.empty()) return;
|
||||
if (process_comment_) return;
|
||||
if (current_process_comment_) return;
|
||||
|
||||
text_tracked_context_.dumpPPr_.clear();
|
||||
text_tracked_context_.dumpRPr_.clear();
|
||||
@ -2087,7 +2188,7 @@ void docx_conversion_context::start_changes()
|
||||
|
||||
void docx_conversion_context::end_changes()
|
||||
{
|
||||
if (process_comment_) return;
|
||||
if (current_process_comment_) return;
|
||||
|
||||
for (map_changes_iterator it = map_current_changes_.begin(); it != map_current_changes_.end(); ++it)
|
||||
{
|
||||
|
||||
@ -42,6 +42,7 @@
|
||||
#include "docx_table_context.h"
|
||||
#include "oox_conversion_context.h"
|
||||
#include "oox_chart_context.h"
|
||||
#include "xlsx_drawing_context.h"
|
||||
|
||||
#include "headers_footers.h"
|
||||
#include "hyperlinks.h"
|
||||
@ -734,7 +735,7 @@ class docx_conversion_context : boost::noncopyable
|
||||
public:
|
||||
enum NoteType { noNote, footNote, footNoteRefSet, endNote, endNoteRefSet };
|
||||
|
||||
docx_conversion_context(odf_reader::odf_document * OdfDocument);
|
||||
docx_conversion_context(odf_reader::odf_document * _odf_document);
|
||||
~docx_conversion_context();
|
||||
|
||||
void set_output_document (package::docx_document * document);
|
||||
@ -829,6 +830,7 @@ public:
|
||||
bool process_page_properties(std::wostream & strm);
|
||||
void process_section (std::wostream & strm, odf_reader::style_columns * columns = NULL);
|
||||
|
||||
int process_paragraph_style (const std::wstring & style_name);
|
||||
int process_paragraph_attr (odf_reader::text::paragraph_attrs *attr);
|
||||
int process_text_attr (odf_reader::text::paragraph_attrs *Attr);
|
||||
void process_page_break_after(const odf_reader::style_instance *styleInst);
|
||||
@ -872,8 +874,8 @@ public:
|
||||
void start_text_list_style (const std::wstring & StyleName);
|
||||
void end_text_list_style ();
|
||||
|
||||
const std::wstring & get_text_list_style_name();
|
||||
const std::wstring current_list_style () const;
|
||||
std::wstring get_text_list_style_name();
|
||||
std::wstring current_list_style();
|
||||
|
||||
void start_list (const std::wstring & StyleName, bool Continue = false);
|
||||
void end_list ();
|
||||
@ -887,7 +889,7 @@ public:
|
||||
|
||||
styles_map * get_style_map() { return &styles_map_; }
|
||||
|
||||
mediaitems & get_mediaitems() {return mediaitems_;}
|
||||
mediaitems_ptr & get_mediaitems() {return mediaitems_;}
|
||||
styles_context & get_styles_context() { return styles_context_; }
|
||||
drawing_context & get_drawing_context() { return drawing_context_; }
|
||||
comments_context & get_comments_context() { return comments_context_; }
|
||||
@ -897,8 +899,9 @@ public:
|
||||
text_tracked_context& get_text_tracked_context(){ return text_tracked_context_; }
|
||||
forms_context & get_forms_context() { return forms_context_; }
|
||||
tabs_context & get_tabs_context() { return tabs_context_;}
|
||||
table_content_context & get_table_content_context() { return table_content_context_;}
|
||||
|
||||
table_content_context & get_table_content_context() { return table_content_context_;}
|
||||
xlsx_drawing_context_handle_ptr & get_chart_drawing_handle() { return chart_drawing_handle_;}
|
||||
|
||||
void set_drawing_text_props (const std::wstring &props);
|
||||
|
||||
@ -910,23 +913,32 @@ public:
|
||||
StreamsManPtr get_stream_man() const { return streams_man_; }
|
||||
void set_stream_man(StreamsManPtr Sm) { streams_man_ = Sm; }
|
||||
|
||||
void set_rtl(bool val) { is_rtl_ = val; }
|
||||
bool get_rtl() const {return is_rtl_;}
|
||||
void set_rtl(bool val) { is_rtl_ = val; }
|
||||
bool get_rtl() const {return is_rtl_;}
|
||||
|
||||
double get_current_fontSize() {return current_fontSize.empty() ? 0 : current_fontSize.back();}
|
||||
void pop_current_fontSize() {if (!current_fontSize.empty()) current_fontSize.pop_back();}
|
||||
|
||||
void set_margin_left(int val) {current_margin_left_ = val;}
|
||||
int get_margin_left() {return current_margin_left_;}
|
||||
|
||||
void set_process_note (NoteType Val) { process_note_ = Val; }
|
||||
NoteType get_process_note () const { return process_note_; }
|
||||
void set_outline_level(int val) {current_outline_level_ = val;}
|
||||
int get_outline_level() {return current_outline_level_;}
|
||||
|
||||
void set_process_note (NoteType Val) { current_process_note_ = Val; }
|
||||
NoteType get_process_note () const { return current_process_note_; }
|
||||
void add_note_reference ();
|
||||
|
||||
void start_paragraph_style(const std::wstring& style_name) {paragraph_style_stack_.push_back(style_name);}
|
||||
void end_paragraph_style() { if (!paragraph_style_stack_.empty()) paragraph_style_stack_.pop_back();}
|
||||
std::wstring get_current_paragraph_style() {return paragraph_style_stack_.empty() ? L"" : paragraph_style_stack_.back();}
|
||||
|
||||
oox_chart_context & current_chart();
|
||||
void start_chart(std::wstring name);
|
||||
void end_chart ();
|
||||
|
||||
void start_comment () {process_comment_ = true;}
|
||||
void end_comment () {process_comment_ = false;}
|
||||
bool process_comment_;
|
||||
void start_comment () {current_process_comment_ = true;}
|
||||
void end_comment () {current_process_comment_ = false;}
|
||||
|
||||
void start_math_formula ();
|
||||
void end_math_formula ();
|
||||
@ -945,7 +957,7 @@ public:
|
||||
|
||||
headers_footers & get_headers_footers() { return headers_footers_; }
|
||||
header_footer_context & get_header_footer_context() { return header_footer_context_; }
|
||||
drop_cap_context & get_drop_cap_context() {return drop_cap_context_;}
|
||||
drop_cap_context & get_drop_cap_context() { return drop_cap_context_; }
|
||||
|
||||
styles_map styles_map_;
|
||||
bool process_headers_footers_;
|
||||
@ -956,6 +968,7 @@ public:
|
||||
void end_changes();
|
||||
|
||||
void add_jsaProject(const std::string &content);
|
||||
|
||||
private:
|
||||
|
||||
struct _context_state
|
||||
@ -982,6 +995,8 @@ private:
|
||||
std::wstringstream settings_xml_;
|
||||
std::wstringstream meta_xml_;
|
||||
|
||||
xlsx_drawing_context_handle_ptr chart_drawing_handle_;
|
||||
|
||||
styles_context styles_context_;
|
||||
math_context math_context_;
|
||||
drawing_context drawing_context_;
|
||||
@ -1004,18 +1019,18 @@ private:
|
||||
std::vector<odf_reader::_property> settings_properties_;
|
||||
|
||||
hyperlinks hyperlinks_;
|
||||
mediaitems mediaitems_;
|
||||
mediaitems_ptr mediaitems_;
|
||||
std::vector<oox_chart_context_ptr> charts_;
|
||||
headers_footers headers_footers_;
|
||||
|
||||
std::wstring automatic_parent_style_;
|
||||
std::wstring current_master_page_name_;
|
||||
std::wstring text_list_style_name_;
|
||||
|
||||
std::vector<std::wstring> list_style_stack_;
|
||||
std::vector<std::wstring> fields_names_stack_;
|
||||
std::wstring automatic_parent_style_;
|
||||
std::wstring current_master_page_name_;
|
||||
std::wstring text_list_style_name_;
|
||||
std::vector<std::wstring> paragraph_style_stack_;
|
||||
std::vector<std::wstring> list_style_stack_;
|
||||
std::vector<std::wstring> fields_names_stack_;
|
||||
|
||||
bool first_element_list_item_;
|
||||
bool first_element_list_item_;
|
||||
|
||||
bool page_break_after_;
|
||||
bool page_break_before_;
|
||||
@ -1029,10 +1044,13 @@ private:
|
||||
bool is_delete_text_;
|
||||
bool is_rtl_; // right-to-left
|
||||
|
||||
std::wstring current_alphabetic_index_;
|
||||
int current_margin_left_;
|
||||
int new_list_style_number_; // счетчик для нумерации имен созданных в процессе конвертации стилей
|
||||
NoteType process_note_;
|
||||
NoteType current_process_note_;
|
||||
bool current_process_comment_;
|
||||
std::vector<double> current_fontSize;
|
||||
std::wstring current_alphabetic_index_;
|
||||
int current_margin_left_;
|
||||
int current_outline_level_;
|
||||
int new_list_style_number_; // счетчик для нумерации имен созданных в процессе конвертации стилей
|
||||
|
||||
std::vector<odf_reader::office_element*> delayed_elements_;
|
||||
|
||||
|
||||
@ -151,7 +151,6 @@ void serialize_wrap(std::wostream & strm, _docx_drawing const & val)
|
||||
break;
|
||||
case odf_types::style_wrap::Left:
|
||||
case odf_types::style_wrap::Right:
|
||||
case odf_types::style_wrap::Dynamic:
|
||||
serialize_wrap_square(strm, val);
|
||||
break;
|
||||
case odf_types::style_wrap::RunThrough:
|
||||
@ -160,6 +159,7 @@ void serialize_wrap(std::wostream & strm, _docx_drawing const & val)
|
||||
case odf_types::style_wrap::None:
|
||||
serialize_wrap_top_bottom(strm, val);
|
||||
break;
|
||||
case odf_types::style_wrap::Dynamic:
|
||||
default:
|
||||
CP_XML_NODE(L"wp:wrapTopAndBottom");
|
||||
break;
|
||||
|
||||
@ -102,7 +102,11 @@ void word_files::write(const std::wstring & RootPath)
|
||||
{
|
||||
embeddings_->write( path );
|
||||
}
|
||||
|
||||
if (drawings_)
|
||||
{
|
||||
drawings_->set_main_document(get_main_document());
|
||||
drawings_->write( path );
|
||||
}
|
||||
if (headers_footers_)
|
||||
{
|
||||
headers_footers_->write( path );
|
||||
@ -140,22 +144,22 @@ void word_files::write(const std::wstring & RootPath)
|
||||
|
||||
void word_files::update_rels(docx_conversion_context & Context)
|
||||
{
|
||||
Context.get_mediaitems().dump_rels(rels_files_.get_rel_file()->get_rels());
|
||||
Context.get_mediaitems()->dump_rels(rels_files_.get_rel_file()->get_rels());
|
||||
|
||||
Context.dump_hyperlinks (rels_files_.get_rel_file()->get_rels(), hyperlinks::document_place);
|
||||
Context.dump_headers_footers(rels_files_.get_rel_file()->get_rels());
|
||||
Context.dump_notes (rels_files_.get_rel_file()->get_rels());
|
||||
}
|
||||
|
||||
void word_files::set_media(mediaitems & _Mediaitems)
|
||||
void word_files::set_media(mediaitems_ptr & _mediaitems)
|
||||
{
|
||||
if (_Mediaitems.count_image + _Mediaitems.count_media > 0)
|
||||
if (_mediaitems->count_image + _mediaitems->count_media > 0)
|
||||
{
|
||||
media_ = element_ptr( new media(_Mediaitems, _Mediaitems.applicationFonts()) );
|
||||
media_ = element_ptr( new media(_mediaitems, _mediaitems->applicationFonts()) );
|
||||
}
|
||||
if (_Mediaitems.count_object > 0)
|
||||
if (_mediaitems->count_object > 0)
|
||||
{
|
||||
embeddings_ = element_ptr( new embeddings(_Mediaitems) );
|
||||
embeddings_ = element_ptr( new embeddings(_mediaitems) );
|
||||
embeddings_->set_main_document( get_main_document() );
|
||||
}
|
||||
}
|
||||
@ -195,6 +199,10 @@ void word_files::add_jsaProject(const std::string &content)
|
||||
{
|
||||
jsaProject_ = package::simple_element::create(L"jsaProject.bin", content);
|
||||
}
|
||||
void word_files::set_drawings(element_ptr Element)
|
||||
{
|
||||
drawings_ = Element;
|
||||
}
|
||||
void word_files::set_headers_footers(headers_footers & HeadersFooters)
|
||||
{
|
||||
headers_footers_elements * elm = new headers_footers_elements(HeadersFooters);
|
||||
|
||||
@ -137,10 +137,11 @@ public:
|
||||
void set_numbering (element_ptr Element);
|
||||
void set_settings (element_ptr Element);
|
||||
bool has_numbering ();
|
||||
void set_media (mediaitems & mediaitems_);
|
||||
void set_media (mediaitems_ptr & mediaitems_);
|
||||
void set_headers_footers(headers_footers & HeadersFooters);
|
||||
void set_notes (notes_context & notesContext);
|
||||
void set_comments (comments_context & commentsContext);
|
||||
void set_drawings (element_ptr Element);
|
||||
|
||||
void add_charts(chart_content_ptr chart);
|
||||
void add_jsaProject(const std::string &content);
|
||||
@ -163,6 +164,7 @@ private:
|
||||
element_ptr settings_;
|
||||
element_ptr comments_;
|
||||
element_ptr jsaProject_;
|
||||
element_ptr drawings_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -62,6 +62,9 @@ struct drawing_object_description
|
||||
double anchor_x_;
|
||||
double anchor_y_;
|
||||
|
||||
_CP_OPT(_INT32) owner_cx_;
|
||||
_CP_OPT(_INT32) owner_cy_;
|
||||
|
||||
_action_desc action_;
|
||||
std::vector<_hlink_desc> hlinks_;
|
||||
|
||||
|
||||
@ -73,7 +73,7 @@ std::pair<float, float> GetMaxDigitSizePixelsImpl(const std::wstring & fontName,
|
||||
//if (FALSE == (hr = pFontManager->LoadString2( std::to_wstring(i), 0, 0)))
|
||||
// return std::pair<float, float>(7,8);
|
||||
|
||||
if (FALSE == (hr = pFontManager->LoadString2( L"xxxxx" , 0, 0)))
|
||||
if (FALSE == (hr = pFontManager->LoadString2( L"0123456789abcdefghijklmnopqrstuvwxyz" , 0, 0)))
|
||||
return std::pair<float, float>(7,8);
|
||||
|
||||
TBBox box;
|
||||
@ -96,7 +96,7 @@ std::pair<float, float> GetMaxDigitSizePixelsImpl(const std::wstring & fontName,
|
||||
if (box.fMaxY - box.fMinY < minHeight) minHeight = box.fMaxY - box.fMinY;
|
||||
}
|
||||
|
||||
double width = (minWidth + 2 * maxWidth) /3. /5.;
|
||||
double width = (minWidth + 2 * maxWidth) /36. /3.;
|
||||
return std::pair<float, float>(width, maxHeight);
|
||||
}
|
||||
|
||||
|
||||
@ -101,6 +101,7 @@ void mediaitems::set_font_directory(std::wstring pathFonts)
|
||||
if (applicationFonts_)
|
||||
applicationFonts_->InitializeFromFolder(pathFonts);
|
||||
}
|
||||
|
||||
std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, bool & isInternal)
|
||||
{
|
||||
std::wstring ref;
|
||||
@ -193,7 +194,14 @@ std::wstring mediaitems::detectImageFileExtension(const std::wstring &fileName)
|
||||
CImageFileFormatChecker image_checker;
|
||||
sExt = image_checker.DetectFormatByData(buffer, buffer_size);
|
||||
|
||||
if (!sExt.empty()) sExt = std::wstring(L".") + sExt;
|
||||
if (sExt.empty())
|
||||
{
|
||||
size_t n = fileName.rfind(L".");
|
||||
if (n != std::wstring::npos)
|
||||
sExt = XmlUtils::GetLower(fileName.substr(n));
|
||||
|
||||
}
|
||||
else sExt = std::wstring(L".") + sExt;
|
||||
}
|
||||
return XmlUtils::GetLower(sExt);
|
||||
}
|
||||
@ -329,6 +337,10 @@ void mediaitems::dump_rels(rels & Rels)
|
||||
{
|
||||
for (size_t i = 0; i < items_.size(); i++)
|
||||
{
|
||||
if ( items_[i].type == typeUnknown ) continue;
|
||||
if ( items_[i].type == typeShape ) continue;
|
||||
if ( items_[i].type == typeGroupShape ) continue;
|
||||
|
||||
if (items_[i].count_used >= items_[i].count_add) continue; // уже использовали этот релс выше(колонтитул ....)
|
||||
|
||||
Rels.add( relationship(
|
||||
@ -338,7 +350,7 @@ void mediaitems::dump_rels(rels & Rels)
|
||||
items_[i].mediaInternal ? L"" : L"External" )
|
||||
);
|
||||
items_[i].count_used++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -137,6 +137,7 @@ public:
|
||||
|
||||
return typeMedia;
|
||||
}
|
||||
|
||||
private:
|
||||
std::wstring create_file_name (const std::wstring & uri, RelsType type, bool & isInternal, size_t Num);
|
||||
std::wstring detectImageFileExtension (const std::wstring &fileName);
|
||||
@ -147,6 +148,7 @@ private:
|
||||
NSFonts::IApplicationFonts *applicationFonts_;
|
||||
};
|
||||
|
||||
typedef _CP_PTR(mediaitems) mediaitems_ptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -122,6 +122,7 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
|
||||
oox_chart_shape shape;
|
||||
_CP_OPT(bool) boolVal;
|
||||
_CP_OPT(std::wstring) strVal;
|
||||
_CP_OPT(double) doubleVal;
|
||||
|
||||
oox_title title;
|
||||
title.set_content(content_.title_);//todo нужно задать понармальному layout
|
||||
@ -146,7 +147,23 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
|
||||
CP_XML_ATTR(L"val", "minMax");//default
|
||||
}
|
||||
}
|
||||
odf_reader::GetProperty(content_.properties_,L"logarithmic",boolVal);
|
||||
odf_reader::GetProperty(content_.properties_,L"maximum", doubleVal);
|
||||
if (doubleVal)
|
||||
{
|
||||
CP_XML_NODE(L"c:max")
|
||||
{
|
||||
CP_XML_ATTR(L"val", *doubleVal);
|
||||
}
|
||||
}
|
||||
odf_reader::GetProperty(content_.properties_,L"minimum", doubleVal);
|
||||
if (doubleVal)
|
||||
{
|
||||
CP_XML_NODE(L"c:min")
|
||||
{
|
||||
CP_XML_ATTR(L"val", *doubleVal);
|
||||
}
|
||||
}
|
||||
odf_reader::GetProperty(content_.properties_,L"logarithmic", boolVal);
|
||||
if ((boolVal == true) && (boolVal.get()==true))
|
||||
{
|
||||
CP_XML_NODE(L"c:logBase")
|
||||
|
||||
@ -53,7 +53,7 @@ public:
|
||||
std::wstring drawingId_;
|
||||
};
|
||||
|
||||
oox_chart_context::oox_chart_context(mediaitems & m, std::wstring name) :
|
||||
oox_chart_context::oox_chart_context(mediaitems_ptr & m, std::wstring name) :
|
||||
impl_(new oox_chart_context::Impl( name)), mediaitems_(m)
|
||||
{
|
||||
|
||||
@ -65,7 +65,7 @@ void oox_chart_context::reset_fill(oox::_oox_fill &f)
|
||||
{
|
||||
bool isInternal = true;
|
||||
std::wstring ref;
|
||||
f.bitmap->rId = mediaitems_.add_or_find(f.bitmap->xlink_href_, typeImage, isInternal, ref);
|
||||
f.bitmap->rId = mediaitems_->add_or_find(f.bitmap->xlink_href_, typeImage, isInternal, ref);
|
||||
|
||||
rels_.push_back(_rel(isInternal, f.bitmap->rId, ref, typeImage));
|
||||
}
|
||||
@ -75,9 +75,15 @@ void oox_chart_context::set_externalData(const std::wstring & href)
|
||||
bool isInternal = true;
|
||||
std::wstring href_out;
|
||||
|
||||
externalDataId_ = mediaitems_.add_or_find(href, typeMsObject, isInternal, href_out);
|
||||
externalDataId_ = mediaitems_->add_or_find(href, typeMsObject, isInternal, href_out);
|
||||
rels_.push_back(_rel(isInternal, externalDataId_, href_out, typeMsObject));
|
||||
}
|
||||
void oox_chart_context::set_userShapes(std::pair<std::wstring, std::wstring> &link)
|
||||
{
|
||||
bool isInternal = true;
|
||||
userShapesId_ = link.second;
|
||||
rels_.push_back(_rel(isInternal, userShapesId_, link.first, typeChartUserShapes));
|
||||
}
|
||||
std::wostream & oox_chart_context::chartData()
|
||||
{
|
||||
return impl_->chartData_;
|
||||
@ -116,6 +122,15 @@ void oox_chart_context::dump_rels(rels & Rels)
|
||||
(r.is_internal ? L"" : L"External"))
|
||||
);
|
||||
}
|
||||
else if (r.type == typeChartUserShapes)
|
||||
{
|
||||
Rels.add(relationship(
|
||||
r.rid,
|
||||
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartUserShapes",
|
||||
r.is_internal ? std::wstring(L"../drawings/") + r.ref : r.ref,
|
||||
(r.is_internal ? L"" : L"External"))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -226,6 +241,13 @@ void oox_chart_context::serialize(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (userShapesId_.empty() == false)
|
||||
{
|
||||
CP_XML_NODE(L"c:userShapes")
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", userShapesId_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ typedef _CP_PTR(oox_chart_context) oox_chart_context_ptr;
|
||||
class oox_chart_context
|
||||
{
|
||||
public:
|
||||
oox_chart_context(mediaitems & mediaitems_, std::wstring name);
|
||||
oox_chart_context(mediaitems_ptr & mediaitems_, std::wstring name);
|
||||
~oox_chart_context();
|
||||
|
||||
std::wostream & chartData();
|
||||
@ -83,6 +83,8 @@ public:
|
||||
}
|
||||
}
|
||||
void set_externalData(const std::wstring & href);
|
||||
void set_userShapes(std::pair<std::wstring, std::wstring> &link);
|
||||
|
||||
void add_chart(int type)
|
||||
{
|
||||
plot_area_.add_chart(type);
|
||||
@ -128,7 +130,7 @@ private:
|
||||
class Impl;
|
||||
_CP_SCOPED_PTR(Impl) impl_;
|
||||
|
||||
mediaitems &mediaitems_;
|
||||
mediaitems_ptr mediaitems_;
|
||||
std::vector<_rel> rels_;
|
||||
|
||||
cpdoccore::oox::oox_title title_;
|
||||
@ -137,6 +139,7 @@ private:
|
||||
|
||||
std::wstring pivot_source_;
|
||||
std::wstring externalDataId_;
|
||||
std::wstring userShapesId_;
|
||||
|
||||
std::vector<odf_reader::_property> graphic_properties_;
|
||||
_oox_fill fill_;
|
||||
|
||||
@ -59,12 +59,19 @@ oox_chart_series::oox_chart_series()
|
||||
bLocalTable_ = false;
|
||||
labelPosEnabled_ = true;
|
||||
}
|
||||
void oox_chart_series::setName(std::wstring &value)
|
||||
void oox_chart_series::setName(const std::wstring &value)
|
||||
{
|
||||
name_=value;
|
||||
name_ = value;
|
||||
}
|
||||
void oox_chart_series::setLabels(const std::wstring &formula, std::vector<std::wstring> & cash)
|
||||
{
|
||||
formulasconvert::odf2oox_converter converter;
|
||||
|
||||
void oox_chart_series::setFormula(int ind, std::wstring &value, std::wstring & formatCode, bool link_to_source)
|
||||
label_.present = true;
|
||||
label_.formula = converter.convert_chart_distance(formula);
|
||||
label_.str_cache = cash;
|
||||
}
|
||||
void oox_chart_series::setFormula(int ind, const std::wstring &value, const std::wstring & formatCode, bool link_to_source)
|
||||
{
|
||||
formulasconvert::odf2oox_converter converter;
|
||||
|
||||
@ -137,6 +144,7 @@ void oox_chart_series::parse_properties()
|
||||
data_labels_->set_position(*intVal);
|
||||
}
|
||||
}
|
||||
|
||||
void oox_chart_series::setValues(int ind, std::vector<std::wstring> & values)
|
||||
{
|
||||
values_[ind].present = true;
|
||||
@ -215,6 +223,44 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
|
||||
shape.set(content_.graphic_properties_, content_.fill_);
|
||||
shape.oox_serialize(_Wostream);
|
||||
|
||||
if (label_.present)
|
||||
{
|
||||
CP_XML_NODE(L"c:tx")
|
||||
{
|
||||
CP_XML_NODE(L"c:strRef")
|
||||
{
|
||||
if (!label_.formula.empty())
|
||||
{
|
||||
CP_XML_NODE(L"c:f")
|
||||
{
|
||||
CP_XML_STREAM() << label_.formula;
|
||||
}
|
||||
}
|
||||
if (false == label_.str_cache.empty())
|
||||
{
|
||||
CP_XML_NODE(L"c:strCache")
|
||||
{
|
||||
CP_XML_NODE(L"c:ptCount")
|
||||
{
|
||||
CP_XML_ATTR(L"val", label_.str_cache.size());
|
||||
}
|
||||
for (size_t i = 0; i < label_.str_cache.size(); i++)
|
||||
{
|
||||
CP_XML_NODE(L"c:pt")
|
||||
{
|
||||
CP_XML_ATTR(L"idx", i);
|
||||
CP_XML_NODE(L"c:v")
|
||||
{
|
||||
CP_XML_STREAM() << label_.str_cache[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
if (values_[i].present)
|
||||
|
||||
@ -56,17 +56,20 @@ public:
|
||||
virtual void oox_serialize(std::wostream & _Wostream) = 0;
|
||||
|
||||
bool labelPosEnabled_;
|
||||
_oox_chart_values values_[5]; //cat(labels), common, x, y, bubble,
|
||||
_oox_chart_values values_[5]; //cat, common, x, y, bubble,
|
||||
|
||||
_oox_strRef label_; //tx (Series Text) §21.2.2.215
|
||||
int id_;
|
||||
std::wstring name_; //tx (Series Text) §21.2.2.215
|
||||
std::wstring name_;
|
||||
int iSymbolMarkerType_;
|
||||
bool bLocalTable_;
|
||||
_CP_OPT(oox_data_labels) data_labels_;
|
||||
|
||||
void setName(std::wstring &value);
|
||||
void setName(const std::wstring &value);
|
||||
|
||||
void setFormula (int ind, std::wstring & value, std::wstring & formatCode, bool link_to_source);
|
||||
void setFormula (int ind, const std::wstring & value, const std::wstring & formatCode, bool link_to_source);
|
||||
void setValues (int ind, std::vector<std::wstring> & values);
|
||||
void setLabels (const std::wstring &formula, std::vector<std::wstring> & values);
|
||||
void parse_properties();
|
||||
|
||||
void set_cache_only (bool val);
|
||||
|
||||
@ -55,21 +55,21 @@ struct _oox_numLit
|
||||
|
||||
struct _oox_strRef
|
||||
{
|
||||
bool present;
|
||||
bool present = false;
|
||||
|
||||
std::wstring formula;
|
||||
int str_cache_count;
|
||||
int str_cache_count = 0;
|
||||
std::vector<std::wstring> str_cache;
|
||||
|
||||
};
|
||||
struct _oox_numRef
|
||||
{
|
||||
bool present;
|
||||
bool present = false;
|
||||
|
||||
std::wstring formula;
|
||||
std::wstring formatCode;
|
||||
bool link_to_source;
|
||||
int num_cache_count;
|
||||
bool link_to_source = false;
|
||||
int num_cache_count = 0;
|
||||
std::vector<std::wstring> num_cache;
|
||||
|
||||
};
|
||||
|
||||
@ -131,7 +131,16 @@ static const std::wstring _ooxDashStyle[]=
|
||||
L"dashDot",
|
||||
L"sysDashDotDot"
|
||||
};
|
||||
|
||||
static const std::wstring _vmlDashStyle[]=
|
||||
{
|
||||
L"none",
|
||||
L"solid",
|
||||
L"dot",
|
||||
L"dash",
|
||||
L"dash",
|
||||
L"dashdot",
|
||||
L"shortdashdotdot"
|
||||
};
|
||||
void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_property> & prop, bool always_draw, const std::wstring &ns)
|
||||
{
|
||||
std::wstring ns_att = (ns == L"a" ? L"" : ns + L":");
|
||||
@ -152,7 +161,7 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
|
||||
odf_reader::GetProperty(prop, L"stroke" , iStroke);
|
||||
odf_reader::GetProperty(prop, L"stroke-width" , dStrokeWidth);
|
||||
odf_reader::GetProperty(prop, L"stroke-opacity" , dStrokeOpacity);
|
||||
|
||||
|
||||
if ((!strStrokeColor && !iStroke && !dStrokeWidth) && !always_draw)return;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
@ -224,6 +233,69 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
|
||||
}
|
||||
}
|
||||
}
|
||||
void vml_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_property> & prop)
|
||||
{
|
||||
_CP_OPT(std::wstring) strStrokeColor;
|
||||
_CP_OPT(int) iStroke;
|
||||
_CP_OPT(double) dStrokeWidth;
|
||||
_CP_OPT(double) dStrokeOpacity;
|
||||
_CP_OPT(bool) bWordArt;
|
||||
|
||||
odf_reader::GetProperty(prop, L"wordArt", bWordArt);
|
||||
|
||||
odf_reader::GetProperty(prop, L"stroke-color" , strStrokeColor);
|
||||
odf_reader::GetProperty(prop, L"stroke" , iStroke);
|
||||
odf_reader::GetProperty(prop, L"stroke-width" , dStrokeWidth);
|
||||
odf_reader::GetProperty(prop, L"stroke-opacity" , dStrokeOpacity);
|
||||
|
||||
if (!strStrokeColor && !iStroke && !dStrokeWidth) return;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"v:stroke")
|
||||
{
|
||||
std::wstring color, dash_style ;
|
||||
|
||||
if (strStrokeColor) color = *strStrokeColor;
|
||||
|
||||
if (iStroke)
|
||||
{
|
||||
if (iStroke.get() != 0 ) dash_style = _vmlDashStyle[iStroke.get()];
|
||||
}
|
||||
|
||||
if ((dStrokeWidth) && (*dStrokeWidth >= 0))
|
||||
{
|
||||
int val = dStrokeWidth.get() * 12700; //in emu (1 pt = 12700)
|
||||
if (val < 10) val = 12700;
|
||||
|
||||
CP_XML_ATTR(L"weight", val);
|
||||
}
|
||||
|
||||
if (false == color.empty())
|
||||
{
|
||||
CP_XML_ATTR(L"color", L"#" + color);
|
||||
}
|
||||
if (!dash_style.empty() && dash_style != L"solid")
|
||||
{
|
||||
CP_XML_ATTR(L"dashstyle", dash_style);
|
||||
}
|
||||
//odf_reader::GetProperty(prop,L"marker-start", strVal);
|
||||
//if (strVal)
|
||||
//{
|
||||
//}
|
||||
//odf_reader::GetProperty(prop,L"marker-end",strVal);
|
||||
//if (strVal)
|
||||
//{
|
||||
//}
|
||||
|
||||
CP_XML_ATTR(L"startarrow", L"block");
|
||||
CP_XML_ATTR(L"startarrowwidth", L"medium");
|
||||
CP_XML_ATTR(L"startarrowlength", L"medium");
|
||||
CP_XML_ATTR(L"joinstyle", L"round");
|
||||
CP_XML_ATTR(L"endcap", L"flat");
|
||||
}
|
||||
}
|
||||
}
|
||||
void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_property> & prop, const std::wstring & shapeGeomPreset, const std::wstring &ns)
|
||||
{
|
||||
std::wstring ns_att = (ns == L"a" ? L"" : ns + L":");
|
||||
@ -375,7 +447,7 @@ void _oox_drawing::serialize_bodyPr(std::wostream & strm, const std::wstring & n
|
||||
{
|
||||
CP_XML_NODE(L"a:spAutoFit");
|
||||
}
|
||||
if ((bFitToSize) && (*bFitToSize))
|
||||
else if ((bFitToSize) && (*bFitToSize))
|
||||
{
|
||||
CP_XML_NODE(L"a:normAutofit");
|
||||
//{
|
||||
|
||||
@ -124,6 +124,7 @@ namespace oox {
|
||||
void oox_serialize_aLst (std::wostream & strm, const std::vector<odf_reader::_property> & val, const std::wstring & shapeGeomPreset, const std::wstring &ns = L"a");
|
||||
void oox_serialize_action (std::wostream & strm, const _action_desc & val);
|
||||
|
||||
void vml_serialize_ln (std::wostream & strm, const std::vector<odf_reader::_property> & val);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -245,7 +245,7 @@ void vml_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val)
|
||||
{
|
||||
if (!val.gradient->colors.empty())
|
||||
{
|
||||
CP_XML_ATTR(L"color2", val.gradient->colors[val.gradient->colors.size() - 1].color_ref);
|
||||
CP_XML_ATTR(L"color2", L"#" + val.gradient->colors[val.gradient->colors.size() - 1].color_ref);
|
||||
|
||||
std::wstring colors_value;
|
||||
for (size_t i = 0; i < val.gradient->colors.size(); i++)
|
||||
@ -404,6 +404,27 @@ void vml_serialize_background (std::wostream & strm, const _oox_fill & val, cons
|
||||
}
|
||||
}
|
||||
|
||||
void vml_serialize_fill (std::wostream & strm, const _oox_fill & val)
|
||||
{
|
||||
switch (val.type)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
vml_serialize_solid_fill(strm, val);
|
||||
break;
|
||||
case 2:
|
||||
vml_serialize_bitmap_fill(strm, val);
|
||||
break;
|
||||
case 3:
|
||||
vml_serialize_gradient_fill(strm, val);
|
||||
break;
|
||||
case 4:
|
||||
//vml_serialize_hatch_fill(strm, val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void oox_serialize_fill (std::wostream & strm, const _oox_fill & val, const std::wstring &ns)
|
||||
{
|
||||
switch (val.type)
|
||||
|
||||
@ -154,5 +154,6 @@ namespace oox {
|
||||
void oox_serialize_bitmap_fill (std::wostream & strm, const _oox_fill & val, const std::wstring &ns = L"a");
|
||||
|
||||
void oox_serialize_fill (std::wostream & strm, const _oox_fill & val, const std::wstring &ns = L"a");
|
||||
void vml_serialize_fill (std::wostream & strm, const _oox_fill & val);
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,6 +75,7 @@ static std::wstring get_mime_type(const std::wstring & extension)
|
||||
else if (L"tiff" == extension) return L"image/x-tiff";
|
||||
else if (L"pdf" == extension) return L"application/pdf";
|
||||
else if (L"bmp" == extension) return L"image/bmp";
|
||||
else if (L"wdp" == extension) return L"image/vnd.ms-photo";
|
||||
|
||||
else if (L"wav" == extension) return L"audio/wav";
|
||||
else if (L"mp3" == extension) return L"audio/mpeg";
|
||||
@ -172,6 +173,26 @@ bool content_types_file::add_or_find_override(const std::wstring & fileName)
|
||||
|
||||
return true;
|
||||
}
|
||||
void content_types_file::set_media(mediaitems_ptr & _Mediaitems)
|
||||
{
|
||||
std::vector<mediaitems::item> & items_ = _Mediaitems->items();
|
||||
for (size_t i = 0; i < items_.size(); i++)
|
||||
{
|
||||
if ((items_[i].type == typeImage ||
|
||||
items_[i].type == typeMedia ||
|
||||
items_[i].type == typeVideo ||
|
||||
items_[i].type == typeAudio) && items_[i].mediaInternal)
|
||||
{
|
||||
int n = items_[i].outputName.rfind(L".");
|
||||
if (n > 0)
|
||||
{
|
||||
add_or_find_default(items_[i].outputName.substr(n + 1, items_[i].outputName.length() - n));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void content_types_file::set_media(mediaitems & _Mediaitems)
|
||||
{
|
||||
@ -348,7 +369,7 @@ void docProps_files::write(const std::wstring & RootPath)
|
||||
////////////
|
||||
|
||||
|
||||
media::media(mediaitems & _Mediaitems, NSFonts::IApplicationFonts *pAppFonts) : mediaitems_(_Mediaitems), appFonts_(pAppFonts)
|
||||
media::media(mediaitems_ptr & _mediaitems, NSFonts::IApplicationFonts *pAppFonts) : mediaItems_(_mediaitems), appFonts_(pAppFonts)
|
||||
{
|
||||
}
|
||||
|
||||
@ -357,7 +378,8 @@ void media::write(const std::wstring & RootPath)
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"media";
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
mediaitems::items_array & items = mediaitems_.items();
|
||||
mediaitems::items_array & items = mediaItems_->items();
|
||||
|
||||
for (size_t i = 0; i < items.size(); i++ )
|
||||
{
|
||||
if (items[i].mediaInternal && items[i].valid && ( items[i].type == typeImage ||
|
||||
@ -380,7 +402,7 @@ void media::write(const std::wstring & RootPath)
|
||||
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
charts::charts(mediaitems & _ChartsItems) : chartsitems_(_ChartsItems)
|
||||
charts::charts(mediaitems_ptr & _chartsItems) : chartsItems_(_chartsItems)
|
||||
{
|
||||
}
|
||||
|
||||
@ -389,7 +411,7 @@ void charts::write(const std::wstring & RootPath)
|
||||
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
embeddings::embeddings(mediaitems & _EmbeddingsItems) : embeddingsitems_(_EmbeddingsItems)
|
||||
embeddings::embeddings(mediaitems_ptr & _EmbeddingsItems) : embeddingsItems_(_EmbeddingsItems)
|
||||
{
|
||||
}
|
||||
void embeddings::write(const std::wstring & RootPath)
|
||||
@ -399,7 +421,8 @@ void embeddings::write(const std::wstring & RootPath)
|
||||
|
||||
content_types_file & content_types = get_main_document()->get_content_types_file();
|
||||
|
||||
mediaitems::items_array & items = embeddingsitems_.items();
|
||||
mediaitems::items_array & items = embeddingsItems_->items();
|
||||
|
||||
for (size_t i = 0; i < items.size(); i++ )
|
||||
{
|
||||
if ( items[i].mediaInternal && items[i].valid &&
|
||||
|
||||
@ -51,6 +51,7 @@ namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
class mediaitems;
|
||||
typedef _CP_PTR(mediaitems) mediaitems_ptr;
|
||||
|
||||
namespace package {
|
||||
|
||||
@ -81,16 +82,17 @@ inline element::~element()
|
||||
class content_types_file : public element
|
||||
{
|
||||
public:
|
||||
content_types_file ();
|
||||
void write (const std::wstring & RootPath);
|
||||
bool add_or_find_default (const std::wstring & extension);
|
||||
bool add_or_find_override(const std::wstring & fileName);
|
||||
void set_media (mediaitems & _Mediaitems);
|
||||
content_type * content ();
|
||||
content_types_file ();
|
||||
void write (const std::wstring & RootPath);
|
||||
bool add_or_find_default (const std::wstring & extension);
|
||||
bool add_or_find_override(const std::wstring & fileName);
|
||||
void set_media (mediaitems & _Mediaitems);
|
||||
void set_media (mediaitems_ptr & _Mediaitems);
|
||||
content_type* content ();
|
||||
|
||||
private:
|
||||
content_type content_type_content_;
|
||||
std::wstring filename_;
|
||||
std::wstring filename_;
|
||||
};
|
||||
|
||||
class simple_element;
|
||||
@ -189,8 +191,8 @@ public:
|
||||
std::wstring str() { return content_.str(); }
|
||||
static _CP_PTR(chart_content) create();
|
||||
private:
|
||||
std::wstringstream content_;
|
||||
rels_file_ptr rels_;
|
||||
std::wstringstream content_;
|
||||
rels_file_ptr rels_;
|
||||
};
|
||||
//------------------------------------------------------------------------
|
||||
class document : public element
|
||||
@ -228,39 +230,39 @@ private:
|
||||
class media : public element
|
||||
{
|
||||
public:
|
||||
media(mediaitems & _Mediaitems, NSFonts::IApplicationFonts *pAppFonts);
|
||||
media(mediaitems_ptr & _mediaItems, NSFonts::IApplicationFonts *pAppFonts);
|
||||
|
||||
public:
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
private:
|
||||
mediaitems & mediaitems_;
|
||||
NSFonts::IApplicationFonts * appFonts_;
|
||||
mediaitems_ptr mediaItems_;
|
||||
NSFonts::IApplicationFonts* appFonts_;
|
||||
|
||||
};
|
||||
|
||||
class charts : public element
|
||||
{
|
||||
public:
|
||||
charts(mediaitems & _ChartsItems);
|
||||
charts(mediaitems_ptr & _chartsItems);
|
||||
|
||||
public:
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
private:
|
||||
mediaitems & chartsitems_;
|
||||
mediaitems_ptr chartsItems_;
|
||||
|
||||
};
|
||||
class embeddings : public element
|
||||
{
|
||||
public:
|
||||
embeddings(mediaitems & _EmbeddingsItems);
|
||||
embeddings(mediaitems_ptr & _embeddingsItems);
|
||||
|
||||
public:
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
private:
|
||||
mediaitems & embeddingsitems_;
|
||||
mediaitems_ptr embeddingsItems_;
|
||||
|
||||
};
|
||||
} // namespace package
|
||||
|
||||
@ -43,6 +43,7 @@ namespace oox {
|
||||
enum RelsType
|
||||
{
|
||||
typeUnknown = 0,
|
||||
typeDefault,
|
||||
typeImage,
|
||||
typeChart,
|
||||
typeShape,
|
||||
@ -59,7 +60,8 @@ enum RelsType
|
||||
typeExternalLink,
|
||||
typeActiveX,
|
||||
typeControl,
|
||||
typeControlProps
|
||||
typeControlProps,
|
||||
typeChartUserShapes
|
||||
};
|
||||
|
||||
struct _rel
|
||||
@ -71,10 +73,10 @@ struct _rel
|
||||
type(type_)
|
||||
{}
|
||||
|
||||
bool is_internal;
|
||||
std::wstring rid;
|
||||
std::wstring ref;
|
||||
RelsType type;
|
||||
bool is_internal;
|
||||
std::wstring rid;
|
||||
std::wstring ref;
|
||||
RelsType type;
|
||||
};
|
||||
|
||||
class relationship : public xml::element_impl<relationship>
|
||||
|
||||
@ -46,13 +46,13 @@ void oox_chart::set_cache_only (bool val)
|
||||
|
||||
}
|
||||
|
||||
void oox_chart::set_formula_series(int ind, std::wstring val, std::wstring formatCode, bool link_to_source)
|
||||
void oox_chart::set_formula_series(int ind, const std::wstring& val, const std::wstring& formatCode, bool link_to_source)
|
||||
{
|
||||
oox_series_ptr & current_ptr = series_.back();
|
||||
current_ptr->setFormula(ind, val, formatCode, link_to_source);
|
||||
|
||||
}
|
||||
void oox_chart::set_name(std::wstring val)
|
||||
void oox_chart::set_name(const std::wstring& val)
|
||||
{
|
||||
oox_series_ptr & current_ptr = series_.back();
|
||||
current_ptr->setName(val);
|
||||
@ -68,6 +68,13 @@ void oox_chart::set_values_series(int ind, std::vector<std::wstring> & val)
|
||||
oox_series_ptr & current_ptr = series_.back();
|
||||
current_ptr->setValues (ind, val);
|
||||
}
|
||||
void oox_chart::set_label_series(const std::wstring& formula, std::vector<std::wstring> & cash)
|
||||
{
|
||||
if (formula.empty() && cash.empty()) return;
|
||||
|
||||
oox_series_ptr & current_ptr = series_.back();
|
||||
current_ptr->setLabels (formula, cash);
|
||||
}
|
||||
void oox_chart::set_properties(std::vector<odf_reader::_property> g)
|
||||
{
|
||||
_CP_OPT(int) iVal;
|
||||
|
||||
@ -78,9 +78,10 @@ public:
|
||||
virtual void add_series(int id){}
|
||||
|
||||
void set_cache_only (bool val);
|
||||
void set_formula_series (int ind, std::wstring val, std::wstring formatCode, bool link_to_source);
|
||||
void set_formula_series (int ind, const std::wstring& val, const std::wstring& formatCode, bool link_to_source);
|
||||
void set_values_series (int ind, std::vector<std::wstring> & val);
|
||||
void set_name (std::wstring val);
|
||||
void set_label_series (const std::wstring& formula, std::vector<std::wstring> & val);
|
||||
void set_name (const std::wstring& val);
|
||||
void set_content_series (odf_reader::chart::series & content);
|
||||
|
||||
//void set_showBubbleSize(bool Val){data_labels_.set_showBubbleSize(Val);}
|
||||
|
||||
@ -51,7 +51,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::pair<std::wstring, std::wstring> add_comments_xml(std::wstring const & content,pptx_comments_ptr comments)
|
||||
std::pair<std::wstring, std::wstring> add_comments_xml(std::wstring const & content, pptx_comments_ptr comments)
|
||||
{
|
||||
const std::wstring file_id = std::to_wstring(next_file_id_++);
|
||||
|
||||
|
||||
@ -83,7 +83,7 @@ void pptx_conversion_context::set_output_document(package::pptx_document * docum
|
||||
|
||||
void pptx_conversion_context::set_font_directory(std::wstring pathFonts)
|
||||
{
|
||||
pptx_slide_context_.get_mediaitems().set_font_directory(pathFonts);
|
||||
pptx_slide_context_.get_mediaitems()->set_font_directory(pathFonts);
|
||||
}
|
||||
|
||||
void pptx_conversion_context::process_layouts()
|
||||
|
||||
@ -133,7 +133,7 @@ public:
|
||||
|
||||
pptx_table_context & get_table_context() { return pptx_table_context_; }
|
||||
|
||||
mediaitems & get_mediaitems() { return pptx_slide_context_.get_mediaitems(); }
|
||||
mediaitems_ptr & get_mediaitems() { return pptx_slide_context_.get_mediaitems(); }
|
||||
|
||||
//void start_hyperlink(const std::wstring & styleName);
|
||||
//void end_hyperlink(std::wstring const & href);
|
||||
|
||||
@ -509,15 +509,15 @@ void ppt_files::add_notesMaster(slide_content_ptr slide)
|
||||
{
|
||||
notesMaster_files_.add_slide(slide);
|
||||
}
|
||||
void ppt_files::set_media(mediaitems & _Mediaitems)
|
||||
void ppt_files::set_media(mediaitems_ptr & _mediaitems)
|
||||
{
|
||||
if (_Mediaitems.count_image + _Mediaitems.count_media > 0)
|
||||
if (_mediaitems->count_image + _mediaitems->count_media > 0)
|
||||
{
|
||||
media_ = element_ptr( new media(_Mediaitems, _Mediaitems.applicationFonts()) );
|
||||
media_ = element_ptr( new media(_mediaitems, _mediaitems->applicationFonts()) );
|
||||
}
|
||||
if (_Mediaitems.count_object > 0)
|
||||
if (_mediaitems->count_object > 0)
|
||||
{
|
||||
embeddings_ = element_ptr( new embeddings(_Mediaitems) );
|
||||
embeddings_ = element_ptr( new embeddings(_mediaitems) );
|
||||
}
|
||||
}
|
||||
void ppt_files::set_authors_comments(pptx_xml_authors_comments_ptr & authors_comments)
|
||||
|
||||
@ -217,7 +217,7 @@ public:
|
||||
void add_notes (slide_content_ptr sheet);
|
||||
void add_notesMaster(slide_content_ptr sheet);
|
||||
|
||||
void set_media(mediaitems & _Mediaitems);
|
||||
void set_media(mediaitems_ptr & _mediaitems);
|
||||
void add_charts(chart_content_ptr chart);
|
||||
void add_theme (pptx_xml_theme_ptr theme);
|
||||
|
||||
|
||||
@ -65,8 +65,10 @@ public:
|
||||
bool onClick;
|
||||
};
|
||||
|
||||
Impl(const std::wstring & odfPacket) : mediaitems_(odfPacket), odfPacket_(odfPacket)
|
||||
Impl(const std::wstring & _odfPacket) : odfPacket_(_odfPacket)
|
||||
{
|
||||
mediaitems_ = boost::make_shared<mediaitems>(odfPacket_);
|
||||
|
||||
clear();
|
||||
}
|
||||
|
||||
@ -88,7 +90,7 @@ public:
|
||||
{
|
||||
pptx_drawings_->add(isInternal, rid, ref, type);
|
||||
}
|
||||
mediaitems & get_mediaitems() { return mediaitems_; }
|
||||
mediaitems_ptr & get_mediaitems() { return mediaitems_; }
|
||||
|
||||
bool empty() const
|
||||
{
|
||||
@ -138,7 +140,7 @@ private:
|
||||
void process_media (drawing_object_description& obj, _pptx_drawing & drawing);
|
||||
|
||||
size_t rId_;
|
||||
mediaitems mediaitems_;
|
||||
mediaitems_ptr mediaitems_;
|
||||
pptx_drawings_ptr pptx_drawings_;
|
||||
pptx_drawings_ptr pptx_notes_drawings_;
|
||||
};
|
||||
@ -357,7 +359,7 @@ void pptx_slide_context::add_background(_oox_fill & fill)
|
||||
bool isMediaInternal = false;
|
||||
std::wstring ref;
|
||||
|
||||
fill.bitmap->rId = get_mediaitems().add_or_find(fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
|
||||
fill.bitmap->rId = get_mediaitems()->add_or_find(fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
|
||||
add_rels(isMediaInternal, fill.bitmap->rId, ref, typeImage);
|
||||
}
|
||||
impl_->background_fill_ = fill;
|
||||
@ -421,7 +423,7 @@ void pptx_slide_context::set_link(std::wstring link, RelsType typeRels)
|
||||
{
|
||||
bool isMediaInternal = true;
|
||||
|
||||
impl_->object_description_.action_.hSoundId = get_mediaitems().add_or_find(link, typeAudio, isMediaInternal, impl_->object_description_.action_.hSoundRef);
|
||||
impl_->object_description_.action_.hSoundId = get_mediaitems()->add_or_find(link, typeAudio, isMediaInternal, impl_->object_description_.action_.hSoundRef);
|
||||
impl_->add_additional_rels(isMediaInternal, impl_->object_description_.action_.hSoundId, impl_->object_description_.action_.hSoundRef, typeAudio);
|
||||
}
|
||||
else
|
||||
@ -493,6 +495,10 @@ void pptx_slide_context::set_image(const std::wstring & path)
|
||||
impl_->object_description_.type_ = typeImage;
|
||||
impl_->object_description_.xlink_href_ = path;
|
||||
}
|
||||
else if (impl_->object_description_.type_ == typeImage && impl_->object_description_.xlink_href_.rfind(L".svg") != std::wstring::npos)
|
||||
{
|
||||
impl_->object_description_.xlink_href_ = path;
|
||||
}
|
||||
else if (impl_->use_image_replacement_)
|
||||
{
|
||||
impl_->object_description_.fill_.type = 2;
|
||||
@ -562,7 +568,7 @@ void pptx_slide_context::Impl::process_image(drawing_object_description& obj, _p
|
||||
}
|
||||
|
||||
std::wstring fileName = odfPacket_ + FILE_SEPARATOR_STR + obj.xlink_href_;
|
||||
drawing.fill.bitmap->bCrop = odf_reader::parse_clipping(obj.clipping_string_, fileName, drawing.fill.bitmap->cropRect, get_mediaitems().applicationFonts());
|
||||
drawing.fill.bitmap->bCrop = odf_reader::parse_clipping(obj.clipping_string_, fileName, drawing.fill.bitmap->cropRect, get_mediaitems()->applicationFonts());
|
||||
drawing.fill.bitmap->bStretch = true;
|
||||
|
||||
if ((sColorMode) && (*sColorMode == L"greyscale"))
|
||||
@ -572,7 +578,7 @@ void pptx_slide_context::Impl::process_image(drawing_object_description& obj, _p
|
||||
std::wstring ref;/// это ссылка на выходной внешний объект
|
||||
bool isMediaInternal = false;
|
||||
|
||||
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref);
|
||||
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref);
|
||||
drawing.fill.bitmap->isInternal = isMediaInternal;
|
||||
|
||||
if (drawing.type == typeShape)
|
||||
@ -580,7 +586,7 @@ void pptx_slide_context::Impl::process_image(drawing_object_description& obj, _p
|
||||
add_additional_rels(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);//собственно это не объект, а доп рел и ref объекта
|
||||
|
||||
isMediaInternal = true;
|
||||
std::wstring rId = get_mediaitems().add_or_find(L"", typeShape, isMediaInternal, ref);
|
||||
std::wstring rId = get_mediaitems()->add_or_find(L"", typeShape, isMediaInternal, ref);
|
||||
|
||||
add_drawing(drawing, isMediaInternal, rId, ref, typeShape);//объект
|
||||
|
||||
@ -595,7 +601,7 @@ void pptx_slide_context::Impl::process_chart(drawing_object_description & obj, _
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
|
||||
drawing.objectId = get_mediaitems().add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
drawing.objectId = get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
|
||||
add_drawing(drawing, isMediaInternal, drawing.objectId, ref, drawing.type);
|
||||
}
|
||||
@ -604,7 +610,7 @@ void pptx_slide_context::Impl::process_table(drawing_object_description & obj, _
|
||||
{
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
std::wstring rId = get_mediaitems().add_or_find(L"", obj.type_, isMediaInternal, ref);
|
||||
std::wstring rId = get_mediaitems()->add_or_find(L"", obj.type_, isMediaInternal, ref);
|
||||
|
||||
add_drawing(drawing, isMediaInternal, rId, ref, drawing.type);
|
||||
|
||||
@ -619,12 +625,12 @@ void pptx_slide_context::Impl::process_shape(drawing_object_description & obj, _
|
||||
|
||||
if (drawing.fill.bitmap)
|
||||
{
|
||||
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
|
||||
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
|
||||
|
||||
add_additional_rels(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);
|
||||
}
|
||||
|
||||
std::wstring rId = get_mediaitems().add_or_find(L"", typeShape, isMediaInternal, ref);
|
||||
std::wstring rId = get_mediaitems()->add_or_find(L"", typeShape, isMediaInternal, ref);
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
_CP_OPT(std::wstring) sPlaceHolderType;
|
||||
@ -647,7 +653,7 @@ void pptx_slide_context::Impl::process_object(drawing_object_description& obj, _
|
||||
std::wstring ref, ref_image;
|
||||
bool isMediaInternal = true, isMediaInternal_image = true;
|
||||
|
||||
drawing.objectId = get_mediaitems().add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
drawing.objectId = get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
drawing.objectProgId = obj.descriptor_;
|
||||
|
||||
if (!drawing.fill.bitmap)
|
||||
@ -658,7 +664,7 @@ void pptx_slide_context::Impl::process_object(drawing_object_description& obj, _
|
||||
_image_file_::GenerateZeroImage(odfPacket_ + FILE_SEPARATOR_STR + L"zero.png");
|
||||
}
|
||||
|
||||
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal_image, ref_image);
|
||||
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal_image, ref_image);
|
||||
add_additional_rels(isMediaInternal_image, drawing.fill.bitmap->rId, ref_image, typeImage);
|
||||
|
||||
add_drawing(drawing, isMediaInternal, drawing.objectId, ref, drawing.type);
|
||||
@ -670,7 +676,7 @@ void pptx_slide_context::Impl::process_media(drawing_object_description& obj, _p
|
||||
|
||||
drawing.type = mediaitems::detectMediaType(obj.xlink_href_); //reset from Media to Audio, Video, ... QuickTime? AudioCD? ...
|
||||
|
||||
drawing.objectId = get_mediaitems().add_or_find(obj.xlink_href_, drawing.type, isMediaInternal, ref);
|
||||
drawing.objectId = get_mediaitems()->add_or_find(obj.xlink_href_, drawing.type, isMediaInternal, ref);
|
||||
drawing.extId = L"ext" + drawing.objectId;
|
||||
drawing.extExternal = !isMediaInternal;
|
||||
|
||||
@ -681,7 +687,7 @@ void pptx_slide_context::Impl::process_media(drawing_object_description& obj, _p
|
||||
|
||||
_image_file_::GenerateZeroImage(odfPacket_ + FILE_SEPARATOR_STR + L"zero.png");
|
||||
}
|
||||
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal_image, ref_image);
|
||||
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal_image, ref_image);
|
||||
add_additional_rels(isMediaInternal_image, drawing.fill.bitmap->rId, ref_image, typeImage);
|
||||
|
||||
add_drawing(drawing, false, drawing.objectId, L"NULL", drawing.type);
|
||||
@ -714,7 +720,7 @@ void pptx_slide_context::dump_rels(rels & Rels)
|
||||
impl_->get_drawings()->dump_rels(Rels);
|
||||
}
|
||||
|
||||
mediaitems & pptx_slide_context::get_mediaitems()
|
||||
mediaitems_ptr & pptx_slide_context::get_mediaitems()
|
||||
{
|
||||
return impl_->get_mediaitems();
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ public:
|
||||
|
||||
void process_drawings();
|
||||
|
||||
mediaitems & get_mediaitems();
|
||||
mediaitems_ptr & get_mediaitems();
|
||||
|
||||
void add_background (_oox_fill & fill);
|
||||
|
||||
|
||||
@ -390,7 +390,7 @@ void oox_serialize_tcPr(std::wostream & strm, std::vector<const odf_reader::styl
|
||||
{
|
||||
bool isMediaInternal = true;
|
||||
std::wstring ref;
|
||||
fill.bitmap->rId = Context.get_slide_context().get_mediaitems().add_or_find(fill.bitmap->xlink_href_, oox::typeImage, isMediaInternal, ref);
|
||||
fill.bitmap->rId = Context.get_slide_context().get_mediaitems()->add_or_find(fill.bitmap->xlink_href_, oox::typeImage, isMediaInternal, ref);
|
||||
Context.get_slide_context().add_rels(isMediaInternal, fill.bitmap->rId, ref, oox::typeImage);
|
||||
}
|
||||
oox::oox_serialize_fill(CP_XML_STREAM(), fill);
|
||||
|
||||
@ -39,14 +39,14 @@
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
unsigned int hex_string_to_int(std::wstring str)
|
||||
{
|
||||
unsigned int x;
|
||||
std::wstringstream ss;
|
||||
ss << std::hex << str;
|
||||
ss >> x;
|
||||
return x;
|
||||
}
|
||||
unsigned int hex_string_to_int(std::wstring str)
|
||||
{
|
||||
unsigned int x;
|
||||
std::wstringstream ss;
|
||||
ss << std::hex << str;
|
||||
ss >> x;
|
||||
return x;
|
||||
}
|
||||
|
||||
class xlsx_comments::Impl
|
||||
{
|
||||
@ -82,6 +82,7 @@ public:
|
||||
{
|
||||
CP_XML_ATTR(L"ref", c.ref_);
|
||||
CP_XML_ATTR(L"authorId", c.author_);
|
||||
CP_XML_ATTR(L"shapeId", 0);
|
||||
|
||||
CP_XML_NODE(L"text")
|
||||
{
|
||||
@ -94,127 +95,6 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
void serialize_vml(std::wostream & strm) const
|
||||
{
|
||||
_CP_OPT(std::wstring) strVal;
|
||||
_CP_OPT(double) dVal;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"xml")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:v", L"urn:schemas-microsoft-com:vml");
|
||||
CP_XML_ATTR(L"xmlns:o", L"urn:schemas-microsoft-com:office:office");
|
||||
CP_XML_ATTR(L"xmlns:x", L"urn:schemas-microsoft-com:office:excel");
|
||||
|
||||
for (size_t i = 0; i < xlsx_comment_.size(); i++)
|
||||
{
|
||||
const _xlsx_comment & c = xlsx_comment_[i];
|
||||
|
||||
std::wstring str_fill_color_ = L"00003f";
|
||||
if (odf_reader::GetProperty(c.graphicProperties_,L"fill-color",strVal))
|
||||
str_fill_color_ = strVal.get();
|
||||
|
||||
CP_XML_NODE(L"v:shapetype")
|
||||
{
|
||||
CP_XML_ATTR(L"id", L"shapetype_202");
|
||||
CP_XML_ATTR(L"coordsize", L"21600,21600");
|
||||
CP_XML_ATTR(L"o:spt", L"202");
|
||||
CP_XML_ATTR(L"path", L"m,l,21600l21600,21600l21600,xe");
|
||||
|
||||
CP_XML_NODE(L"v:stroke")
|
||||
{
|
||||
CP_XML_ATTR(L"joinstyle", L"miter");
|
||||
}
|
||||
CP_XML_NODE(L"v:path")
|
||||
{
|
||||
CP_XML_ATTR(L"gradientshapeok", L"t");
|
||||
CP_XML_ATTR(L"o:connecttype", L"rect");
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"v:shape")
|
||||
{
|
||||
if( hex_string_to_int(str_fill_color_) !=0 )
|
||||
{
|
||||
CP_XML_ATTR(L"fillcolor", std::wstring(L"#") + str_fill_color_);
|
||||
}//иначе это полная прозрачность
|
||||
|
||||
CP_XML_ATTR(L"id", L"shape_0");
|
||||
|
||||
std::wstring style = std::wstring(L"position:absolute;");
|
||||
|
||||
style += std::wstring(L"margin-left:") + boost::lexical_cast<std::wstring>(c.left_) + std::wstring(L"pt;");
|
||||
style += std::wstring(L"margin-top:") + boost::lexical_cast<std::wstring>(c.top_) + std::wstring(L"pt;");
|
||||
style += std::wstring(L"width:") + boost::lexical_cast<std::wstring>(c.width_) + std::wstring(L"pt;");
|
||||
style += std::wstring(L"height:") + boost::lexical_cast<std::wstring>(c.height_) + std::wstring(L"pt;");
|
||||
|
||||
if (c.visibly_ == false)style += std::wstring(L"visibility:hidden;");
|
||||
|
||||
CP_XML_ATTR(L"style",style);
|
||||
CP_XML_ATTR(L"type", L"shapetype_202");
|
||||
//if (odf_reader::GetProperty(c.graphicProperties_,L"opacity",dVal))
|
||||
//{
|
||||
// CP_XML_ATTR(L"opacity", boost::lexical_cast<std::wstring>((int)(100.-dVal.get())) + L"%");
|
||||
//}
|
||||
//CP_XML_NODE(L"v:shadow")
|
||||
//{
|
||||
// CP_XML_ATTR(L"color", L"black");
|
||||
// CP_XML_ATTR(L"obscured", L"t");
|
||||
// CP_XML_ATTR(L"on", L"t");
|
||||
//}
|
||||
|
||||
CP_XML_NODE(L"v:wrap")
|
||||
{
|
||||
CP_XML_ATTR(L"v:type", L"none");
|
||||
}
|
||||
CP_XML_NODE(L"v:fill")
|
||||
{
|
||||
CP_XML_ATTR(L"detectmouseclick", L"t");
|
||||
if( hex_string_to_int(str_fill_color_) !=0 )
|
||||
{
|
||||
CP_XML_ATTR(L"color", std::wstring(L"#") + str_fill_color_);
|
||||
CP_XML_ATTR(L"color2", std::wstring(L"#") + str_fill_color_);
|
||||
CP_XML_ATTR(L"type", L"solid");
|
||||
}//иначе это полная прозрачность
|
||||
//if (odf_reader::GetProperty(c.graphicProperties_,L"opacity",dVal))
|
||||
//{
|
||||
// CP_XML_ATTR(L"opacity", (dVal.get())/100.);
|
||||
// //CP_XML_ATTR(L"opacity2",(dVal.get())/100.);
|
||||
//}
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"v:stroke")
|
||||
{
|
||||
if (odf_reader::GetProperty(c.graphicProperties_,L"stroke-color",strVal))
|
||||
CP_XML_ATTR(L"color", std::wstring(L"#") + strVal.get());
|
||||
else
|
||||
CP_XML_ATTR(L"color",L"#3465af"); //синенький
|
||||
|
||||
if (odf_reader::GetProperty(c.graphicProperties_,L"stroke-opacity",dVal))
|
||||
{
|
||||
CP_XML_ATTR(L"opacity",(100.-dVal.get())/100.);
|
||||
}
|
||||
CP_XML_ATTR(L"endcap", L"flat");
|
||||
CP_XML_ATTR(L"joinstyle", L"round");
|
||||
CP_XML_ATTR(L"startarrow", L"block");
|
||||
CP_XML_ATTR(L"v:startarrowwidth", L"medium");
|
||||
CP_XML_ATTR(L"startarrowlength", L"medium");
|
||||
}
|
||||
CP_XML_NODE(L"x:ClientData")
|
||||
{
|
||||
CP_XML_ATTR(L"ObjectType", L"Note");
|
||||
CP_XML_NODE(L"x:MoveWithCells"){}
|
||||
CP_XML_NODE(L"x:SizeWithCells"){}
|
||||
CP_XML_NODE(L"x:AutoFill"){CP_XML_CONTENT("False");}
|
||||
CP_XML_NODE(L"x:Row"){CP_XML_CONTENT(c.row_);}
|
||||
CP_XML_NODE(L"x:Column"){CP_XML_CONTENT(c.col_);}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
bool empty() const
|
||||
{
|
||||
return ( xlsx_comment_.empty());
|
||||
@ -264,11 +144,6 @@ void xlsx_serialize(std::wostream & _Wostream, xlsx_comments const & val)
|
||||
val.impl_->serialize(_Wostream);
|
||||
}
|
||||
|
||||
void xlsx_serialize_vml(std::wostream & _Wostream, xlsx_comments const & val)
|
||||
{
|
||||
val.impl_->serialize_vml(_Wostream);
|
||||
}
|
||||
|
||||
xlsx_comments_ptr xlsx_comments::create()
|
||||
{
|
||||
return boost::make_shared<xlsx_comments>();
|
||||
|
||||
@ -42,38 +42,24 @@ namespace oox {
|
||||
|
||||
struct _xlsx_comment
|
||||
{
|
||||
size_t left_, top_;
|
||||
size_t width_, height_;
|
||||
|
||||
std::wstring ref_;
|
||||
|
||||
int col_;
|
||||
int row_;
|
||||
|
||||
bool visibly_;
|
||||
|
||||
std::vector<odf_reader::_property> graphicProperties_;
|
||||
|
||||
std::wstring author_;
|
||||
std::wstring content_;
|
||||
};
|
||||
//class rels;
|
||||
|
||||
class xlsx_comments;
|
||||
typedef _CP_PTR(xlsx_comments) xlsx_comments_ptr;
|
||||
|
||||
struct comment_elm
|
||||
{
|
||||
comment_elm(std::wstring const & _filename, std::wstring const & _vml_filename, std::wstring const & _content, std::wstring const & _vml_content, xlsx_comments_ptr _comments)
|
||||
: filename(_filename), content(_content), comments(_comments),vml_filename(_vml_filename),vml_content(_vml_content)
|
||||
comment_elm(std::wstring const & _filename, std::wstring const & _content, xlsx_comments_ptr _comments)
|
||||
: filename(_filename), content(_content), comments(_comments)
|
||||
{}
|
||||
xlsx_comments_ptr comments;
|
||||
|
||||
std::wstring filename;
|
||||
std::wstring content;
|
||||
|
||||
std::wstring vml_filename;
|
||||
std::wstring vml_content;
|
||||
};
|
||||
|
||||
class xlsx_comments
|
||||
@ -87,10 +73,7 @@ public:
|
||||
void add(_xlsx_comment & d);
|
||||
bool empty() const;
|
||||
|
||||
friend void docx_serialize(std::wostream & _Wostream, xlsx_comments const & val);
|
||||
|
||||
friend void xlsx_serialize(std::wostream & _Wostream, xlsx_comments const & val);
|
||||
friend void xlsx_serialize_vml(std::wostream & _Wostream, xlsx_comments const & val);
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
|
||||
@ -36,7 +36,6 @@
|
||||
#include "../odf/datatypes/length.h"
|
||||
#include "xlsx_utils.h"
|
||||
|
||||
//#include <formulasconvert.h>
|
||||
|
||||
namespace cpdoccore { namespace oox {
|
||||
|
||||
@ -46,32 +45,22 @@ typedef _CP_PTR(xlsx_comments) xlsx_comments_ptr;
|
||||
class xlsx_comments_context_handle::Impl
|
||||
{
|
||||
public:
|
||||
Impl()
|
||||
: next_comments_id_(1) ,next_file_id_(1)
|
||||
Impl() : next_comments_id_(1), next_file_id_(1)
|
||||
{
|
||||
}
|
||||
|
||||
std::pair<std::wstring, std::wstring> add_comments_xml(std::wstring const & content, std::wstring const & vml_content,xlsx_comments_ptr comments)
|
||||
std::pair<std::wstring, std::wstring> add_comments_xml(std::wstring const & content, xlsx_comments_ptr comments)
|
||||
{
|
||||
const std::wstring file_id = std::to_wstring(next_file_id_++);
|
||||
|
||||
const std::wstring file_id = std::to_wstring(next_file_id_++);
|
||||
const std::wstring fileName = std::wstring(L"comments") + file_id + L".xml";
|
||||
const std::wstring vml_fileName = std::wstring(L"vmlDrawing") + file_id + L".vml";
|
||||
|
||||
comments_.push_back(comment_elm(fileName,vml_fileName, content, vml_content, comments));
|
||||
comments_.push_back(comment_elm(fileName, content, comments));
|
||||
|
||||
const std::wstring id = std::to_wstring(next_comments_id_++);
|
||||
const std::wstring rId = std::wstring(L"comId") + id;
|
||||
return std::pair<std::wstring, std::wstring>(fileName, rId);
|
||||
}
|
||||
|
||||
std::pair<std::wstring, std::wstring> get_vml_drawing_xml()
|
||||
{
|
||||
const std::wstring id = std::to_wstring(next_comments_id_++);
|
||||
const std::wstring rId = std::wstring(L"comId") + id;
|
||||
return std::pair<std::wstring, std::wstring>(comments_.back().vml_filename, rId);
|
||||
}
|
||||
|
||||
const std::vector<comment_elm> & content() const
|
||||
{
|
||||
return comments_;
|
||||
@ -89,25 +78,17 @@ xlsx_comments_context_handle::xlsx_comments_context_handle()
|
||||
: impl_(new xlsx_comments_context_handle::Impl())
|
||||
{
|
||||
}
|
||||
|
||||
xlsx_comments_context_handle::~xlsx_comments_context_handle()
|
||||
{
|
||||
}
|
||||
|
||||
std::pair<std::wstring, std::wstring> xlsx_comments_context_handle::add_comments_xml(std::wstring const & content, std::wstring const & vml_content,xlsx_comments_ptr comments)
|
||||
std::pair<std::wstring, std::wstring> xlsx_comments_context_handle::add_comments_xml(std::wstring const & content, xlsx_comments_ptr comments)
|
||||
{
|
||||
return impl_->add_comments_xml(content,vml_content, comments);
|
||||
return impl_->add_comments_xml(content, comments);
|
||||
}
|
||||
std::pair<std::wstring, std::wstring> xlsx_comments_context_handle::get_vml_drawing_xml()
|
||||
{
|
||||
return impl_->get_vml_drawing_xml();
|
||||
}
|
||||
|
||||
const std::vector<comment_elm> & xlsx_comments_context_handle::content() const
|
||||
{
|
||||
return impl_->content();
|
||||
}
|
||||
|
||||
class xlsx_comments_context::Impl
|
||||
{
|
||||
public:
|
||||
@ -127,10 +108,6 @@ public:
|
||||
{
|
||||
xlsx_serialize(strm, *xlsx_comments_);
|
||||
}
|
||||
void serialize_vml(std::wostream & strm)
|
||||
{
|
||||
xlsx_serialize_vml(strm, *xlsx_comments_);
|
||||
}
|
||||
bool empty() const
|
||||
{
|
||||
return xlsx_comments_->empty();
|
||||
@ -154,40 +131,20 @@ xlsx_comments_context::~xlsx_comments_context()
|
||||
{
|
||||
}
|
||||
|
||||
void xlsx_comments_context::start_comment (double width_pt, double height_pt, double x_pt, double y_pt)
|
||||
void xlsx_comments_context::start_comment(const std::wstring & ref)
|
||||
{
|
||||
impl_->current_.ref_ = L"";
|
||||
impl_->current_.width_ = width_pt;
|
||||
impl_->current_.height_ = height_pt;
|
||||
impl_->current_.left_ = x_pt;
|
||||
impl_->current_.top_ = y_pt;
|
||||
|
||||
impl_->current_.visibly_ = false;
|
||||
impl_->current_.ref_ = ref;
|
||||
}
|
||||
void xlsx_comments_context::add_content(std::wstring content)
|
||||
void xlsx_comments_context::add_content(const std::wstring & content)
|
||||
{
|
||||
impl_->current_.content_ = content;
|
||||
}
|
||||
void xlsx_comments_context::add_author(std::wstring author)
|
||||
void xlsx_comments_context::add_author(const std::wstring & author)
|
||||
{
|
||||
impl_->current_.author_ = author;
|
||||
}
|
||||
void xlsx_comments_context::set_visibly(bool Val)
|
||||
void xlsx_comments_context::end_comment()
|
||||
{
|
||||
impl_->current_.visibly_ = Val;
|
||||
}
|
||||
|
||||
std::vector<odf_reader::_property> & xlsx_comments_context::get_draw_properties()
|
||||
{
|
||||
return impl_->current_.graphicProperties_;
|
||||
|
||||
}
|
||||
void xlsx_comments_context::end_comment(std::wstring ref,int col, int row)
|
||||
{
|
||||
impl_->current_.ref_ = ref;
|
||||
impl_->current_.col_ = col;
|
||||
impl_->current_.row_ = row;
|
||||
|
||||
impl_->add_comment(impl_->current_);
|
||||
}
|
||||
|
||||
@ -200,11 +157,6 @@ void xlsx_comments_context::serialize(std::wostream & strm)
|
||||
{
|
||||
impl_->serialize(strm);
|
||||
}
|
||||
void xlsx_comments_context::serialize_vml(std::wostream & strm)
|
||||
{
|
||||
impl_->serialize_vml(strm);
|
||||
}
|
||||
|
||||
xlsx_comments_ptr xlsx_comments_context::get_comments()
|
||||
{
|
||||
return impl_->get_comments();
|
||||
|
||||
@ -45,16 +45,13 @@ class xlsx_table_metrics;
|
||||
class xlsx_comments;
|
||||
typedef _CP_PTR(xlsx_comments) xlsx_comments_ptr;
|
||||
|
||||
|
||||
|
||||
class xlsx_comments_context_handle
|
||||
{
|
||||
public:
|
||||
xlsx_comments_context_handle();
|
||||
~xlsx_comments_context_handle();
|
||||
|
||||
std::pair<std::wstring, std::wstring> add_comments_xml(std::wstring const & content, std::wstring const & vml_content,xlsx_comments_ptr comments);
|
||||
std::pair<std::wstring, std::wstring> get_vml_drawing_xml();
|
||||
std::pair<std::wstring, std::wstring> add_comments_xml(std::wstring const & content, xlsx_comments_ptr comments);
|
||||
const std::vector<comment_elm> & content() const;
|
||||
|
||||
friend class xlsx_comments_context;
|
||||
@ -72,21 +69,16 @@ public:
|
||||
xlsx_comments_context(xlsx_comments_context_handle & h);
|
||||
~xlsx_comments_context();
|
||||
|
||||
void start_comment(double width_pt, double height_pt, double x_pt, double y_pt);
|
||||
void start_comment(const std::wstring & ref);
|
||||
|
||||
void add_content(std::wstring content);
|
||||
void add_author(std::wstring author);
|
||||
void add_content(const std::wstring & content);
|
||||
void add_author(const std::wstring & author);
|
||||
|
||||
std::vector<odf_reader::_property> & get_draw_properties();
|
||||
|
||||
void set_visibly(bool Val);
|
||||
|
||||
void end_comment(std::wstring ref,int col,int row);
|
||||
void end_comment();
|
||||
|
||||
bool empty() const;
|
||||
|
||||
void serialize (std::wostream & strm);
|
||||
void serialize_vml (std::wostream & strm);
|
||||
void serialize (std::wostream & strm);
|
||||
xlsx_comments_ptr get_comments();
|
||||
|
||||
private:
|
||||
|
||||
@ -55,10 +55,17 @@ struct xlsx_dataValidation
|
||||
std::wstring formula1;
|
||||
std::wstring formula2;
|
||||
std::wstring operator_;
|
||||
|
||||
bool showErrorMessage = false;
|
||||
bool showInputMessage = false;
|
||||
bool showDropDown = false;
|
||||
bool allowBlank = false;
|
||||
|
||||
std::wstring error_text;
|
||||
std::wstring error_title;
|
||||
|
||||
std::wstring promt_text;
|
||||
std::wstring promt_title;
|
||||
};
|
||||
typedef shared_ptr<xlsx_dataValidation>::Type xlsx_dataValidation_ptr;
|
||||
|
||||
@ -103,24 +110,23 @@ public:
|
||||
if (jt2_next == mapCells.end() || jt2->first + 1 != jt2_next->first)
|
||||
break;
|
||||
|
||||
size_t j = 0; bool bFound = false;
|
||||
for (size_t j = 0; j < jt2_next->second.size(); j++)
|
||||
//size_t j = 0;
|
||||
bool bFound = false;
|
||||
|
||||
for (std::vector<std::pair<int, int>>::iterator v_jt2 = jt2_next->second.begin();
|
||||
v_jt2 != jt2_next->second.end(); ++v_jt2)
|
||||
{
|
||||
if (jt1->second[i].first == jt2_next->second[j].first ||
|
||||
jt1->second[i].second == jt2_next->second[j].second)
|
||||
if (jt1->second[i].first == v_jt2->first ||
|
||||
jt1->second[i].second == v_jt2->second)
|
||||
{
|
||||
bFound = true;
|
||||
jt2_next->second.erase(v_jt2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (bFound)
|
||||
{
|
||||
jt2_next->second.erase(jt2_next->second.begin() + j, jt2_next->second.begin() + j + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (false == bFound)
|
||||
break;
|
||||
}
|
||||
|
||||
jt2 = jt2_next;
|
||||
}
|
||||
if (!activate_ref.empty()) activate_ref += L" ";
|
||||
@ -135,11 +141,33 @@ public:
|
||||
{
|
||||
CP_XML_ATTR(L"sqref", activate_ref);
|
||||
CP_XML_ATTR(L"allowBlank", it->second->allowBlank);
|
||||
CP_XML_ATTR(L"operator", it->second->operator_);
|
||||
if (!it->second->operator_.empty())
|
||||
{
|
||||
CP_XML_ATTR(L"operator", it->second->operator_);
|
||||
}
|
||||
CP_XML_ATTR(L"showDropDown", it->second->showDropDown);
|
||||
CP_XML_ATTR(L"showErrorMessage", it->second->showErrorMessage);
|
||||
CP_XML_ATTR(L"showInputMessage", it->second->showInputMessage);
|
||||
CP_XML_ATTR(L"type", it->second->type);
|
||||
if (!it->second->type.empty())
|
||||
{
|
||||
CP_XML_ATTR(L"type", it->second->type);
|
||||
}
|
||||
if (!it->second->error_title.empty())
|
||||
{
|
||||
CP_XML_ATTR(L"errorTitle", it->second->error_title);
|
||||
}
|
||||
if (!it->second->error_text.empty())
|
||||
{
|
||||
CP_XML_ATTR(L"error", it->second->error_text);
|
||||
}
|
||||
if (!it->second->promt_title.empty())
|
||||
{
|
||||
CP_XML_ATTR(L"promptTitle", it->second->promt_title);
|
||||
}
|
||||
if (!it->second->promt_text.empty())
|
||||
{
|
||||
CP_XML_ATTR(L"prompt", it->second->promt_text);
|
||||
}
|
||||
|
||||
if (!it->second->formula1.empty())
|
||||
{
|
||||
@ -237,22 +265,26 @@ void xlsx_dataValidations_context::add(const std::wstring & name, const std::wst
|
||||
|
||||
impl_->mapDataValidations.insert(std::make_pair(name, _new));
|
||||
}
|
||||
void xlsx_dataValidations_context::add_help_msg(const std::wstring & name, bool val)
|
||||
void xlsx_dataValidations_context::add_help_msg(const std::wstring & name, const std::wstring & title, const std::wstring & content, bool display)
|
||||
{
|
||||
std::map<std::wstring, xlsx_dataValidation_ptr>::iterator pFind = impl_->mapDataValidations.find(name);
|
||||
|
||||
if (pFind == impl_->mapDataValidations.end()) return;
|
||||
|
||||
pFind->second->showInputMessage = val;
|
||||
pFind->second->showInputMessage = display;
|
||||
pFind->second->promt_title = title;
|
||||
pFind->second->promt_text = content;
|
||||
}
|
||||
|
||||
void xlsx_dataValidations_context::add_error_msg(const std::wstring & name, bool val)
|
||||
void xlsx_dataValidations_context::add_error_msg(const std::wstring & name, const std::wstring & title, const std::wstring & content, bool display)
|
||||
{
|
||||
std::map<std::wstring, xlsx_dataValidation_ptr>::iterator pFind = impl_->mapDataValidations.find(name);
|
||||
|
||||
if (pFind == impl_->mapDataValidations.end()) return;
|
||||
|
||||
pFind->second->showErrorMessage = val;
|
||||
pFind->second->showErrorMessage = display;
|
||||
pFind->second->error_title = title;
|
||||
pFind->second->error_text = content;
|
||||
}
|
||||
void xlsx_dataValidations_context::add_formula(const std::wstring & name, const std::wstring & f) // todooo пооптимальней
|
||||
{
|
||||
@ -261,10 +293,10 @@ void xlsx_dataValidations_context::add_formula(const std::wstring & name, const
|
||||
if (pFind == impl_->mapDataValidations.end()) return;
|
||||
|
||||
formulasconvert::odf2oox_converter converter;
|
||||
int pos = -1;
|
||||
std::wstring val;
|
||||
size_t pos;
|
||||
std::wstring val, val2;
|
||||
|
||||
if ( 0 <= (pos = f.find(L"cell-content-is-in-list"))) //oooc: , of:
|
||||
if ( std::wstring::npos != (pos = f.find(L"cell-content-is-in-list"))) //oooc: , of:
|
||||
{
|
||||
pFind->second->type = L"list";
|
||||
val = f.substr(24 + pos, f.size() - 25 - pos);
|
||||
@ -287,6 +319,108 @@ void xlsx_dataValidations_context::add_formula(const std::wstring & name, const
|
||||
pFind->second->formula1 = converter.convert(val);
|
||||
}
|
||||
}
|
||||
else if ( std::wstring::npos != (pos = f.find(L"is-true-formula")))
|
||||
{
|
||||
pFind->second->type = L"custom";
|
||||
val = f.substr(16 + pos, f.size() - 17 - pos);
|
||||
pFind->second->formula1 = converter.convert(val);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (std::wstring::npos != (pos = f.find(L"cell-content-is-date")))
|
||||
{
|
||||
pFind->second->type = L"date";
|
||||
}
|
||||
else if (std::wstring::npos != (pos = f.find(L"cell-content-is-decimal-number")))
|
||||
{
|
||||
pFind->second->type = L"decimal";
|
||||
}
|
||||
else if (std::wstring::npos != (pos = f.find(L"cell-content-is-time")))
|
||||
{
|
||||
pFind->second->type = L"time";
|
||||
}
|
||||
else if (std::wstring::npos != (pos = f.find(L"cell-content-is-whole-number")))
|
||||
{
|
||||
pFind->second->type = L"whole";
|
||||
}
|
||||
|
||||
if (std::wstring::npos != (pos = f.find(L"cell-content()==")))
|
||||
{
|
||||
pFind->second->operator_ = L"equal";
|
||||
|
||||
size_t pos2 = f.find(L"and", pos + 16);
|
||||
if (pos2 == std::wstring::npos) pos2 = f.length();
|
||||
|
||||
val = f.substr(pos + 16, pos2 - pos - 16);
|
||||
}
|
||||
else if (std::wstring::npos != (pos = f.find(L"cell-content()<>")))
|
||||
{
|
||||
pFind->second->operator_ = L"notEqual";
|
||||
|
||||
size_t pos2 = f.find(L"and", pos + 16);
|
||||
if (pos2 == std::wstring::npos) pos2 = f.length();
|
||||
|
||||
val = f.substr(pos + 16, pos2 - pos - 16);
|
||||
}
|
||||
else if (std::wstring::npos != (pos = f.find(L"cell-content()<=")))
|
||||
{
|
||||
pFind->second->operator_ = L"lessThanOrEqual";
|
||||
|
||||
size_t pos2 = f.find(L"and", pos + 16);
|
||||
if (pos2 == std::wstring::npos) pos2 = f.length();
|
||||
|
||||
val = f.substr(pos + 16, pos2 - pos - 16);
|
||||
}
|
||||
else if (std::wstring::npos != (pos = f.find(L"cell-content()<")))
|
||||
{
|
||||
pFind->second->operator_ = L"lessThan";
|
||||
|
||||
size_t pos2 = f.find(L"and", pos + 15);
|
||||
if (pos2 == std::wstring::npos) pos2 = f.length();
|
||||
|
||||
val = f.substr(pos + 15, pos2 - pos - 15);
|
||||
}
|
||||
else if (std::wstring::npos != (pos = f.find(L"cell-content()>=")))
|
||||
{
|
||||
pFind->second->operator_ = L"greaterThanOrEqual";
|
||||
|
||||
size_t pos2 = f.find(L"and", pos + 16);
|
||||
if (pos2 == std::wstring::npos) pos2 = f.length();
|
||||
|
||||
val = f.substr(pos + 16, pos2 - pos - 16);
|
||||
}
|
||||
else if (std::wstring::npos != (pos = f.find(L"cell-content()>")))
|
||||
{
|
||||
pFind->second->operator_ = L"greaterThan";
|
||||
|
||||
size_t pos2 = f.find(L"and", pos + 15);
|
||||
if (pos2 == std::wstring::npos) pos2 = f.length();
|
||||
|
||||
val = f.substr(pos + 15, pos2 - pos - 15);
|
||||
}
|
||||
else if (std::wstring::npos != (pos = f.find(L"cell-content-is-not-between(")))
|
||||
{
|
||||
pFind->second->operator_ = L"greaterThanOrEqual";
|
||||
|
||||
size_t pos2 = f.find(L",", pos + 27);
|
||||
size_t pos3 = f.rfind(L")");
|
||||
|
||||
val = f.substr(pos + 27, pos2 - pos - 27);
|
||||
val2 = f.substr(pos2 + 1, pos3 - pos2 - 1);
|
||||
}
|
||||
else if (std::wstring::npos != (pos = f.find(L"cell-content-is-between(")))
|
||||
{
|
||||
pFind->second->operator_ = L"between";
|
||||
|
||||
size_t pos2 = f.find(L",", pos + 24);
|
||||
size_t pos3 = f.rfind(L")");
|
||||
|
||||
val = f.substr(pos + 24, pos2 - pos - 24);
|
||||
val2 = f.substr(pos2 + 1, pos3 - pos2 - 1);
|
||||
}
|
||||
pFind->second->formula1 = converter.convert(val);
|
||||
pFind->second->formula2 = converter.convert(val2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -46,8 +46,8 @@ public:
|
||||
|
||||
void add(const std::wstring & name, /*int col, int row*/const std::wstring & ref);
|
||||
void add_formula(const std::wstring & name, const std::wstring & f);
|
||||
void add_help_msg(const std::wstring & name, bool val);
|
||||
void add_error_msg(const std::wstring & name, bool val);
|
||||
void add_help_msg(const std::wstring & name, const std::wstring & title, const std::wstring & content, bool display);
|
||||
void add_error_msg(const std::wstring & name, const std::wstring & title, const std::wstring & content, bool display);
|
||||
|
||||
void activate(const std::wstring & name, int col, int row/*const std::wstring & ref*/);
|
||||
|
||||
|
||||
@ -35,6 +35,30 @@
|
||||
#include <xml/utils.h>
|
||||
|
||||
#include "../odf/datatypes/custom_shape_types_convert.h"
|
||||
#include "../../formulasconvert/formulasconvert.h"
|
||||
|
||||
#define OBJ_Group 0x0000
|
||||
#define OBJ_Line 0x0001
|
||||
#define OBJ_Rectangle 0x0002
|
||||
#define OBJ_Oval 0x0003
|
||||
#define OBJ_Arc 0x0004
|
||||
#define OBJ_Text 0x0006
|
||||
#define OBJ_OfficeArt 0x001E
|
||||
#define OBJ_Polygon 0x0009
|
||||
#define OBJ_Picture 0x0008
|
||||
#define OBJ_Chart 0x0005
|
||||
#define OBJ_Button 0x0007
|
||||
#define OBJ_CheckBox 0x000B
|
||||
#define OBJ_RadioButton 0x000C
|
||||
#define OBJ_EditBox 0x000D
|
||||
#define OBJ_Label 0x000E
|
||||
#define OBJ_DialogBox 0x000F
|
||||
#define OBJ_SpinControl 0x0010
|
||||
#define OBJ_Scrollbar 0x0011
|
||||
#define OBJ_List 0x0012
|
||||
#define OBJ_GroupBox 0x0013
|
||||
#define OBJ_DropdownList 0x0014
|
||||
#define OBJ_Note 0x0019
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
@ -48,17 +72,17 @@ std::wostream & operator << (std::wostream & strm, xlsx_drawing_position::type_t
|
||||
}
|
||||
|
||||
}
|
||||
void xlsx_serialize_text(std::wostream & strm, _xlsx_drawing & val)
|
||||
void xml_serialize_text(std::wostream & strm, _xlsx_drawing & val, const std::wstring & ns)
|
||||
{
|
||||
_CP_OPT(std::wstring) strTextContent;
|
||||
odf_reader::GetProperty ( val.additional ,L"text-content", strTextContent);
|
||||
odf_reader::GetProperty ( val.additional, L"text-content", strTextContent);
|
||||
|
||||
if (!strTextContent)return;
|
||||
if (strTextContent->empty())return;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"xdr:txBody")
|
||||
CP_XML_NODE(ns + L":txBody")
|
||||
{
|
||||
val.serialize_bodyPr(CP_XML_STREAM());
|
||||
|
||||
@ -71,28 +95,34 @@ void xlsx_serialize_text(std::wostream & strm, _xlsx_drawing & val)
|
||||
}
|
||||
}
|
||||
|
||||
void xlsx_drawing_position::serialize(std::wostream & strm, std::wstring ns)
|
||||
std::wstring xlsx_drawing_position::vml_serialize()
|
||||
{
|
||||
//emu -> pt = 1 / 12700 = 72.0 / (360000.0 * 2.54);
|
||||
return std::to_wstring(position.col) + L"," + std::to_wstring((int)(position.colOff / 12700)) + L"," +
|
||||
std::to_wstring(position.row) + L"," + std::to_wstring((int)(position.rowOff / 12700));
|
||||
}
|
||||
void xlsx_drawing_position::serialize(std::wostream & strm, const std::wstring & ns_title, const std::wstring & ns)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE( ns + (type == xlsx_drawing_position::from ? L"from" : L"to") )
|
||||
CP_XML_NODE( ns_title + (ns_title.empty() ? L"" : L":") + (type == xlsx_drawing_position::from ? L"from" : L"to") )
|
||||
{
|
||||
CP_XML_NODE(L"xdr:col")
|
||||
CP_XML_NODE(ns + (ns.empty() ? L"" : L":") + L"col")
|
||||
{
|
||||
CP_XML_CONTENT(position.col);
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"xdr:colOff")
|
||||
CP_XML_NODE(ns + (ns.empty() ? L"" : L":") + L"colOff")
|
||||
{
|
||||
CP_XML_CONTENT(static_cast<size_t>(position.colOff));
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"xdr:row")
|
||||
CP_XML_NODE(ns + (ns.empty() ? L"" : L":") + L"row")
|
||||
{
|
||||
CP_XML_CONTENT(position.row);
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"xdr:rowOff")
|
||||
CP_XML_NODE(ns + (ns.empty() ? L"" : L":") + L"rowOff")
|
||||
{
|
||||
CP_XML_CONTENT(static_cast<size_t>(position.rowOff));
|
||||
}
|
||||
@ -100,15 +130,15 @@ void xlsx_drawing_position::serialize(std::wostream & strm, std::wstring ns)
|
||||
}
|
||||
}
|
||||
|
||||
void xlsx_serialize_image(std::wostream & strm, _xlsx_drawing & val)
|
||||
void xml_serialize_image(std::wostream & strm, _xlsx_drawing & val, const std::wstring & ns)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"xdr:pic")
|
||||
CP_XML_NODE(ns + L":pic")
|
||||
{
|
||||
CP_XML_NODE(L"xdr:nvPicPr")
|
||||
CP_XML_NODE(ns + L":nvPicPr")
|
||||
{
|
||||
CP_XML_NODE(L"xdr:cNvPr")
|
||||
CP_XML_NODE(ns + L":cNvPr")
|
||||
{
|
||||
CP_XML_ATTR(L"id", val.id);
|
||||
CP_XML_ATTR(L"name", val.name);
|
||||
@ -116,7 +146,7 @@ void xlsx_serialize_image(std::wostream & strm, _xlsx_drawing & val)
|
||||
oox_serialize_action(CP_XML_STREAM(), val.action);
|
||||
|
||||
}
|
||||
CP_XML_NODE(L"xdr:cNvPicPr")
|
||||
CP_XML_NODE(ns + L":cNvPicPr")
|
||||
{
|
||||
if (val.fill.bitmap->bCrop)
|
||||
{
|
||||
@ -128,7 +158,7 @@ void xlsx_serialize_image(std::wostream & strm, _xlsx_drawing & val)
|
||||
val.fill.bitmap->name_space = L"xdr";
|
||||
oox_serialize_fill(CP_XML_STREAM(), val.fill);
|
||||
|
||||
CP_XML_NODE(L"xdr:spPr")
|
||||
CP_XML_NODE(ns + L":spPr")
|
||||
{
|
||||
val.serialize_xfrm(CP_XML_STREAM());
|
||||
|
||||
@ -139,20 +169,20 @@ void xlsx_serialize_image(std::wostream & strm, _xlsx_drawing & val)
|
||||
}
|
||||
oox_serialize_ln(CP_XML_STREAM(), val.additional);
|
||||
}
|
||||
xlsx_serialize_text(CP_XML_STREAM(), val);
|
||||
xml_serialize_text(CP_XML_STREAM(), val, ns);
|
||||
}
|
||||
} // CP_XML_WRITER
|
||||
}
|
||||
|
||||
void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing & val)
|
||||
void xml_serialize_shape(std::wostream & strm, _xlsx_drawing & val, const std::wstring & ns)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"xdr:sp")
|
||||
CP_XML_NODE(ns + L":sp")
|
||||
{
|
||||
CP_XML_NODE(L"xdr:nvSpPr")
|
||||
CP_XML_NODE(ns + L":nvSpPr")
|
||||
{
|
||||
CP_XML_NODE(L"xdr:cNvPr")
|
||||
CP_XML_NODE(ns + L":cNvPr")
|
||||
{
|
||||
CP_XML_ATTR(L"id", val.id);//числовое значение val.rId
|
||||
|
||||
@ -160,12 +190,12 @@ void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing & val)
|
||||
|
||||
oox_serialize_action(CP_XML_STREAM(), val.action);
|
||||
}
|
||||
CP_XML_NODE(L"xdr:cNvSpPr")//non visual properies (собственно тока 1 там)
|
||||
CP_XML_NODE(ns + L":cNvSpPr")//non visual properies (собственно тока 1 там)
|
||||
{
|
||||
if (val.sub_type == 1)CP_XML_ATTR(L"txBox", 1);
|
||||
}
|
||||
} // xdr:nv_Pr
|
||||
CP_XML_NODE(L"xdr:spPr")
|
||||
CP_XML_NODE(ns + L":spPr")
|
||||
{
|
||||
val.serialize_xfrm(CP_XML_STREAM());
|
||||
|
||||
@ -174,11 +204,11 @@ void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing & val)
|
||||
oox_serialize_ln(CP_XML_STREAM(),val.additional, val.lined);
|
||||
} // xdr:spPr
|
||||
|
||||
xlsx_serialize_text(CP_XML_STREAM(), val);
|
||||
xml_serialize_text(CP_XML_STREAM(), val, ns);
|
||||
}
|
||||
} // CP_XML_WRITER
|
||||
}
|
||||
void xlsx_serialize_object(std::wostream & strm, _xlsx_drawing & val)
|
||||
void xml_serialize_object(std::wostream & strm, _xlsx_drawing & val)
|
||||
{//отображательная часть
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
@ -206,22 +236,22 @@ void xlsx_serialize_object(std::wostream & strm, _xlsx_drawing & val)
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_serialize_group(std::wostream & strm, _xlsx_drawing & val)
|
||||
void xml_serialize_group(std::wostream & strm, _xlsx_drawing & val, const std::wstring & ns)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"xdr:grpSp")
|
||||
CP_XML_NODE(ns + L":grpSp")
|
||||
{
|
||||
CP_XML_NODE(L"xdr:nvGrpSpPr")
|
||||
CP_XML_NODE(ns + L":nvGrpSpPr")
|
||||
{
|
||||
CP_XML_NODE(L"xdr:cNvPr")
|
||||
CP_XML_NODE(ns + L":cNvPr")
|
||||
{
|
||||
CP_XML_ATTR(L"id", val.id);
|
||||
CP_XML_ATTR(L"name", val.name);
|
||||
}
|
||||
CP_XML_NODE(L"xdr:cNvGrpSpPr");
|
||||
CP_XML_NODE(ns + L":cNvGrpSpPr");
|
||||
}
|
||||
CP_XML_NODE(L"xdr:grpSpPr")
|
||||
CP_XML_NODE(ns + L":grpSpPr")
|
||||
{
|
||||
val.serialize_xfrm(CP_XML_STREAM());
|
||||
|
||||
@ -231,7 +261,7 @@ void xlsx_serialize_group(std::wostream & strm, _xlsx_drawing & val)
|
||||
}
|
||||
}
|
||||
|
||||
void xlsx_serialize_chart(std::wostream & strm, _xlsx_drawing & val)
|
||||
void xml_serialize_chart(std::wostream & strm, _xlsx_drawing & val)
|
||||
{//отображательная часть
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
@ -266,75 +296,106 @@ void xlsx_serialize_chart(std::wostream & strm, _xlsx_drawing & val)
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_serialize(std::wostream & strm, _xlsx_drawing & val)
|
||||
void xml_serialize(std::wostream & strm, _xlsx_drawing & val, const std::wstring & ns)
|
||||
{
|
||||
if (val.type == typeShape)
|
||||
{
|
||||
xlsx_serialize_shape(strm, val);
|
||||
xml_serialize_shape(strm, val, ns);
|
||||
}
|
||||
else if (val.type == typeImage)
|
||||
{
|
||||
xlsx_serialize_image(strm, val);
|
||||
xml_serialize_image(strm, val, ns);
|
||||
}
|
||||
else if (val.type == typeChart)
|
||||
{
|
||||
xlsx_serialize_chart(strm, val);
|
||||
xml_serialize_chart(strm, val);
|
||||
}
|
||||
else if (val.type == typeGroupShape)
|
||||
{
|
||||
xlsx_serialize_group(strm, val);
|
||||
xml_serialize_group(strm, val, ns);
|
||||
}
|
||||
else if (val.type == typeOleObject ||
|
||||
val.type == typeMsObject ||
|
||||
val.type == typeControl)
|
||||
{
|
||||
xlsx_serialize_object(strm, val);
|
||||
xml_serialize_object(strm, val);
|
||||
}
|
||||
}
|
||||
|
||||
void _xlsx_drawing::serialize(std::wostream & strm)
|
||||
|
||||
void _xlsx_drawing::serialize(std::wostream & strm, const std::wstring & ns)
|
||||
{
|
||||
if (inGroup)
|
||||
return xlsx_serialize(strm, *this);
|
||||
return xml_serialize(strm, *this, ns);
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
if (type_anchor == 1)
|
||||
{
|
||||
CP_XML_NODE(L"xdr:twoCellAnchor")
|
||||
CP_XML_NODE(ns + L":twoCellAnchor")
|
||||
{
|
||||
CP_XML_ATTR(L"editAs", L"oneCell");//"absolute");oneCell
|
||||
|
||||
from_.serialize (CP_XML_STREAM());
|
||||
to_.serialize (CP_XML_STREAM());
|
||||
|
||||
xlsx_serialize (CP_XML_STREAM(), *this);
|
||||
CP_XML_NODE(L"xdr:clientData");
|
||||
xml_serialize (CP_XML_STREAM(), *this, ns);
|
||||
CP_XML_NODE(ns + L":clientData");
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (type_anchor == 2)
|
||||
{
|
||||
CP_XML_NODE(L"xdr:absoluteAnchor")
|
||||
CP_XML_NODE(ns + L":absoluteAnchor")
|
||||
{
|
||||
CP_XML_NODE(L"xdr:pos")
|
||||
CP_XML_NODE(ns + L":pos")
|
||||
{
|
||||
CP_XML_ATTR(L"x", x);
|
||||
CP_XML_ATTR(L"y", y);
|
||||
}
|
||||
CP_XML_NODE(L"xdr:ext")
|
||||
CP_XML_NODE(ns + L":ext")
|
||||
{
|
||||
CP_XML_ATTR(L"cx", cx);
|
||||
CP_XML_ATTR(L"cy", cy);
|
||||
}
|
||||
xlsx_serialize(CP_XML_STREAM(), *this);
|
||||
CP_XML_NODE(L"xdr:clientData");
|
||||
xml_serialize(CP_XML_STREAM(), *this, ns);
|
||||
CP_XML_NODE(ns + L":clientData");
|
||||
}
|
||||
}
|
||||
else if (type_anchor == 3)
|
||||
{
|
||||
CP_XML_NODE(ns + L":relSizeAnchor")
|
||||
{
|
||||
CP_XML_NODE(ns + L":from")
|
||||
{
|
||||
CP_XML_NODE(ns + L":x")
|
||||
{
|
||||
CP_XML_STREAM() << ((double)x / *owner_cx_);
|
||||
}
|
||||
CP_XML_NODE(ns + L":y")
|
||||
{
|
||||
CP_XML_STREAM() << ((double)y / *owner_cy_);
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(ns + L":to")
|
||||
{
|
||||
_INT32 x1 = x + cx;
|
||||
_INT32 y1 = y + cy;
|
||||
|
||||
CP_XML_NODE(ns + L":x")
|
||||
{
|
||||
CP_XML_STREAM() << ((double)x1 / *owner_cx_);
|
||||
}
|
||||
CP_XML_NODE(ns + L":y")
|
||||
{
|
||||
CP_XML_STREAM() << ((double)y1 / *owner_cy_);
|
||||
}
|
||||
}
|
||||
xml_serialize(CP_XML_STREAM(), *this, ns);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void _xlsx_drawing::serialize_object (std::wostream & strm)
|
||||
{
|
||||
if (type != typeOleObject && type != typeMsObject) return;
|
||||
@ -358,9 +419,8 @@ void _xlsx_drawing::serialize_object (std::wostream & strm)
|
||||
{
|
||||
CP_XML_ATTR(L"moveWithCells", 1);
|
||||
|
||||
from_.serialize (CP_XML_STREAM(), L"");
|
||||
to_.serialize (CP_XML_STREAM(), L"");
|
||||
|
||||
from_.serialize (CP_XML_STREAM(), L"", L"");
|
||||
to_.serialize (CP_XML_STREAM(), L"", L"");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -390,8 +450,8 @@ void _xlsx_drawing::serialize_control (std::wostream & strm)
|
||||
{
|
||||
CP_XML_ATTR(L"moveWithCells", 1);
|
||||
|
||||
from_.serialize (CP_XML_STREAM(), L"");
|
||||
to_.serialize (CP_XML_STREAM(), L"");
|
||||
from_.serialize (CP_XML_STREAM(), L"", L"xdr");
|
||||
to_.serialize (CP_XML_STREAM(), L"", L"xdr");
|
||||
|
||||
}
|
||||
}
|
||||
@ -399,6 +459,167 @@ void _xlsx_drawing::serialize_control (std::wostream & strm)
|
||||
}
|
||||
|
||||
}
|
||||
void _xlsx_drawing::serialize_vml(std::wostream & strm)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"v:shape")
|
||||
{
|
||||
CP_XML_ATTR(L"id", L"_x0000_s" + std::to_wstring(id));
|
||||
CP_XML_ATTR(L"type", sub_type == OBJ_Note ? L"#_x0000_t202" : L"#_x0000_t201");
|
||||
|
||||
std::wstring color;
|
||||
|
||||
if (fill.solid)
|
||||
color = fill.solid->color;
|
||||
|
||||
if (!color.empty())
|
||||
CP_XML_ATTR(L"fillcolor", L"#" + color);
|
||||
|
||||
CP_XML_ATTR(L"stroked", /*lined ? */L"t"/* : L"f"*/);
|
||||
|
||||
std::wstring style = L"position:absolute";
|
||||
//style +="margin-left:414.3pt;margin-top:70.2pt;width:144.15pt;height:96.75pt";
|
||||
|
||||
CP_XML_ATTR(L"style", style);
|
||||
CP_XML_NODE(L"v:shadow")
|
||||
{
|
||||
CP_XML_ATTR(L"on", L"t");
|
||||
CP_XML_ATTR(L"obscured", L"t");
|
||||
CP_XML_ATTR(L"color", L"black");
|
||||
}
|
||||
//CP_XML_NODE(L"w10:wrap")
|
||||
//{
|
||||
// CP_XML_ATTR(L"type", L"none");
|
||||
//}
|
||||
vml_serialize_fill(CP_XML_STREAM(), fill);
|
||||
|
||||
vml_serialize_ln(CP_XML_STREAM(), additional);
|
||||
|
||||
CP_XML_NODE(L"x:ClientData")
|
||||
{
|
||||
switch(sub_type)
|
||||
{
|
||||
case OBJ_Button: CP_XML_ATTR(L"ObjectType", L"Button"); break;
|
||||
case OBJ_CheckBox: CP_XML_ATTR(L"ObjectType", L"Checkbox");break;
|
||||
case OBJ_RadioButton: CP_XML_ATTR(L"ObjectType", L"Radio"); break;
|
||||
case OBJ_EditBox: CP_XML_ATTR(L"ObjectType", L"Edit"); break;
|
||||
case OBJ_Label: CP_XML_ATTR(L"ObjectType", L"Label"); break;
|
||||
case OBJ_DialogBox: CP_XML_ATTR(L"ObjectType", L"Dialog"); break;
|
||||
case OBJ_SpinControl: CP_XML_ATTR(L"ObjectType", L"Spin"); break;
|
||||
case OBJ_Scrollbar: CP_XML_ATTR(L"ObjectType", L"Scroll"); break;
|
||||
case OBJ_List: CP_XML_ATTR(L"ObjectType", L"List"); break;
|
||||
case OBJ_DropdownList: CP_XML_ATTR(L"ObjectType", L"List"); break;
|
||||
case OBJ_Note: CP_XML_ATTR(L"ObjectType", L"Note"); break;
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"x:MoveWithCells");
|
||||
CP_XML_NODE(L"x:SizeWithCells");
|
||||
CP_XML_NODE(L"x:Anchor")
|
||||
{
|
||||
CP_XML_STREAM() << from_.vml_serialize() << L"," << to_.vml_serialize();
|
||||
}
|
||||
CP_XML_NODE(L"x:AutoFill")
|
||||
{
|
||||
CP_XML_STREAM() << L"False";
|
||||
}
|
||||
|
||||
_CP_OPT(int) base_col, base_row;
|
||||
GetProperty(additional, L"base_col", base_col);
|
||||
GetProperty(additional, L"base_row", base_row);
|
||||
|
||||
if (base_row)
|
||||
{
|
||||
CP_XML_NODE(L"x:Row")
|
||||
{
|
||||
CP_XML_STREAM() << *base_row;
|
||||
}
|
||||
}
|
||||
if (base_col)
|
||||
{
|
||||
CP_XML_NODE(L"x:Column")
|
||||
{
|
||||
CP_XML_STREAM() << *base_col;
|
||||
}
|
||||
}
|
||||
_CP_OPT(std::wstring) sVal;
|
||||
GetProperty(additional, L"linked_cell", sVal);
|
||||
if (sVal)
|
||||
{
|
||||
formulasconvert::odf2oox_converter converter;
|
||||
std::wstring fmla = converter.convert_named_ref(*sVal);
|
||||
CP_XML_NODE(L"x:FmlaLink")
|
||||
{
|
||||
CP_XML_STREAM() << fmla;
|
||||
}
|
||||
}
|
||||
_CP_OPT(bool) visible;
|
||||
GetProperty(additional, L"visible", visible);
|
||||
if (visible)
|
||||
{
|
||||
if (*visible == false)
|
||||
{
|
||||
CP_XML_NODE(L"x:Visible")
|
||||
{
|
||||
CP_XML_STREAM() << L"False";
|
||||
}
|
||||
}
|
||||
else
|
||||
CP_XML_NODE(L"x:Visible");
|
||||
}
|
||||
|
||||
_CP_OPT(int) nVal;
|
||||
GetProperty(additional, L"min_value", nVal);
|
||||
if (nVal)
|
||||
{
|
||||
CP_XML_NODE(L"x:Min")
|
||||
{
|
||||
CP_XML_STREAM() << *nVal;
|
||||
}
|
||||
}
|
||||
GetProperty(additional, L"max_value", nVal);
|
||||
if (nVal)
|
||||
{
|
||||
CP_XML_NODE(L"x:Max")
|
||||
{
|
||||
CP_XML_STREAM() << *nVal;
|
||||
}
|
||||
}
|
||||
GetProperty(additional, L"step", nVal);
|
||||
if (nVal)
|
||||
{
|
||||
CP_XML_NODE(L"x:Inc")
|
||||
{
|
||||
CP_XML_STREAM() << *nVal;
|
||||
}
|
||||
}
|
||||
GetProperty(additional, L"page_step", nVal);
|
||||
if (nVal)
|
||||
{
|
||||
CP_XML_NODE(L"x:Page")
|
||||
{
|
||||
CP_XML_STREAM() << *nVal;
|
||||
}
|
||||
}
|
||||
GetProperty(additional, L"value", sVal);
|
||||
if (sVal)
|
||||
{
|
||||
CP_XML_NODE(L"x:Val")
|
||||
{
|
||||
CP_XML_STREAM() << *sVal;
|
||||
}
|
||||
}
|
||||
|
||||
GetProperty(additional, L"orientation", sVal);
|
||||
if (sVal)
|
||||
{
|
||||
if (*sVal == L"horizontal") CP_XML_NODE(L"x:Horiz");
|
||||
else CP_XML_NODE(L"x:Vert");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,10 +49,10 @@ struct xlsx_drawing_position
|
||||
enum type_t {from, to} type;
|
||||
xlsx_table_position position;
|
||||
|
||||
void serialize(std::wostream & _Wostream, std::wstring ns = L"xdr:");
|
||||
void serialize(std::wostream & _Wostream, const std::wstring & ns_title = L"xdr", const std::wstring & ns = L"xdr");
|
||||
std::wstring vml_serialize();
|
||||
};
|
||||
|
||||
|
||||
class _xlsx_drawing : public _oox_drawing
|
||||
{
|
||||
public:
|
||||
@ -63,9 +63,15 @@ public:
|
||||
xlsx_drawing_position from_;
|
||||
xlsx_drawing_position to_;
|
||||
|
||||
_CP_OPT(_INT32) owner_cx_;
|
||||
_CP_OPT(_INT32) owner_cy_;
|
||||
|
||||
std::wstring content_group_;
|
||||
|
||||
void serialize (std::wostream & strm);
|
||||
virtual void serialize (std::wostream & strm) {return serialize(strm, L"xdr");}
|
||||
|
||||
void serialize (std::wostream & strm, const std::wstring & ns);
|
||||
void serialize_vml (std::wostream & strm);
|
||||
void serialize_object (std::wostream & strm);
|
||||
void serialize_control (std::wostream & strm);
|
||||
};
|
||||
|
||||
@ -53,41 +53,54 @@ namespace oox {
|
||||
class xlsx_drawing_context_handle::Impl
|
||||
{
|
||||
public:
|
||||
Impl(mediaitems & items) : items_(items), next_rId_(1), next_drawing_id_(1)
|
||||
Impl(mediaitems_ptr & items) : items_(items), next_drawing_id_(1), next_vml_drawing_id_(1)
|
||||
{
|
||||
}
|
||||
|
||||
mediaitems & get_mediaitems() { return items_; }
|
||||
mediaitems_ptr & get_mediaitems() { return items_; }
|
||||
|
||||
size_t next_rId()
|
||||
std::pair<std::wstring, std::wstring> add_drawing_vml(std::wstring const & content, xlsx_drawings_ptr drawings)
|
||||
{
|
||||
return next_rId_++;
|
||||
const std::wstring id = std::to_wstring(next_vml_drawing_id_++);
|
||||
const std::wstring fileName = std::wstring(L"vmlDrawing") + id + L".vml";
|
||||
|
||||
drawings_vml_.push_back(drawing_elm(fileName, content, drawings, typeDefault));
|
||||
const std::wstring rId = std::wstring(L"rVId") + id;
|
||||
|
||||
return std::pair<std::wstring, std::wstring>(fileName, rId);
|
||||
}
|
||||
|
||||
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings)
|
||||
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings, RelsType const & type_)
|
||||
{
|
||||
const std::wstring id = std::to_wstring(next_drawing_id_++);
|
||||
const std::wstring fileName = std::wstring(L"drawing") + id + L".xml";
|
||||
drawings_.push_back(drawing_elm(fileName, content, drawings));
|
||||
const std::wstring rId = std::wstring(L"rId") + id;//rDrId
|
||||
return std::pair<std::wstring, std::wstring>(fileName, rId);
|
||||
}
|
||||
|
||||
const std::vector<drawing_elm> & content() const
|
||||
{
|
||||
return drawings_;
|
||||
|
||||
drawings_.push_back(drawing_elm(fileName, content, drawings, type_));
|
||||
const std::wstring rId = std::wstring(L"rDrId") + id;
|
||||
|
||||
return std::pair<std::wstring, std::wstring>(fileName, rId);
|
||||
}
|
||||
|
||||
const std::vector<drawing_elm> & content() const
|
||||
{
|
||||
return drawings_;
|
||||
}
|
||||
const std::vector<drawing_elm> & content_vml() const
|
||||
{
|
||||
return drawings_vml_;
|
||||
}
|
||||
private:
|
||||
mediaitems & items_;
|
||||
std::vector<drawing_elm> drawings_;
|
||||
mediaitems_ptr items_;
|
||||
|
||||
std::vector<drawing_elm> drawings_;
|
||||
std::vector<drawing_elm> drawings_vml_;
|
||||
|
||||
size_t next_rId_;
|
||||
size_t next_drawing_id_;
|
||||
size_t next_vml_drawing_id_;
|
||||
};
|
||||
|
||||
xlsx_drawing_context_handle::xlsx_drawing_context_handle(mediaitems & items)
|
||||
: impl_(new xlsx_drawing_context_handle::Impl(items))
|
||||
xlsx_drawing_context_handle::xlsx_drawing_context_handle(mediaitems_ptr & items) :
|
||||
next_rId_(1), impl_(new xlsx_drawing_context_handle::Impl(items))
|
||||
{
|
||||
}
|
||||
|
||||
@ -95,26 +108,33 @@ xlsx_drawing_context_handle::~xlsx_drawing_context_handle()
|
||||
{
|
||||
}
|
||||
|
||||
std::pair<std::wstring, std::wstring> xlsx_drawing_context_handle::add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings)
|
||||
std::pair<std::wstring, std::wstring> xlsx_drawing_context_handle::add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings, RelsType const & type_)
|
||||
{
|
||||
return impl_->add_drawing_xml(content, drawings);
|
||||
return impl_->add_drawing_xml(content, drawings, type_);
|
||||
}
|
||||
std::pair<std::wstring, std::wstring> xlsx_drawing_context_handle::add_drawing_vml(std::wstring const & content, xlsx_drawings_ptr drawings)
|
||||
{
|
||||
return impl_->add_drawing_vml(content, drawings);
|
||||
}
|
||||
|
||||
const std::vector<drawing_elm> & xlsx_drawing_context_handle::content() const
|
||||
{
|
||||
return impl_->content();
|
||||
}
|
||||
|
||||
const std::vector<drawing_elm> & xlsx_drawing_context_handle::content_vml() const
|
||||
{
|
||||
return impl_->content_vml();
|
||||
}
|
||||
class xlsx_drawing_context::Impl
|
||||
{
|
||||
public:
|
||||
Impl(xlsx_drawing_context_handle & handle) : xlsx_drawings_(xlsx_drawings::create(false)), handle_(handle)
|
||||
Impl(xlsx_drawing_context_handle_ptr & handle) : xlsx_drawings_(xlsx_drawings::create(false)), handle_(handle)
|
||||
{
|
||||
current_level_ = &objects_;
|
||||
use_image_replacement_ = false;
|
||||
}
|
||||
|
||||
xlsx_drawing_context_handle& handle_;
|
||||
xlsx_drawing_context_handle_ptr handle_;
|
||||
drawing_object_description object_description_;
|
||||
|
||||
std::vector<drawing_object_description> objects_;
|
||||
@ -124,21 +144,27 @@ public:
|
||||
bool use_image_replacement_;
|
||||
//-----------------------------------------------------------------------------------
|
||||
|
||||
mediaitems & get_mediaitems() { return handle_.impl_->get_mediaitems(); }
|
||||
mediaitems_ptr & get_mediaitems() { return handle_->impl_->get_mediaitems(); }
|
||||
|
||||
void serialize(std::wostream & strm)
|
||||
void serialize(std::wostream & strm, const std::wstring & ns = L"xdr")
|
||||
{
|
||||
xlsx_drawings_->serialize(strm);
|
||||
xlsx_drawings_->serialize(strm, ns);
|
||||
}
|
||||
void serialize_vml(std::wostream & strm)
|
||||
{
|
||||
xlsx_drawings_->serialize_vml(strm);
|
||||
}
|
||||
|
||||
bool empty() const
|
||||
{
|
||||
return xlsx_drawings_->empty();
|
||||
}
|
||||
|
||||
bool vml_empty() const
|
||||
{
|
||||
return xlsx_drawings_->vml_empty();
|
||||
}
|
||||
size_t next_rId()
|
||||
{
|
||||
return handle_.impl_->next_rId();
|
||||
return handle_->next_rId();
|
||||
}
|
||||
|
||||
xlsx_drawings_ptr get_drawings()
|
||||
@ -150,7 +176,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
xlsx_drawing_context::xlsx_drawing_context(xlsx_drawing_context_handle & h)
|
||||
xlsx_drawing_context::xlsx_drawing_context(xlsx_drawing_context_handle_ptr & h)
|
||||
: impl_(new xlsx_drawing_context::Impl(h))
|
||||
{
|
||||
hlinks_size_ = 0;
|
||||
@ -281,7 +307,29 @@ void xlsx_drawing_context::end_shape()
|
||||
{
|
||||
impl_->current_level_->push_back(impl_->object_description_);
|
||||
}
|
||||
void xlsx_drawing_context::start_comment(int base_col, int base_row)
|
||||
{
|
||||
impl_->object_description_.type_ = typeComment;
|
||||
impl_->object_description_.shape_type_ = 0x0019; // OBJ_Note object type for vml
|
||||
|
||||
set_property(odf_reader::_property(L"base_col", base_col));
|
||||
set_property(odf_reader::_property(L"base_row", base_row));
|
||||
}
|
||||
void xlsx_drawing_context::end_comment()
|
||||
{
|
||||
impl_->current_level_->push_back(impl_->object_description_);
|
||||
}
|
||||
void xlsx_drawing_context::start_control(const std::wstring & ctrlPropId, int type)
|
||||
{
|
||||
impl_->object_description_.type_ = typeControl;
|
||||
impl_->object_description_.shape_type_ = type; // object type for vml
|
||||
|
||||
impl_->object_description_.xlink_href_ = ctrlPropId;
|
||||
}
|
||||
void xlsx_drawing_context::end_control()
|
||||
{
|
||||
impl_->current_level_->push_back(impl_->object_description_);
|
||||
}
|
||||
void xlsx_drawing_context::set_use_image_replacement()
|
||||
{
|
||||
impl_->use_image_replacement_ = true;
|
||||
@ -304,11 +352,6 @@ void xlsx_drawing_context::set_ms_object(const std::wstring & path, const std::w
|
||||
impl_->object_description_.xlink_href_ = path;
|
||||
impl_->object_description_.descriptor_ = progId;
|
||||
}
|
||||
void xlsx_drawing_context::set_control(const std::wstring & ctrlPropId)
|
||||
{
|
||||
impl_->object_description_.type_ = typeControl;
|
||||
impl_->object_description_.xlink_href_ = ctrlPropId;
|
||||
}
|
||||
void xlsx_drawing_context::set_image(const std::wstring & path)
|
||||
{
|
||||
int pos_replaicement = path.find(L"ObjectReplacements");
|
||||
@ -386,6 +429,12 @@ void xlsx_drawing_context::set_scale(double cx_pt, double cy_pt)
|
||||
|
||||
}
|
||||
}
|
||||
void xlsx_drawing_context::set_rel_anchor(_INT32 owner_cx, _INT32 owner_cy)
|
||||
{
|
||||
impl_->object_description_.owner_cx_ = owner_cx;
|
||||
impl_->object_description_.owner_cy_ = owner_cy;
|
||||
}
|
||||
|
||||
void xlsx_drawing_context::set_anchor(std::wstring anchor, double x_pt, double y_pt, bool group)
|
||||
{
|
||||
if (group)
|
||||
@ -439,14 +488,25 @@ bool xlsx_drawing_context::empty() const
|
||||
{
|
||||
return impl_->empty();
|
||||
}
|
||||
|
||||
bool xlsx_drawing_context::vml_empty() const
|
||||
{
|
||||
return impl_->vml_empty();
|
||||
}
|
||||
void xlsx_drawing_context::process_common_properties(drawing_object_description & obj, _xlsx_drawing & drawing, xlsx_table_metrics & table_metrics)
|
||||
{
|
||||
if (obj.anchor_.empty())
|
||||
{
|
||||
drawing.type_anchor = 2; // absolute
|
||||
if (obj.owner_cx_ && obj.owner_cy_)
|
||||
{
|
||||
drawing.type_anchor = 3; // relative
|
||||
drawing.owner_cx_ = obj.owner_cx_;
|
||||
drawing.owner_cy_ = obj.owner_cy_;
|
||||
}
|
||||
else
|
||||
drawing.type_anchor = 2; // absolute
|
||||
}
|
||||
else
|
||||
|
||||
if (drawing.type_anchor == 1)
|
||||
{
|
||||
xlsx_table_position from, to;
|
||||
|
||||
@ -470,17 +530,19 @@ void xlsx_drawing_context::process_common_properties(drawing_object_description
|
||||
_rect & r = obj.svg_rect_.get();
|
||||
|
||||
//todooo непонятно что делать с отрицательными значениями
|
||||
int val = 0.5 + odf_types::length(obj.svg_rect_->x, odf_types::length::pt).get_value_unit(odf_types::length::emu);
|
||||
if (val >=0) drawing.x = val;
|
||||
_INT32 val = 0;
|
||||
|
||||
val = (_INT32) (0.5 + odf_types::length(obj.svg_rect_->x, odf_types::length::pt).get_value_unit(odf_types::length::emu));
|
||||
if (val >= 0) drawing.x = val;
|
||||
|
||||
val = 0.5 + odf_types::length(obj.svg_rect_->y, odf_types::length::pt).get_value_unit(odf_types::length::emu);
|
||||
if (val >=0) drawing.y = val;
|
||||
val = (_INT32) (0.5 + odf_types::length(obj.svg_rect_->y, odf_types::length::pt).get_value_unit(odf_types::length::emu));
|
||||
if (val >= 0) drawing.y = val;
|
||||
|
||||
val = 0.5 + odf_types::length(obj.svg_rect_->cx, odf_types::length::pt).get_value_unit(odf_types::length::emu);
|
||||
if (val >=0) drawing.cx = val;
|
||||
val = (_INT32) (0.5 + odf_types::length(obj.svg_rect_->cx, odf_types::length::pt).get_value_unit(odf_types::length::emu));
|
||||
if (val >= 0) drawing.cx = val;
|
||||
|
||||
val = .5 + odf_types::length(obj.svg_rect_->cy, odf_types::length::pt).get_value_unit(odf_types::length::emu);
|
||||
if (val >=0) drawing.cy = val;
|
||||
val = (_INT32) (0.5 + odf_types::length(obj.svg_rect_->cy, odf_types::length::pt).get_value_unit(odf_types::length::emu));
|
||||
if (val >= 0) drawing.cy = val;
|
||||
}
|
||||
|
||||
drawing.additional = obj.additional_;
|
||||
@ -555,7 +617,7 @@ void xlsx_drawing_context::process_image(drawing_object_description & obj, _xlsx
|
||||
}
|
||||
std::wstring fileName = odf_packet_path_ + FILE_SEPARATOR_STR + obj.xlink_href_;
|
||||
|
||||
drawing.fill.bitmap->bCrop = odf_reader::parse_clipping(obj.clipping_string_, fileName, drawing.fill.bitmap->cropRect, impl_->get_mediaitems().applicationFonts());
|
||||
drawing.fill.bitmap->bCrop = odf_reader::parse_clipping(obj.clipping_string_, fileName, drawing.fill.bitmap->cropRect, impl_->get_mediaitems()->applicationFonts());
|
||||
drawing.fill.bitmap->bStretch = true;
|
||||
|
||||
if ((sColorMode) && (*sColorMode == L"greyscale"))
|
||||
@ -564,14 +626,14 @@ void xlsx_drawing_context::process_image(drawing_object_description & obj, _xlsx
|
||||
std::wstring ref;/// это ссылка на выходной внешний объект
|
||||
bool isMediaInternal = false;
|
||||
|
||||
drawing.fill.bitmap->rId = impl_->get_mediaitems().add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref);
|
||||
drawing.fill.bitmap->rId = impl_->get_mediaitems()->add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref);
|
||||
|
||||
if (drawing.type == typeShape)
|
||||
{
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);//собственно это не объект, а доп рел и ref объекта
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage, false, false);//собственно это не объект, а доп рел и ref объекта
|
||||
|
||||
isMediaInternal=true;
|
||||
std::wstring rId = impl_->get_mediaitems().add_or_find(L"", typeShape, isMediaInternal, ref);
|
||||
std::wstring rId = impl_->get_mediaitems()->add_or_find(L"", typeShape, isMediaInternal, ref);
|
||||
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, rId, ref, typeShape);//объект
|
||||
|
||||
@ -580,7 +642,7 @@ void xlsx_drawing_context::process_image(drawing_object_description & obj, _xlsx
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, drawing.fill.bitmap->rId , ref, typeImage);//объект
|
||||
|
||||
if (drawing.inGroup)
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.fill.bitmap->rId, ref, obj.type_); // не объект
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.fill.bitmap->rId, ref, obj.type_, false, false); // не объект
|
||||
}
|
||||
}
|
||||
|
||||
@ -589,12 +651,13 @@ void xlsx_drawing_context::process_chart(drawing_object_description & obj,_xlsx_
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
|
||||
drawing.objectId = impl_->get_mediaitems().add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
drawing.objectId = impl_->get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, drawing.objectId, ref, obj.type_);
|
||||
|
||||
if (drawing.inGroup)
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.objectId, ref, obj.type_); // не объект
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.objectId, ref, obj.type_, false, false); // не объект
|
||||
}
|
||||
|
||||
void xlsx_drawing_context::process_object(drawing_object_description & obj, xlsx_table_metrics & table_metrics, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_)
|
||||
{
|
||||
std::wstring ref;
|
||||
@ -620,28 +683,29 @@ void xlsx_drawing_context::process_object(drawing_object_description & obj, xlsx
|
||||
drawing.to_.position.rowOff = static_cast<size_t>(odf_types::length(to.rowOff, odf_types::length::pt).get_value_unit(odf_types::length::emu));
|
||||
}
|
||||
|
||||
if (obj.type_ == typeControl)
|
||||
if (obj.type_ == typeControl || obj.type_ == typeComment)
|
||||
{
|
||||
drawing.objectId = obj.xlink_href_;
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, drawing.objectId, ref, obj.type_);
|
||||
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, drawing.objectId, ref, obj.type_, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
drawing.objectId = impl_->get_mediaitems().add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
drawing.objectId = impl_->get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
drawing.objectProgId = obj.descriptor_;
|
||||
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, drawing.objectId, ref, obj.type_, true);
|
||||
}
|
||||
|
||||
if (drawing.inGroup)
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.objectId, ref, obj.type_); // не объект
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.objectId, ref, obj.type_, false, false); // не объект
|
||||
}
|
||||
void xlsx_drawing_context::process_shape(drawing_object_description & obj,_xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_)
|
||||
{
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
|
||||
std::wstring rId = impl_->get_mediaitems().add_or_find(L"", obj.type_, isMediaInternal, ref);
|
||||
std::wstring rId = impl_->get_mediaitems()->add_or_find(L"", obj.type_, isMediaInternal, ref);
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, rId, ref, obj.type_);
|
||||
}
|
||||
|
||||
@ -653,7 +717,7 @@ void xlsx_drawing_context::process_group(drawing_object_description & obj, xlsx_
|
||||
|
||||
std::wstringstream strm;
|
||||
|
||||
xlsx_drawings_child->serialize(strm);
|
||||
xlsx_drawings_child->serialize(strm, L"xdr");
|
||||
|
||||
drawing.content_group_ = strm.str();
|
||||
|
||||
@ -661,7 +725,7 @@ void xlsx_drawing_context::process_group(drawing_object_description & obj, xlsx_
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
|
||||
std::wstring rId = impl_->get_mediaitems().add_or_find(L"", obj.type_, isMediaInternal, ref);
|
||||
std::wstring rId = impl_->get_mediaitems()->add_or_find(L"", obj.type_, isMediaInternal, ref);
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, rId, ref, obj.type_);
|
||||
|
||||
}
|
||||
@ -685,17 +749,17 @@ void xlsx_drawing_context::process_group_objects(std::vector<drawing_object_desc
|
||||
drawing.lined = obj.lined_;
|
||||
drawing.connector = obj.connector_;
|
||||
|
||||
drawing.sub_type = obj.shape_type_;
|
||||
drawing.sub_type = obj.shape_type_;
|
||||
|
||||
if (drawing.fill.bitmap)
|
||||
{
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
|
||||
drawing.fill.bitmap->rId = impl_->get_mediaitems().add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
|
||||
drawing.fill.bitmap->rId = impl_->get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
|
||||
|
||||
bool in_sheet = (obj.type_== typeOleObject || obj.type_== typeMsObject) ? true : false;
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage, in_sheet);//собственно это не объект, а доп рел и ref объекта
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage, in_sheet, false);//собственно это не объект, а доп рел и ref объекта
|
||||
|
||||
//object dumps in sheet rels !!
|
||||
}
|
||||
@ -710,15 +774,19 @@ void xlsx_drawing_context::process_group_objects(std::vector<drawing_object_desc
|
||||
case typeGroupShape: process_group ( obj, table_metrics, drawing, xlsx_drawings_); break;
|
||||
case typeMsObject:
|
||||
case typeOleObject:
|
||||
case typeControl:
|
||||
process_object ( obj, table_metrics, drawing, xlsx_drawings_); break;
|
||||
case typeControl:
|
||||
case typeComment: process_object ( obj, table_metrics, drawing, xlsx_drawings_); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void xlsx_drawing_context::serialize(std::wostream & strm)
|
||||
void xlsx_drawing_context::serialize(std::wostream & strm, const std::wstring& ns)
|
||||
{
|
||||
impl_->serialize(strm);
|
||||
impl_->serialize(strm, ns);
|
||||
}
|
||||
void xlsx_drawing_context::serialize_vml(std::wostream & strm)
|
||||
{
|
||||
impl_->serialize_vml(strm);
|
||||
}
|
||||
|
||||
xlsx_drawings_ptr xlsx_drawing_context::get_drawings()
|
||||
@ -756,6 +824,5 @@ void xlsx_drawing_context::set_is_connector_shape(bool val)
|
||||
impl_->object_description_.connector_ = val;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,29 +53,42 @@ namespace oox {
|
||||
class xlsx_drawings;
|
||||
struct _oox_fill;
|
||||
|
||||
typedef _CP_PTR(xlsx_drawings) xlsx_drawings_ptr;
|
||||
typedef _CP_PTR(mediaitems) mediaitems_ptr;
|
||||
typedef _CP_PTR(xlsx_drawings) xlsx_drawings_ptr;
|
||||
|
||||
class xlsx_drawing_context_handle
|
||||
{
|
||||
public:
|
||||
xlsx_drawing_context_handle(mediaitems & items);
|
||||
xlsx_drawing_context_handle(mediaitems_ptr & items);
|
||||
~xlsx_drawing_context_handle();
|
||||
|
||||
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings);
|
||||
const std::vector<drawing_elm> & content() const;
|
||||
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings, RelsType const & type_ = typeDefault);
|
||||
std::pair<std::wstring, std::wstring> add_drawing_vml(std::wstring const & content, xlsx_drawings_ptr drawings);
|
||||
|
||||
const std::vector<drawing_elm> & content() const;
|
||||
const std::vector<drawing_elm> & content_vml() const;
|
||||
|
||||
friend class xlsx_drawing_context;
|
||||
|
||||
size_t next_rId()
|
||||
{
|
||||
return next_rId_++;
|
||||
}
|
||||
private:
|
||||
size_t next_rId_;
|
||||
|
||||
class Impl;
|
||||
_CP_PTR(Impl) impl_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
typedef _CP_PTR(xlsx_drawing_context_handle) xlsx_drawing_context_handle_ptr;
|
||||
|
||||
class xlsx_drawing_context
|
||||
{
|
||||
public:
|
||||
xlsx_drawing_context(xlsx_drawing_context_handle & h);
|
||||
xlsx_drawing_context(xlsx_drawing_context_handle_ptr & h);
|
||||
~xlsx_drawing_context();
|
||||
|
||||
void set_odf_packet_path(std::wstring path){odf_packet_path_ = path;}//для анализа картинок
|
||||
@ -87,7 +100,6 @@ public:
|
||||
void end_group ();
|
||||
|
||||
void start_shape(int type);
|
||||
//...пока тока общие свойства ... частные для каждого объекта пооозже
|
||||
void end_shape();
|
||||
|
||||
void start_frame();
|
||||
@ -95,24 +107,30 @@ public:
|
||||
void set_chart (const std::wstring & path);
|
||||
void set_ole_object (const std::wstring & path, const std::wstring & progId);
|
||||
void set_ms_object (const std::wstring & path, const std::wstring & progId);
|
||||
void set_control (const std::wstring & ctrlPropId);
|
||||
void set_text_box ();
|
||||
void end_frame();
|
||||
|
||||
void start_control(const std::wstring & ctrlPropId, int type);
|
||||
void end_control();
|
||||
|
||||
void start_comment(int base_col, int base_row);
|
||||
void end_comment();
|
||||
|
||||
void set_rect(double width_pt, double height_pt, double x_pt, double y_pt);
|
||||
|
||||
void set_translate (double x_pt, double y_pt);
|
||||
void set_scale (double cx_pt, double cy_pt);
|
||||
void set_rotate (double angle, bool translate = false);
|
||||
|
||||
void set_rel_anchor (_INT32 owner_cx, _INT32 owner_cy);
|
||||
void set_anchor (std::wstring anchor, double x_pt, double y_pt, bool group = false);
|
||||
void set_property (odf_reader::_property p);
|
||||
void set_clipping (const std::wstring & str );
|
||||
void set_fill (_oox_fill & fill);
|
||||
|
||||
void set_is_line_shape(bool val);
|
||||
void set_is_connector_shape(bool val);
|
||||
|
||||
void set_property (odf_reader::_property p);
|
||||
std::vector<odf_reader::_property> & get_properties();
|
||||
|
||||
std::wstring add_hyperlink(std::wstring const & ref);
|
||||
@ -120,9 +138,13 @@ public:
|
||||
void set_use_image_replacement();
|
||||
|
||||
bool empty() const;
|
||||
bool vml_empty() const;
|
||||
|
||||
void clear();
|
||||
|
||||
void serialize(std::wostream & strm);
|
||||
void serialize(std::wostream & strm, const std::wstring& ns = L"xdr");
|
||||
void serialize_vml(std::wostream & strm);
|
||||
|
||||
std::wstring dump_path(std::vector<svg_path::_polyline> & path, double w,double h);
|
||||
|
||||
xlsx_drawings_ptr get_drawings();
|
||||
|
||||
@ -46,18 +46,25 @@ class xlsx_drawings::Impl
|
||||
public:
|
||||
void add(_xlsx_drawing const & d, bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel )//объект
|
||||
{
|
||||
xlsx_drawings_.push_back(d);
|
||||
|
||||
add (isInternal, rid, ref, type, sheet_rel);
|
||||
|
||||
for (size_t i = 0; i < d.hlinks.size(); i++)
|
||||
{
|
||||
xlsx_drawing_rels_.push_back(_rel(false, d.hlinks[i].hId, d.hlinks[i].hRef, typeHyperlink));
|
||||
if (type == typeControl || type == typeControlProps || type == typeComment)
|
||||
{
|
||||
vml_drawings_.push_back(d);
|
||||
add (isInternal, rid, ref, type, sheet_rel, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
drawings_.push_back(d);
|
||||
add (isInternal, rid, ref, type, sheet_rel, false);
|
||||
|
||||
for (size_t i = 0; i < d.hlinks.size(); i++)
|
||||
{
|
||||
drawing_rels_.push_back(_rel(false, d.hlinks[i].hId, d.hlinks[i].hRef, typeHyperlink));
|
||||
}
|
||||
if (!d.action.hId.empty())
|
||||
drawing_rels_.push_back(_rel(false, d.action.hId, d.action.hRef, d.action.typeRels));
|
||||
}
|
||||
if (!d.action.hId.empty())
|
||||
xlsx_drawing_rels_.push_back(_rel(false, d.action.hId, d.action.hRef, d.action.typeRels));
|
||||
}
|
||||
void add( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel) //не объект
|
||||
void add( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel, bool vml_rel) //не объект
|
||||
{
|
||||
bool present = false;
|
||||
|
||||
@ -73,40 +80,124 @@ public:
|
||||
if (!present)
|
||||
xlsx_sheet_rels_.push_back (_rel(isInternal, rid, ref, type));
|
||||
}
|
||||
else
|
||||
else if (vml_rel)
|
||||
{
|
||||
for (size_t i = 0 ; i < xlsx_drawing_rels_.size(); i++)
|
||||
for (size_t i = 0 ; i < vml_drawing_rels_.size(); i++)
|
||||
{
|
||||
if (xlsx_drawing_rels_[i].rid == rid && xlsx_drawing_rels_[i].ref == ref)
|
||||
if (vml_drawing_rels_[i].rid == rid && vml_drawing_rels_[i].ref == ref)
|
||||
present = true;
|
||||
}
|
||||
if (!present)
|
||||
xlsx_drawing_rels_.push_back(_rel(isInternal, rid, ref, type));
|
||||
vml_drawing_rels_.push_back(_rel(isInternal, rid, ref, type));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t i = 0 ; i < drawing_rels_.size(); i++)
|
||||
{
|
||||
if (drawing_rels_[i].rid == rid && drawing_rels_[i].ref == ref)
|
||||
present = true;
|
||||
}
|
||||
if (!present)
|
||||
drawing_rels_.push_back(_rel(isInternal, rid, ref, type));
|
||||
}
|
||||
}
|
||||
|
||||
void serialize(std::wostream & strm)
|
||||
void serialize(std::wostream & strm, const std::wstring & ns)
|
||||
{
|
||||
if (drawings_.empty()) return;
|
||||
|
||||
if (inGroup)
|
||||
{
|
||||
for (size_t i = 0 ; i < xlsx_drawings_.size(); i++)
|
||||
for (size_t i = 0 ; i < drawings_.size(); i++)
|
||||
{
|
||||
xlsx_drawings_[i].serialize(strm);
|
||||
drawings_[i].serialize(strm, ns);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"xdr:wsDr")
|
||||
CP_XML_NODE(ns + L":wsDr")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:xdr", L"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
|
||||
if (ns == L"xdr")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:xdr", L"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
|
||||
}
|
||||
if (ns == L"cdr")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:cdr", L"http://schemas.openxmlformats.org/drawingml/2006/chartDrawing");
|
||||
}
|
||||
CP_XML_ATTR(L"xmlns:a" , L"http://schemas.openxmlformats.org/drawingml/2006/main");
|
||||
CP_XML_ATTR(L"xmlns:r" , L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
|
||||
for (size_t i = 0 ; i < xlsx_drawings_.size(); i++)
|
||||
for (size_t i = 0 ; i < drawings_.size(); i++)
|
||||
{
|
||||
xlsx_drawings_[i].serialize(CP_XML_STREAM());
|
||||
drawings_[i].serialize(CP_XML_STREAM(), ns);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void serialize_vml(std::wostream & strm)
|
||||
{
|
||||
if (vml_drawings_.empty()) return;
|
||||
|
||||
if (inGroup)
|
||||
{
|
||||
for (size_t i = 0 ; i < vml_drawings_.size(); i++)
|
||||
{
|
||||
vml_drawings_[i].serialize_vml(strm);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"xml")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:v", L"urn:schemas-microsoft-com:vml");
|
||||
CP_XML_ATTR(L"xmlns:o", L"urn:schemas-microsoft-com:office:office");
|
||||
CP_XML_ATTR(L"xmlns:x", L"urn:schemas-microsoft-com:office:excel");
|
||||
|
||||
CP_XML_NODE(L"v:shapetype")
|
||||
{
|
||||
CP_XML_ATTR(L"id", L"_x0000_t201");
|
||||
CP_XML_ATTR(L"o:spt", L"201"); // sptHostControl = 201
|
||||
|
||||
CP_XML_ATTR(L"coordsize", L"21600,21600");
|
||||
CP_XML_ATTR(L"path", L"m,l,21600r21600,l21600,xe");
|
||||
|
||||
CP_XML_NODE(L"v:stroke")
|
||||
{
|
||||
CP_XML_ATTR(L"joinstyle", L"miter");
|
||||
}
|
||||
CP_XML_NODE(L"v:path")
|
||||
{
|
||||
CP_XML_ATTR(L"gradientshapeok", L"t");
|
||||
CP_XML_ATTR(L"o:connecttype", L"rect");
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"v:shapetype")
|
||||
{
|
||||
CP_XML_ATTR(L"id", L"_x0000_t202");
|
||||
CP_XML_ATTR(L"o:spt", L"202"); // sptTextBox = 202
|
||||
|
||||
CP_XML_ATTR(L"coordsize", L"21600,21600");
|
||||
CP_XML_ATTR(L"path", L"m,l,21600l21600,21600l21600,xe");
|
||||
|
||||
CP_XML_NODE(L"v:stroke")
|
||||
{
|
||||
CP_XML_ATTR(L"joinstyle", L"miter");
|
||||
}
|
||||
CP_XML_NODE(L"v:path")
|
||||
{
|
||||
CP_XML_ATTR(L"gradientshapeok", L"t");
|
||||
CP_XML_ATTR(L"o:connecttype", L"rect");
|
||||
}
|
||||
}
|
||||
for (size_t i = 0 ; i < vml_drawings_.size(); i++)
|
||||
{
|
||||
vml_drawings_[i].serialize_vml(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -114,41 +205,62 @@ public:
|
||||
}
|
||||
void serialize_objects(std::wostream & strm)
|
||||
{
|
||||
for (size_t i = 0 ; i < xlsx_drawings_.size(); i++)
|
||||
for (size_t i = 0 ; i < drawings_.size(); i++)
|
||||
{
|
||||
if (xlsx_drawings_[i].type != typeOleObject && xlsx_drawings_[i].type != typeMsObject) continue;
|
||||
if (drawings_[i].type != typeOleObject && drawings_[i].type != typeMsObject) continue;
|
||||
|
||||
xlsx_drawings_[i].serialize_object(strm);
|
||||
drawings_[i].serialize_object(strm);
|
||||
}
|
||||
}
|
||||
void serialize_controls(std::wostream & strm)
|
||||
{
|
||||
for (size_t i = 0 ; i < xlsx_drawings_.size(); i++)
|
||||
for (size_t i = 0 ; i < vml_drawings_.size(); i++)
|
||||
{
|
||||
if (xlsx_drawings_[i].type != typeControl) continue;
|
||||
if (vml_drawings_[i].type != typeControl) continue;
|
||||
|
||||
xlsx_drawings_[i].serialize_control(strm);
|
||||
vml_drawings_[i].serialize_control(strm);
|
||||
}
|
||||
}
|
||||
bool empty() const
|
||||
{
|
||||
return (xlsx_drawings_.empty());
|
||||
return (drawings_.empty());
|
||||
}
|
||||
bool vml_empty() const
|
||||
{
|
||||
return (vml_drawings_.empty());
|
||||
}
|
||||
|
||||
void dump_rels_drawing(rels & Rels)
|
||||
{
|
||||
for (size_t i = 0 ; i < xlsx_drawing_rels_.size(); i++)
|
||||
for (size_t i = 0 ; i < drawing_rels_.size(); i++)
|
||||
{
|
||||
if (xlsx_drawing_rels_[i].type == typeImage ||
|
||||
xlsx_drawing_rels_[i].type == typeMedia ||
|
||||
xlsx_drawing_rels_[i].type == typeChart ||
|
||||
xlsx_drawing_rels_[i].type == typeHyperlink )
|
||||
if (drawing_rels_[i].type == typeImage ||
|
||||
drawing_rels_[i].type == typeMedia ||
|
||||
drawing_rels_[i].type == typeChart ||
|
||||
drawing_rels_[i].type == typeHyperlink )
|
||||
{
|
||||
|
||||
Rels.add(relationship( xlsx_drawing_rels_[i].rid,
|
||||
mediaitems::get_rel_type(xlsx_drawing_rels_[i].type),
|
||||
(xlsx_drawing_rels_[i].is_internal ? std::wstring(L"../") + xlsx_drawing_rels_[i].ref : xlsx_drawing_rels_[i].ref),
|
||||
(xlsx_drawing_rels_[i].is_internal ? L"" : L"External")) );
|
||||
Rels.add(relationship( drawing_rels_[i].rid,
|
||||
mediaitems::get_rel_type(drawing_rels_[i].type),
|
||||
(drawing_rels_[i].is_internal ? std::wstring(L"../") + drawing_rels_[i].ref : drawing_rels_[i].ref),
|
||||
(drawing_rels_[i].is_internal ? L"" : L"External")) );
|
||||
}
|
||||
}
|
||||
}
|
||||
void dump_rels_vml_drawing(rels & Rels)
|
||||
{
|
||||
for (size_t i = 0 ; i < vml_drawing_rels_.size(); i++)
|
||||
{
|
||||
if (vml_drawing_rels_[i].type == typeImage ||
|
||||
vml_drawing_rels_[i].type == typeMedia ||
|
||||
vml_drawing_rels_[i].type == typeChart ||
|
||||
vml_drawing_rels_[i].type == typeHyperlink )
|
||||
{
|
||||
|
||||
Rels.add(relationship( vml_drawing_rels_[i].rid,
|
||||
mediaitems::get_rel_type(vml_drawing_rels_[i].type),
|
||||
(vml_drawing_rels_[i].is_internal ? std::wstring(L"../") + vml_drawing_rels_[i].ref : vml_drawing_rels_[i].ref),
|
||||
(vml_drawing_rels_[i].is_internal ? L"" : L"External")) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -166,9 +278,11 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
std::vector<_xlsx_drawing> xlsx_drawings_;
|
||||
std::vector<_xlsx_drawing> drawings_;
|
||||
std::vector<_xlsx_drawing> vml_drawings_;
|
||||
|
||||
std::vector<_rel> xlsx_drawing_rels_;
|
||||
std::vector<_rel> drawing_rels_;
|
||||
std::vector<_rel> vml_drawing_rels_;
|
||||
std::vector<_rel> xlsx_sheet_rels_;
|
||||
};
|
||||
|
||||
@ -187,14 +301,18 @@ void xlsx_drawings::add(_xlsx_drawing const & d, bool isInternal, std::wstring c
|
||||
impl_->add(d, isInternal, rid, ref, type, sheet_rel);
|
||||
}
|
||||
|
||||
void xlsx_drawings::add( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel)
|
||||
void xlsx_drawings::add( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel, bool vml_rel)
|
||||
{
|
||||
impl_->add(isInternal, rid, ref, type, sheet_rel);
|
||||
impl_->add(isInternal, rid, ref, type, sheet_rel, vml_rel);
|
||||
}
|
||||
|
||||
void xlsx_drawings::serialize(std::wostream & strm)
|
||||
void xlsx_drawings::serialize(std::wostream & strm, const std::wstring & ns)
|
||||
{
|
||||
impl_->serialize(strm);
|
||||
impl_->serialize(strm, ns);
|
||||
}
|
||||
void xlsx_drawings::serialize_vml(std::wostream & strm)
|
||||
{
|
||||
impl_->serialize_vml(strm);
|
||||
}
|
||||
|
||||
void xlsx_drawings::serialize_objects(std::wostream & strm)
|
||||
@ -210,12 +328,18 @@ bool xlsx_drawings::empty() const
|
||||
{
|
||||
return impl_->empty();
|
||||
}
|
||||
|
||||
bool xlsx_drawings::vml_empty() const
|
||||
{
|
||||
return impl_->vml_empty();
|
||||
}
|
||||
void xlsx_drawings::dump_rels_drawing(rels & Rels)
|
||||
{
|
||||
return impl_->dump_rels_drawing(Rels);
|
||||
}
|
||||
|
||||
void xlsx_drawings::dump_rels_vml_drawing(rels & Rels)
|
||||
{
|
||||
return impl_->dump_rels_vml_drawing(Rels);
|
||||
}
|
||||
void xlsx_drawings::dump_rels_sheet(rels & Rels)
|
||||
{
|
||||
return impl_->dump_rels_sheet(Rels);
|
||||
|
||||
@ -46,13 +46,14 @@ typedef _CP_PTR(xlsx_drawings) xlsx_drawings_ptr;
|
||||
|
||||
struct drawing_elm
|
||||
{
|
||||
drawing_elm(std::wstring const & _filename, std::wstring const & _content, xlsx_drawings_ptr _drawings)
|
||||
: filename(_filename), content(_content), drawings(_drawings)
|
||||
drawing_elm(std::wstring const & _filename, std::wstring const & _content, xlsx_drawings_ptr _drawings, RelsType const & _type)
|
||||
: filename(_filename), content(_content), drawings(_drawings), type(_type)
|
||||
{}
|
||||
|
||||
std::wstring filename;
|
||||
std::wstring content;
|
||||
xlsx_drawings_ptr drawings;
|
||||
RelsType type;
|
||||
};
|
||||
|
||||
class _xlsx_drawing;
|
||||
@ -65,13 +66,17 @@ public:
|
||||
static xlsx_drawings_ptr create(bool inGroup);
|
||||
|
||||
void add ( _xlsx_drawing const & d, bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel = false );
|
||||
void add ( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel = false );
|
||||
void add ( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel, bool vml_rel);
|
||||
|
||||
bool empty () const;
|
||||
void dump_rels_sheet (rels & Rels);
|
||||
void dump_rels_drawing (rels & Rels);
|
||||
bool empty() const;
|
||||
bool vml_empty() const;
|
||||
|
||||
void dump_rels_sheet (rels & Rels);
|
||||
void dump_rels_drawing (rels & Rels);
|
||||
void dump_rels_vml_drawing (rels & Rels);
|
||||
|
||||
void serialize (std::wostream & _Wostream);
|
||||
void serialize (std::wostream & _Wostream, const std::wstring & ns);
|
||||
void serialize_vml (std::wostream & _Wostream);
|
||||
void serialize_objects (std::wostream & _Wostream);
|
||||
void serialize_controls (std::wostream & _Wostream);
|
||||
private:
|
||||
|
||||
@ -49,7 +49,6 @@ public:
|
||||
std::wstringstream sheetFormat_;
|
||||
std::wstringstream sheetData_;
|
||||
std::wstringstream mergeCells_;
|
||||
std::wstringstream drawing_;
|
||||
std::wstringstream hyperlinks_;
|
||||
std::wstringstream comments_;
|
||||
std::wstringstream sort_;
|
||||
@ -130,10 +129,6 @@ std::wostream & xlsx_xml_worksheet::autofilter()
|
||||
{
|
||||
return impl_->autofilter_;
|
||||
}
|
||||
std::wostream & xlsx_xml_worksheet::drawing()
|
||||
{
|
||||
return impl_->drawing_;
|
||||
}
|
||||
std::wostream & xlsx_xml_worksheet::comments()
|
||||
{
|
||||
return impl_->comments_;
|
||||
@ -217,35 +212,40 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
CP_XML_STREAM() << impl_->hyperlinks_.str();
|
||||
}
|
||||
}
|
||||
if (!impl_->page_props_.str().empty())
|
||||
if (false == impl_->page_props_.str().empty())
|
||||
{
|
||||
CP_XML_STREAM() << impl_->page_props_.str();
|
||||
}//props выше legacyDrawing !!
|
||||
|
||||
CP_XML_STREAM() << impl_->drawing_.str();
|
||||
|
||||
if (!impl_->commentsId_.empty())
|
||||
if (false == impl_->drawingId_.empty())
|
||||
{
|
||||
CP_XML_NODE(L"drawing")
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", impl_->drawingId_);
|
||||
}
|
||||
}
|
||||
if (false == impl_->vml_drawingId_.empty())
|
||||
{
|
||||
CP_XML_NODE(L"legacyDrawing")
|
||||
{
|
||||
CP_XML_ATTR(L"r:id",impl_->vml_drawingId_);
|
||||
CP_XML_ATTR(L"r:id", impl_->vml_drawingId_);
|
||||
}
|
||||
}
|
||||
if (!impl_->ole_objects_.str().empty())
|
||||
if (false == impl_->ole_objects_.str().empty())
|
||||
{
|
||||
CP_XML_NODE(L"oleObjects")
|
||||
{
|
||||
CP_XML_STREAM() << impl_->ole_objects_.str();
|
||||
}
|
||||
}
|
||||
if (!impl_->controls_.str().empty())
|
||||
if (false == impl_->controls_.str().empty())
|
||||
{
|
||||
CP_XML_NODE(L"controls")
|
||||
{
|
||||
CP_XML_STREAM() << impl_->controls_.str();
|
||||
}
|
||||
}
|
||||
if (!impl_->tableParts_.str().empty())
|
||||
if (false == impl_->tableParts_.str().empty())
|
||||
{
|
||||
CP_XML_NODE(L"tableParts")
|
||||
{
|
||||
|
||||
@ -58,7 +58,6 @@ public:
|
||||
std::wostream & sheetData();
|
||||
std::wostream & hyperlinks();
|
||||
std::wostream & mergeCells();
|
||||
std::wostream & drawing();
|
||||
std::wostream & comments();
|
||||
std::wostream & autofilter();
|
||||
std::wostream & tableParts();
|
||||
|
||||
@ -31,6 +31,8 @@
|
||||
*/
|
||||
|
||||
#include "xlsx_package.h"
|
||||
#include "docx_package.h"
|
||||
#include "pptx_package.h"
|
||||
|
||||
#include <boost/ref.hpp>
|
||||
|
||||
@ -298,16 +300,16 @@ void xl_files::add_sheet(sheet_content_ptr sheet)
|
||||
sheets_files_.add_sheet(sheet);
|
||||
}
|
||||
|
||||
void xl_files::set_media(mediaitems & _Mediaitems)
|
||||
void xl_files::set_media(mediaitems_ptr & _mediaitems)
|
||||
{
|
||||
if (_Mediaitems.count_image + _Mediaitems.count_media > 0)
|
||||
if (_mediaitems->count_image + _mediaitems->count_media > 0)
|
||||
{
|
||||
media_ = element_ptr( new media(_Mediaitems, _Mediaitems.applicationFonts()) );
|
||||
media_ = element_ptr( new media(_mediaitems, _mediaitems->applicationFonts()) );
|
||||
}
|
||||
|
||||
if (_Mediaitems.count_object > 0)
|
||||
if (_mediaitems->count_object > 0)
|
||||
{
|
||||
embeddings_ = element_ptr( new embeddings(_Mediaitems) );
|
||||
embeddings_ = element_ptr( new embeddings(_mediaitems) );
|
||||
}
|
||||
}
|
||||
void xl_files::set_comments(element_ptr Element)
|
||||
@ -556,17 +558,27 @@ void xl_control_props_files::write(const std::wstring & RootPath)
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
xl_drawings_ptr xl_drawings::create(const std::vector<drawing_elm> & elms)
|
||||
xl_drawings_ptr xl_drawings::create(const std::vector<drawing_elm> & elms, const std::vector<drawing_elm> & vml_elms)
|
||||
{
|
||||
return boost::make_shared<xl_drawings>(boost::ref(elms));
|
||||
return boost::make_shared<xl_drawings>(boost::ref(elms), boost::ref(vml_elms));
|
||||
}
|
||||
|
||||
void xl_drawings::write(const std::wstring & RootPath)
|
||||
{
|
||||
if (drawings_.empty() && vml_drawings_.empty()) return;
|
||||
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"drawings";
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
for (size_t i = 0; i < drawings_.size(); i++)
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
|
||||
pptx_document *pptx = dynamic_cast<pptx_document*>(this->get_main_document());
|
||||
xlsx_document *xlsx = dynamic_cast<xlsx_document*>(this->get_main_document());
|
||||
docx_document *docx = dynamic_cast<docx_document*>(this->get_main_document());
|
||||
|
||||
const std::wstring override_str = docx ? L"/word/drawings/" : (pptx ? L"/ppt/drawings/" : L"/xl/drawings/");
|
||||
|
||||
for (size_t i = 0; i < drawings_.size(); i++)
|
||||
{
|
||||
package::simple_element(drawings_[i].filename, drawings_[i].content).write(path);
|
||||
|
||||
@ -578,10 +590,25 @@ void xl_drawings::write(const std::wstring & RootPath)
|
||||
relFiles.add_rel_file(r);
|
||||
relFiles.write(path);
|
||||
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
const std::wstring kDrawingCT = drawings_[i].type == typeChartUserShapes ?
|
||||
L"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml" :
|
||||
L"application/vnd.openxmlformats-officedocument.drawing+xml";
|
||||
|
||||
contentTypes->add_override(override_str + drawings_[i].filename, kDrawingCT);
|
||||
}
|
||||
for (size_t i = 0; i < vml_drawings_.size(); i++)
|
||||
{
|
||||
package::simple_element(vml_drawings_[i].filename, vml_drawings_[i].content).write(path);
|
||||
|
||||
const std::wstring kDrawingCT = L"application/vnd.openxmlformats-officedocument.drawing+xml";
|
||||
contentTypes->add_override(L"/xl/drawings/" + drawings_[i].filename, kDrawingCT);
|
||||
rels_files relFiles;
|
||||
rels_file_ptr r = rels_file::create(vml_drawings_[i].filename + L".rels");
|
||||
|
||||
vml_drawings_[i].drawings->dump_rels_vml_drawing(r->get_rels());
|
||||
|
||||
relFiles.add_rel_file(r);
|
||||
relFiles.write(path);
|
||||
|
||||
//content types - default
|
||||
}
|
||||
}
|
||||
|
||||
@ -593,9 +620,6 @@ xl_comments_ptr xl_comments::create(const std::vector<comment_elm> & elms)
|
||||
|
||||
void xl_comments::write(const std::wstring & RootPath)
|
||||
{
|
||||
std::wstring vml_path = RootPath + FILE_SEPARATOR_STR + L"drawings";
|
||||
NSDirectory::CreateDirectory(vml_path.c_str());
|
||||
|
||||
for (size_t i = 0; i < comments_.size(); i++)
|
||||
{
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
@ -604,7 +628,6 @@ void xl_comments::write(const std::wstring & RootPath)
|
||||
contentTypes->add_override(std::wstring(L"/xl/") + comments_[i].filename, kWSConType);
|
||||
|
||||
package::simple_element(comments_[i].filename, comments_[i].content).write(RootPath);
|
||||
package::simple_element(comments_[i].vml_filename, comments_[i].vml_content).write(vml_path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -244,20 +244,27 @@ class xl_drawings: public element
|
||||
{
|
||||
public:
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
void set_rels(rels_files * rels)
|
||||
{
|
||||
rels_ = rels;
|
||||
}
|
||||
|
||||
xl_drawings(const std::vector<drawing_elm> & elms) : drawings_ ( elms )
|
||||
|
||||
//void set_rels(rels_files * rels)
|
||||
// {
|
||||
// rels_ = rels;
|
||||
// }
|
||||
//void set_vml_rels(rels_files * rels)
|
||||
// {
|
||||
// vml_rels_ = rels;
|
||||
// }
|
||||
xl_drawings(const std::vector<drawing_elm> & elms, const std::vector<drawing_elm> & vml_elms) : drawings_(elms), vml_drawings_(vml_elms)
|
||||
{
|
||||
}
|
||||
|
||||
static xl_drawings_ptr create(const std::vector<drawing_elm> & elms);
|
||||
static xl_drawings_ptr create(const std::vector<drawing_elm> & elms, const std::vector<drawing_elm> & vml_elms);
|
||||
|
||||
private:
|
||||
const std::vector<drawing_elm> & drawings_;
|
||||
rels_files * rels_;
|
||||
const std::vector<drawing_elm> & vml_drawings_;
|
||||
|
||||
//rels_files * rels_;
|
||||
//rels_files * vml_rels_;
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
class xl_control_props_files : public element
|
||||
@ -284,7 +291,7 @@ public:
|
||||
void set_sharedStrings (element_ptr Element);
|
||||
void set_connections (element_ptr Element);
|
||||
void add_sheet (sheet_content_ptr sheet);
|
||||
void set_media (mediaitems & _Mediaitems);
|
||||
void set_media (mediaitems_ptr & _Mediaitems);
|
||||
void set_drawings (element_ptr Element);
|
||||
void set_vml_drawings (element_ptr Element);
|
||||
void set_comments (element_ptr Element);
|
||||
|
||||
@ -340,6 +340,12 @@ void xlsx_table_context::serialize_tableParts(std::wostream & _Wostream, rels &
|
||||
|
||||
// из за дебелизма мсофис которому ОБЯЗАТЕЛЬНО нужно прописывать имена колонок таблицы (и они должны быть еще
|
||||
// прописаны и в самих данных таблицы !!
|
||||
|
||||
while (xlsx_data_ranges_[it->second]->header_values.size() > xlsx_data_ranges_[it->second]->cell_end.first -
|
||||
xlsx_data_ranges_[it->second]->cell_start.first + 1)
|
||||
{
|
||||
xlsx_data_ranges_[it->second]->header_values.pop_back();
|
||||
}
|
||||
int i = xlsx_data_ranges_[it->second]->header_values.size() - 1;
|
||||
for (; i >= 0; i--)
|
||||
{
|
||||
|
||||
@ -74,7 +74,10 @@ public:
|
||||
void start_drawing_content();
|
||||
std::wstring end_drawing_content();
|
||||
|
||||
void serialize_shared_strings(std::wostream & strm);
|
||||
void start_only_text();
|
||||
std::wstring end_only_text();
|
||||
|
||||
void serialize_shared_strings(std::wostream & strm);
|
||||
|
||||
void ApplyTextProperties (std::wstring style, std::wstring para_style, odf_reader::text_format_properties_content & propertiesOut);
|
||||
void ApplyParagraphProperties (std::wstring style, odf_reader::paragraph_format_properties & propertiesOut);
|
||||
@ -94,6 +97,7 @@ private:
|
||||
bool in_span;
|
||||
bool in_paragraph;
|
||||
bool in_cell_content;
|
||||
bool only_text;
|
||||
|
||||
odf_reader::styles_container & styles_;
|
||||
odf_reader::text_format_properties_content * text_properties_cell_;
|
||||
@ -126,7 +130,7 @@ void xlsx_text_context::Impl::serialize_shared_strings(std::wostream & strm)
|
||||
|
||||
|
||||
xlsx_text_context::Impl::Impl(odf_reader::styles_container & styles): paragraphs_cout_(0),styles_(styles),
|
||||
in_comment(false),in_draw(false),in_paragraph(false),in_span(false),in_cell_content(false)
|
||||
in_comment(false),in_draw(false),in_paragraph(false),in_span(false),in_cell_content(false),only_text(false)
|
||||
{
|
||||
local_styles_ptr_ = NULL;
|
||||
text_properties_cell_ = NULL;
|
||||
@ -136,7 +140,7 @@ void xlsx_text_context::Impl::add_text(const std::wstring & text)
|
||||
{
|
||||
text_ << text;
|
||||
|
||||
if (!in_comment && !in_draw)
|
||||
if (!in_comment && !in_draw && !only_text)
|
||||
dump_run();
|
||||
}
|
||||
|
||||
@ -149,7 +153,7 @@ void xlsx_text_context::Impl::start_paragraph(const std::wstring & styleName)
|
||||
{
|
||||
if (paragraphs_cout_++ > 0)
|
||||
{
|
||||
if ( in_comment == true )
|
||||
if ( in_comment || only_text)
|
||||
{
|
||||
// конец предыдущего абзаца и начало следующего
|
||||
//text_ << L" ";
|
||||
@ -169,7 +173,7 @@ void xlsx_text_context::Impl::start_paragraph(const std::wstring & styleName)
|
||||
|
||||
void xlsx_text_context::Impl::end_paragraph()
|
||||
{
|
||||
if (!in_comment && !in_draw)
|
||||
if (!in_comment && !in_draw && !only_text)
|
||||
{
|
||||
dump_run();
|
||||
paragraph_style_name_ = L"";
|
||||
@ -181,7 +185,7 @@ void xlsx_text_context::Impl::start_span(const std::wstring & styleName)//кус
|
||||
{
|
||||
int text_size = text_.str().length();
|
||||
|
||||
if (in_comment || in_draw)
|
||||
if (in_comment || in_draw || only_text)
|
||||
{
|
||||
if (( span_style_name_ != styleName && text_size > 0 ) || in_span)
|
||||
{
|
||||
@ -202,12 +206,12 @@ void xlsx_text_context::Impl::start_span(const std::wstring & styleName)//кус
|
||||
void xlsx_text_context::Impl::end_span() //odf корявенько написан - возможны повторы стилей в последовательных кусках текста
|
||||
//пока с анализом стилей тока комменты - остальные текстовые куски как есть.. с охрененным возможно дубляжом
|
||||
{
|
||||
if (!in_comment)
|
||||
if (!in_comment && !only_text)
|
||||
{
|
||||
dump_run();
|
||||
span_style_name_=L"";
|
||||
span_style_name_ = L"";
|
||||
}
|
||||
in_span=false;
|
||||
in_span = false;
|
||||
}
|
||||
|
||||
std::wstring xlsx_text_context::Impl::end_span2()
|
||||
@ -375,7 +379,9 @@ std::wstring xlsx_text_context::Impl::dump_paragraph(/*bool last*/)
|
||||
|
||||
std::wstring str_run = run_.str();
|
||||
|
||||
if (str_run.length() > 0 || paragraph_style_name_.length() > 0)
|
||||
if (only_text) return str_run;
|
||||
|
||||
if (false == str_run.empty() || false == paragraph_style_name_.empty())
|
||||
{
|
||||
CP_XML_WRITER(paragraph_)
|
||||
{
|
||||
@ -402,8 +408,7 @@ std::wstring xlsx_text_context::Impl::dump_run()
|
||||
{
|
||||
const std::wstring content = xml::utils::replace_text_to_xml(text_.str());
|
||||
|
||||
if (content.empty())
|
||||
return L"";
|
||||
if (content.empty()) return L"";
|
||||
|
||||
std::wstring prefix_draw;
|
||||
if (in_draw) prefix_draw = L"a:";
|
||||
@ -449,7 +454,35 @@ void xlsx_text_context::Impl::start_cell_content()
|
||||
|
||||
text_properties_cell_ = NULL;
|
||||
}
|
||||
void xlsx_text_context::Impl::start_only_text()
|
||||
{
|
||||
paragraphs_cout_ = 0;
|
||||
|
||||
run_.str(std::wstring());
|
||||
paragraph_.str(std::wstring());
|
||||
text_.str(std::wstring());
|
||||
|
||||
paragraph_style_name_ = L"";
|
||||
span_style_name_ = L"";
|
||||
|
||||
only_text = true;
|
||||
}
|
||||
std::wstring xlsx_text_context::Impl::end_only_text()
|
||||
{
|
||||
std::wstring message = dump_run();
|
||||
|
||||
paragraphs_cout_ = 0;
|
||||
|
||||
run_.str(std::wstring());
|
||||
paragraph_.str(std::wstring());
|
||||
text_.str(std::wstring());
|
||||
|
||||
paragraph_style_name_ = L"";
|
||||
span_style_name_ = L"";
|
||||
|
||||
only_text = false;
|
||||
return message;
|
||||
}
|
||||
void xlsx_text_context::Impl::start_comment_content()
|
||||
{
|
||||
paragraphs_cout_ = 0;
|
||||
@ -585,26 +618,30 @@ bool xlsx_text_context::is_drawing_context()
|
||||
{
|
||||
return impl_->is_drawing_context();
|
||||
}
|
||||
|
||||
void xlsx_text_context::start_cell_content()
|
||||
{
|
||||
return impl_->start_cell_content();
|
||||
}
|
||||
|
||||
int xlsx_text_context::end_cell_content()
|
||||
{
|
||||
return impl_->end_cell_content();
|
||||
}
|
||||
|
||||
void xlsx_text_context::start_comment_content()
|
||||
{
|
||||
return impl_->start_comment_content();
|
||||
}
|
||||
|
||||
std::wstring xlsx_text_context::end_comment_content()
|
||||
{
|
||||
return impl_->end_comment_content();
|
||||
}
|
||||
void xlsx_text_context::start_only_text()
|
||||
{
|
||||
return impl_->start_only_text();
|
||||
}
|
||||
std::wstring xlsx_text_context::end_only_text()
|
||||
{
|
||||
return impl_->end_only_text();
|
||||
}
|
||||
void xlsx_text_context::start_drawing_content()
|
||||
{
|
||||
return impl_->start_drawing_content();
|
||||
|
||||
@ -70,6 +70,9 @@ public:
|
||||
void start_cell_content();
|
||||
int end_cell_content();
|
||||
|
||||
void start_only_text();
|
||||
std::wstring end_only_text();
|
||||
|
||||
void start_comment_content();
|
||||
std::wstring end_comment_content();
|
||||
|
||||
|
||||
@ -69,12 +69,12 @@ xlsx_conversion_context::xlsx_conversion_context(odf_reader::odf_document * odfD
|
||||
xlsx_table_context_ (this, xlsx_text_context_),
|
||||
math_context_ (odf_document_->odf_context().fontContainer(), true),
|
||||
xlsx_style_ (this),
|
||||
|
||||
|
||||
maxDigitSize_ (std::make_pair(-1.f, -1.f) ),
|
||||
default_style_ ( (std::numeric_limits<size_t>::max)() ),
|
||||
mediaitems_ (odf_document_->get_folder()),
|
||||
xlsx_drawing_context_handle_(mediaitems_)
|
||||
default_style_ ( (std::numeric_limits<size_t>::max)() )
|
||||
{
|
||||
mediaitems_ = boost::make_shared<mediaitems>(odf_document_->get_folder());
|
||||
drawing_context_handle_ = boost::make_shared<xlsx_drawing_context_handle>(mediaitems_);
|
||||
}
|
||||
|
||||
std::unordered_map<std::wstring, int> xlsx_conversion_context::mapExternalLink_;
|
||||
@ -90,7 +90,16 @@ xlsx_conversion_context::~xlsx_conversion_context()
|
||||
|
||||
void xlsx_conversion_context::set_font_directory(std::wstring pathFonts)
|
||||
{
|
||||
mediaitems_.set_font_directory(pathFonts);
|
||||
mediaitems_->set_font_directory(pathFonts);
|
||||
}
|
||||
void xlsx_conversion_context::set_drawing_context_handle(xlsx_drawing_context_handle_ptr &handle)
|
||||
{
|
||||
drawing_context_handle_ = handle;
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::set_mediaitems(mediaitems_ptr &items)
|
||||
{
|
||||
mediaitems_ = items;
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::start_chart(std::wstring name)
|
||||
@ -323,8 +332,8 @@ void xlsx_conversion_context::end_document()
|
||||
output_document_->get_content_types_file().set_media(get_mediaitems());
|
||||
output_document_->get_xl_files().set_media(get_mediaitems());
|
||||
|
||||
package::xl_drawings_ptr drawings = package::xl_drawings::create(xlsx_drawing_context_handle_.content());
|
||||
output_document_->get_xl_files().set_drawings(drawings);
|
||||
package::xl_drawings_ptr drawings = package::xl_drawings::create(drawing_context_handle_->content(), drawing_context_handle_->content_vml());
|
||||
output_document_->get_xl_files().set_drawings(drawings);
|
||||
|
||||
package::xl_comments_ptr comments = package::xl_comments::create(xlsx_comments_context_handle_.content());
|
||||
output_document_->get_xl_files().set_comments(comments);
|
||||
@ -496,42 +505,37 @@ void xlsx_conversion_context::end_table()
|
||||
L"../pivotTables/pivotTable" + std::to_wstring(it->second) + L".xml"));
|
||||
}
|
||||
|
||||
if (!get_drawing_context().empty())
|
||||
if (false == get_drawing_context().empty())
|
||||
{
|
||||
std::wstringstream strm;
|
||||
get_drawing_context().serialize(strm);
|
||||
|
||||
const std::pair<std::wstring, std::wstring> drawingName
|
||||
= xlsx_drawing_context_handle_.add_drawing_xml(strm.str(), get_drawing_context().get_drawings() );
|
||||
= drawing_context_handle_->add_drawing_xml(strm.str(), get_drawing_context().get_drawings() );
|
||||
|
||||
current_sheet().set_drawing_link(drawingName.first, drawingName.second);
|
||||
|
||||
CP_XML_WRITER(current_sheet().drawing())
|
||||
{
|
||||
CP_XML_NODE(L"drawing")
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", drawingName.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
get_table_context().serialize_background (current_sheet().drawing());
|
||||
if (false == get_drawing_context().vml_empty())
|
||||
{
|
||||
std::wstringstream strm;
|
||||
get_drawing_context().serialize_vml(strm);
|
||||
|
||||
const std::pair<std::wstring, std::wstring> vml_drawingName
|
||||
= drawing_context_handle_->add_drawing_vml(strm.str(), get_drawing_context().get_drawings() );
|
||||
|
||||
if (!get_comments_context().empty())
|
||||
current_sheet().set_vml_drawing_link(vml_drawingName.first, vml_drawingName.second);
|
||||
}
|
||||
//get_table_context().serialize_background (current_sheet().picture());
|
||||
|
||||
if (false == get_comments_context().empty())
|
||||
{
|
||||
std::wstringstream strm;
|
||||
get_comments_context().serialize(strm);
|
||||
|
||||
std::wstringstream vml_strm;
|
||||
get_comments_context().serialize_vml(vml_strm);
|
||||
|
||||
|
||||
const std::pair<std::wstring, std::wstring> commentsName
|
||||
= xlsx_comments_context_handle_.add_comments_xml(strm.str(), vml_strm.str(),get_comments_context().get_comments() );
|
||||
|
||||
const std::pair<std::wstring, std::wstring> vml_drawingName
|
||||
=xlsx_comments_context_handle_.get_vml_drawing_xml();
|
||||
= xlsx_comments_context_handle_.add_comments_xml(strm.str(), get_comments_context().get_comments() );
|
||||
|
||||
current_sheet().set_comments_link(commentsName.first, commentsName.second);
|
||||
current_sheet().set_vml_drawing_link(vml_drawingName.first, vml_drawingName.second);
|
||||
}
|
||||
get_table_context().end_table();
|
||||
}
|
||||
@ -730,7 +734,7 @@ std::pair<float,float> xlsx_conversion_context::getMaxDigitSize()
|
||||
else
|
||||
font_size =10;
|
||||
|
||||
maxDigitSize_ = utils::GetMaxDigitSizePixels(font_name.c_str(), font_size, 96., 0, mediaitems_.applicationFonts());
|
||||
maxDigitSize_ = utils::GetMaxDigitSizePixels(font_name.c_str(), font_size, 96., 0, mediaitems_->applicationFonts());
|
||||
}
|
||||
return maxDigitSize_;
|
||||
}
|
||||
@ -749,9 +753,9 @@ xlsx_drawing_context & xlsx_conversion_context::get_drawing_context()
|
||||
return get_table_context().get_drawing_context();
|
||||
}
|
||||
|
||||
xlsx_drawing_context_handle & xlsx_conversion_context::get_drawing_context_handle()
|
||||
xlsx_drawing_context_handle_ptr & xlsx_conversion_context::get_drawing_context_handle()
|
||||
{
|
||||
return xlsx_drawing_context_handle_;
|
||||
return drawing_context_handle_;
|
||||
}
|
||||
xlsx_comments_context & xlsx_conversion_context::get_comments_context()
|
||||
{
|
||||
|
||||
@ -188,12 +188,16 @@ public:
|
||||
xlsx_pivots_context & get_pivots_context() { return xlsx_pivots_context_;}
|
||||
xlsx_table_metrics & get_table_metrics();
|
||||
xlsx_drawing_context & get_drawing_context();
|
||||
xlsx_drawing_context_handle & get_drawing_context_handle();
|
||||
xlsx_comments_context & get_comments_context();
|
||||
xlsx_comments_context_handle & get_comments_context_handle();
|
||||
xlsx_dataValidations_context& get_dataValidations_context() { return xlsx_dataValidations_context_;}
|
||||
|
||||
mediaitems & get_mediaitems() { return mediaitems_; }
|
||||
|
||||
xlsx_drawing_context_handle_ptr & get_drawing_context_handle();
|
||||
void set_drawing_context_handle(xlsx_drawing_context_handle_ptr &handle);
|
||||
|
||||
mediaitems_ptr & get_mediaitems() { return mediaitems_; }
|
||||
void set_mediaitems(mediaitems_ptr &items);
|
||||
|
||||
static std::unordered_map<std::wstring, int> mapExternalLink_;
|
||||
std::map<std::wstring, int> mapUsedNames_;
|
||||
@ -213,7 +217,7 @@ private:
|
||||
std::pair<float,float> maxDigitSize_;
|
||||
num_format_context num_format_context_;
|
||||
size_t default_style_;
|
||||
mediaitems mediaitems_;
|
||||
mediaitems_ptr mediaitems_;
|
||||
std::multimap<std::wstring, int> mapPivotsTableView_;
|
||||
|
||||
std::map<std::wstring, std::wstring> control_props_;
|
||||
@ -223,9 +227,9 @@ private:
|
||||
xlsx_table_context xlsx_table_context_;
|
||||
xlsx_text_context xlsx_text_context_;
|
||||
xlsx_pivots_context xlsx_pivots_context_;
|
||||
xlsx_drawing_context_handle xlsx_drawing_context_handle_;
|
||||
xlsx_comments_context_handle xlsx_comments_context_handle_;
|
||||
xlsx_dataValidations_context xlsx_dataValidations_context_;
|
||||
xlsx_drawing_context_handle_ptr drawing_context_handle_;
|
||||
|
||||
math_context math_context_;
|
||||
forms_context forms_context_;
|
||||
|
||||
@ -74,6 +74,10 @@ void abstract_xml::add_text(const std::wstring & Text)
|
||||
office_element_ptr elm = text::text::create(Text) ;
|
||||
xml_content_.push_back( elm );
|
||||
}
|
||||
|
||||
void abstract_xml::add_space(const std::wstring & Text)
|
||||
{
|
||||
office_element_ptr elm = text::text::create(Text) ;
|
||||
xml_content_.push_back( elm );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,19 +46,17 @@ public:
|
||||
static const ElementType type = type_AbstractXml;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
public:
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const;
|
||||
virtual std::wostream & xml_to_stream(std::wostream & _Wostream) const;
|
||||
|
||||
public:
|
||||
abstract_xml() {};
|
||||
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
virtual void add_space(const std::wstring & Text);
|
||||
|
||||
private:
|
||||
office_element_ptr_array xml_content_;
|
||||
};
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user