mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-11 02:16:02 +08:00
Compare commits
196 Commits
core-linux
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| 3953fd1add | |||
| d0661e871d | |||
| ec173776ea | |||
| 0a3b9fb8e9 | |||
| 097559c25e | |||
| 6a571ba1c9 | |||
| c4a46114a2 | |||
| 724335bdda | |||
| 7e85df3cc5 | |||
| 326cfbde93 | |||
| 5df8901b59 | |||
| 9c24fa2ff1 | |||
| 82dca18ebc | |||
| 86d97d050d | |||
| a6ab10d585 | |||
| 2b8efdd9b1 | |||
| 1022754391 | |||
| 2c10457a63 | |||
| e0630979c5 | |||
| 8bc8b7cf58 | |||
| 14f4364962 | |||
| 9de3cb016f | |||
| f12cd8ff8f | |||
| 436015b5d2 | |||
| c078df93c9 | |||
| e5e8e01490 | |||
| 4fcc3b4f41 | |||
| ce44e50d0e | |||
| 143590f17b | |||
| abb7a85337 | |||
| f0fe00aa3e | |||
| 98a568177d | |||
| e58f1929e1 | |||
| 2143869e69 | |||
| ac6a1a19da | |||
| fb574f1994 | |||
| f9af786d5a | |||
| 3cde3a4444 | |||
| eb2221f006 | |||
| 394d1e7b38 | |||
| d9d1473fd0 | |||
| 45ba99b9bf | |||
| 9576ce5f28 | |||
| 7092922d1b | |||
| e112c63f12 | |||
| ae9ec197f1 | |||
| af7640e736 | |||
| f467912988 | |||
| 292781e6fb | |||
| 9cd97d48b8 | |||
| 579b441edc | |||
| 63b71d256b | |||
| 90f1aa055c | |||
| d75352f1f2 | |||
| 51cbcfa9f2 | |||
| eef66b3498 | |||
| 945d43997a | |||
| b41170a233 | |||
| b64541e6bd | |||
| 5626963bdf | |||
| 5b7d637c78 | |||
| 643f117a92 | |||
| f6d38c1f1b | |||
| dd24ca837f | |||
| f555e3f821 | |||
| 503e87077b | |||
| 07a07a1abd | |||
| 30473ee9b7 | |||
| 73ef4140a2 | |||
| 8b6e5f17c8 | |||
| fcede43d99 | |||
| c37f011d6d | |||
| 52ec27a679 | |||
| a687e49a6a | |||
| 4d0e44c8b6 | |||
| 4dddc6d9bc | |||
| b6b79576a1 | |||
| 1c1223b148 | |||
| 9947f058a9 | |||
| 54f55ad2ac | |||
| e4edb9cca4 | |||
| 8bb23e9ce1 | |||
| aacea2f015 | |||
| 1475b2fef9 | |||
| 8e58975095 | |||
| 04550f06ad | |||
| d2b6444730 | |||
| 08738092c6 | |||
| 8e220427eb | |||
| 962c31dc2a | |||
| d12cc81745 | |||
| 988423f6e0 | |||
| 2b096f0977 | |||
| 7c0962f834 | |||
| 17423cdcdb | |||
| 5dc512dc3b | |||
| 1393073694 | |||
| 7da761a009 | |||
| e21e0afb45 | |||
| 626eb87203 | |||
| 5b0dad3d99 | |||
| 9d3b7b91af | |||
| f40d82a097 | |||
| 9112c87b1f | |||
| 01691950b9 | |||
| 78bbaecefe | |||
| 9e085c5ae8 | |||
| f55cafa2af | |||
| 17bc27199c | |||
| ee4167ec8c | |||
| e436c13fcc | |||
| 8e2c980152 | |||
| 658bfbc348 | |||
| ff9ef8f941 | |||
| 0a2401471e | |||
| 5ca5597c58 | |||
| e55dc5ea75 | |||
| e2db849b03 | |||
| fef30772fd | |||
| 23ba8a23a4 | |||
| 866af012eb | |||
| 4df09fd25a | |||
| 8bae2e3255 | |||
| 6180fedb0b | |||
| 35113a76ca | |||
| 5895bc9641 | |||
| a5a6686501 | |||
| f776bb6c4e | |||
| 4c930e716b | |||
| 595ecae254 | |||
| 8d3e50f8c0 | |||
| 2439106397 | |||
| 8953b74579 | |||
| bd7978e474 | |||
| 95238af0f5 | |||
| e83daf6c91 | |||
| a4cade5a58 | |||
| 4fb284ebee | |||
| 900ed115c7 | |||
| d34b850c52 | |||
| cc31becec1 | |||
| 24332cca42 | |||
| 9b5f052c97 | |||
| 2017a8c692 | |||
| 55e7777abb | |||
| b7c8bc2769 | |||
| 13900daf08 | |||
| 2feb1ac8e8 | |||
| 558c669fb6 | |||
| 6268e8c3f3 | |||
| d872f4220c | |||
| 3c24392e16 | |||
| e859821647 | |||
| 5c1a2f11f9 | |||
| f7a13e04d8 | |||
| 18cbd41c84 | |||
| c6e47a7bcf | |||
| 62d6581c43 | |||
| 2d0e5aefa0 | |||
| 78a5546d0a | |||
| 8985395ef1 | |||
| f55a5418e9 | |||
| 9410862444 | |||
| f4d72572c0 | |||
| f078605031 | |||
| 9105894416 | |||
| 1102f7f9b0 | |||
| 9aad3d1adb | |||
| bc319bddbf | |||
| 8d664c2a4f | |||
| cbfa907451 | |||
| 0712bcfd5c | |||
| 474873531d | |||
| 8625e93ac5 | |||
| fb79df8c6c | |||
| 071ad3f86e | |||
| 65bcdb3bea | |||
| f9f26e84fd | |||
| a3888a8186 | |||
| 1493e4a949 | |||
| 85bf4b8fac | |||
| 94ec819e68 | |||
| cb7c7cb4d5 | |||
| b1b911b538 | |||
| d94595f755 | |||
| 2192bff46b | |||
| c7eb16fa64 | |||
| d9922e4782 | |||
| 6ee7d79cc4 | |||
| 332348ef5b | |||
| e4e6acd1bc | |||
| 7418b2327a | |||
| 18d610e3e0 | |||
| 1955dc98df | |||
| 158692f824 | |||
| 94548131a1 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -47,6 +47,8 @@ ASCOfficeXlsFile2/win32/_ASCOfficeXlsFile2_p.c
|
||||
ASCOfficeXlsFile2/win32/dlldata.c
|
||||
OfficeUtils/win32/OfficeUtilsLib/OfficeUtilsLib/ReadMe.txt
|
||||
X2tConverter/**/Makefile.*
|
||||
X2tConverter/ASCOfficePPTXFile/PPTXLib/Linux/PPTXFormatLib/Makefile
|
||||
X2tConverter/Common/DocxFormat/DocxFormatLib/Makefile
|
||||
*.7z
|
||||
*.obj
|
||||
*.pdb
|
||||
|
||||
@ -55,6 +55,7 @@
|
||||
#include "../../Common/DocxFormat/Source/Base/Types_32.h"
|
||||
#include "../../DesktopEditor/common/Types.h"
|
||||
#include "../../Common/DocxFormat/Source/Base/unicode_util.h"
|
||||
#include "../../Common/DocxFormat/Source/Base/Types_32.h"
|
||||
#include "../../UnicodeConverter/UnicodeConverter.h"
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
@ -484,6 +484,266 @@ namespace DocFileFormat
|
||||
return result_cp;
|
||||
}
|
||||
|
||||
void DocumentMapping::writeField(const std::wstring& sFieldString, int cpFieldStart, int cpFieldEnd)
|
||||
{
|
||||
_fieldLevels.push_back(fieldLevels());
|
||||
|
||||
std::vector<std::wstring> arField;
|
||||
boost::algorithm::split(arField, sFieldString, boost::algorithm::is_any_of(L"\\"), boost::algorithm::token_compress_on);
|
||||
|
||||
std::wstring f;
|
||||
std::wstring EMBED ( L"EMBED" );
|
||||
std::wstring embed ( L"embed" );
|
||||
std::wstring LINK ( L"LINK" );
|
||||
std::wstring FORM ( L"FORM" );
|
||||
std::wstring Excel ( L"Excel" );
|
||||
std::wstring Word ( L"Word" );
|
||||
std::wstring opendocument(L"opendocument" );
|
||||
std::wstring Equation ( L"Equation" );
|
||||
std::wstring MERGEFORMAT( L"MERGEFORMAT" );
|
||||
std::wstring QUOTE ( L"QUOTE" );
|
||||
std::wstring chart ( L"Chart" );
|
||||
std::wstring PBrush ( L"PBrush" );
|
||||
std::wstring TOC ( L"TOC" );
|
||||
std::wstring HYPERLINK ( L"HYPERLINK" );
|
||||
std::wstring PAGEREF ( L"PAGEREF" );
|
||||
std::wstring PAGE ( L"PAGE" );
|
||||
std::wstring SHAPE ( L"SHAPE" );
|
||||
|
||||
if (arField.empty() == false)
|
||||
f = arField[0];
|
||||
else
|
||||
f = sFieldString;
|
||||
|
||||
bool bChart = search( f.begin(), f.end(), chart.begin(), chart.end()) != f.end();
|
||||
bool bEMBED = search( f.begin(), f.end(), EMBED.begin(), EMBED.end()) != f.end() ||
|
||||
search( f.begin(), f.end(), embed.begin(), embed.end()) != f.end();
|
||||
bool bLINK = search( f.begin(), f.end(), LINK.begin(), LINK.end()) != f.end();
|
||||
bool bOpendocument = search( f.begin(), f.end(), opendocument.begin(), opendocument.end()) != f.end();
|
||||
bool bFORM = search( f.begin(), f.end(), FORM.begin(), FORM.end()) != f.end();
|
||||
bool bMERGEFORMAT = search( f.begin(), f.end(), MERGEFORMAT.begin(), MERGEFORMAT.end()) != f.end();
|
||||
bool bExcel = search( f.begin(), f.end(), Excel.begin(), Excel.end()) != f.end();
|
||||
bool bWord = search( f.begin(), f.end(), Word.begin(), Word.end()) != f.end();
|
||||
bool bHYPERLINK = search( f.begin(), f.end(), HYPERLINK.begin(), HYPERLINK.end()) != f.end();
|
||||
bool bQUOTE = search( f.begin(), f.end(), QUOTE.begin(), QUOTE.end()) != f.end();
|
||||
bool bEquation = search( f.begin(), f.end(), Equation.begin(), Equation.end()) != f.end();
|
||||
bool bPAGE = search( f.begin(), f.end(), PAGE.begin(), PAGE.end()) != f.end();
|
||||
bool bTOC = search( f.begin(), f.end(), TOC.begin(), TOC.end()) != f.end();
|
||||
bool bSHAPE = search( f.begin(), f.end(), SHAPE.begin(), SHAPE.end()) != f.end();
|
||||
|
||||
bool bPAGEREF = false;
|
||||
if (bHYPERLINK && arField.size() > 1)
|
||||
{
|
||||
std::wstring f1 = arField[1];
|
||||
bPAGEREF = search( f1.begin(), f1.end(), PAGEREF.begin(), PAGEREF.end()) != f1.end();
|
||||
}
|
||||
|
||||
if (bTOC)
|
||||
_bContentWrite = true;
|
||||
|
||||
if ( bFORM )
|
||||
{
|
||||
std::wstring FORMTEXT ( L" FORMTEXT" );
|
||||
std::wstring FORMCHECKBOX ( L" FORMCHECKBOX" );
|
||||
std::wstring FORMDROPDOWN ( L" FORMDROPDOWN" );
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:fldChar" , true );
|
||||
m_pXmlWriter->WriteAttribute( L"w:fldCharType" , L"begin" );
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true, false );
|
||||
|
||||
bool bFORMTEXT = search( f.begin(), f.end(), FORMTEXT.begin(), FORMTEXT.end()) != f.end();
|
||||
bool bFORMCHECKBOX = search( f.begin(), f.end(), FORMCHECKBOX.begin(), FORMCHECKBOX.end()) != f.end();
|
||||
bool bFORMDROPDOWN = search( f.begin(), f.end(), FORMDROPDOWN.begin(), FORMDROPDOWN.end()) != f.end();
|
||||
|
||||
if (bFORMTEXT || bFORMCHECKBOX || bFORMDROPDOWN)
|
||||
{
|
||||
int cpPic = searchNextTextMark( m_document->Text, cpFieldStart, TextMark::Picture );
|
||||
if (cpPic < cpFieldEnd)
|
||||
{
|
||||
int fcPic = m_document->FindFileCharPos( cpPic );
|
||||
std::list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions(fcPic, fcPic + 1);
|
||||
|
||||
if (chpxs)
|
||||
{
|
||||
CharacterPropertyExceptions* chpxSep = chpxs->front();
|
||||
|
||||
FormFieldData ffdata (2, chpxSep, m_document->DataStream, false);
|
||||
FormFieldDataMapping data_mapping(m_pXmlWriter, m_context, _caller);
|
||||
ffdata.Convert(&data_mapping);
|
||||
|
||||
RELEASEOBJECT( chpxs );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"w:fldChar" );
|
||||
|
||||
_fieldLevels.back().bBegin = true;
|
||||
}
|
||||
else if ( ( bMERGEFORMAT || bExcel || bWord || bOpendocument )
|
||||
&&
|
||||
( ( bEMBED || bLINK ) && bChart) )
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:fldChar", true );
|
||||
m_pXmlWriter->WriteAttribute( L"w:fldCharType", L"begin" );
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true, false );
|
||||
|
||||
int cpPic = searchNextTextMark( m_document->Text, cpFieldStart, TextMark::Picture );
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"w:fldChar" );
|
||||
|
||||
_fieldLevels.back().bBegin = true;
|
||||
}
|
||||
else if (bHYPERLINK && bPAGEREF)
|
||||
{
|
||||
int cpFieldSep2 = cpFieldStart, cpFieldSep1 = cpFieldStart;
|
||||
std::vector<std::wstring> toc;
|
||||
|
||||
if (arField.size() > 1)
|
||||
f = arField[1];
|
||||
|
||||
if ( _bContentWrite )
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:fldChar", true );
|
||||
m_pXmlWriter->WriteAttribute( L"w:fldCharType", L"begin" );
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true );
|
||||
|
||||
_fieldLevels.back().bBegin = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t i = 1; i < arField.size(); i++)
|
||||
{
|
||||
std::wstring f1 = arField[1];
|
||||
int d = (int)f1.find(PAGEREF);
|
||||
|
||||
if (d > 0)
|
||||
{
|
||||
_writeWebHidden = true;
|
||||
std::wstring _writeTocLink =f1.substr(d + 9);
|
||||
d = (int)_writeTocLink.find(L" ");
|
||||
_writeTocLink = _writeTocLink.substr(0, d);
|
||||
|
||||
_writeAfterRun = std::wstring (L"<w:hyperlink w:anchor = \"");
|
||||
_writeAfterRun += _writeTocLink;
|
||||
_writeAfterRun += std::wstring (L"\" w:history=\"1\">");
|
||||
|
||||
break;
|
||||
//cp = cpFieldSep1;
|
||||
}
|
||||
//cpFieldSep1 = cpFieldSep2;
|
||||
}
|
||||
_skipRuns = 5; //with separator
|
||||
}
|
||||
}
|
||||
else if ( bEMBED || (bLINK && !bHYPERLINK)|| bQUOTE)
|
||||
{
|
||||
int cpPic = searchNextTextMark(m_document->Text, cpFieldStart, TextMark::Picture);
|
||||
int cpFieldSep = searchNextTextMark(m_document->Text, cpFieldStart, TextMark::FieldSeparator);
|
||||
|
||||
if (cpPic < cpFieldEnd)
|
||||
{
|
||||
int fcPic = m_document->FindFileCharPos( cpPic );
|
||||
std::list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions(fcPic, fcPic + 1);
|
||||
|
||||
CharacterPropertyExceptions* chpxObj = chpxs->front();
|
||||
|
||||
RevisionData oData = RevisionData(chpxObj);
|
||||
|
||||
CharacterPropertiesMapping* rPr = new CharacterPropertiesMapping(m_pXmlWriter, m_document, &oData, _lastValidPapx, false);
|
||||
if(rPr)
|
||||
{
|
||||
chpxObj->Convert(rPr);
|
||||
RELEASEOBJECT(rPr);
|
||||
}
|
||||
XMLTools::CStringXmlWriter oleWriter;
|
||||
XMLTools::CStringXmlWriter oleObjectWriter;
|
||||
|
||||
VMLPictureMapping oVmlMapper (m_context, &oleWriter, true, _caller);
|
||||
|
||||
if (!m_shapeIdOwner.empty()) //4571833.doc
|
||||
oVmlMapper.m_shapeId = m_shapeIdOwner;
|
||||
|
||||
if (m_document->nWordVersion > 0)
|
||||
{
|
||||
OleObject ole ( chpxObj, m_document);
|
||||
|
||||
oleWriter.WriteNodeBegin (L"w:object", true);
|
||||
oleWriter.WriteAttribute( L"w:dxaOrig", FormatUtils::IntToWideString( ( ole.pictureDesciptor.dxaGoal + ole.pictureDesciptor.dxaOrigin ) ));
|
||||
oleWriter.WriteAttribute( L"w:dyaOrig", FormatUtils::IntToWideString( ( ole.pictureDesciptor.dyaGoal + ole.pictureDesciptor.dyaOrigin ) ));
|
||||
oleWriter.WriteNodeEnd( L"", true, false );
|
||||
|
||||
ole.pictureDesciptor.Convert(&oVmlMapper);
|
||||
OleObjectMapping oleObjectMapping( &oleObjectWriter, m_context, &ole.pictureDesciptor, _caller, oVmlMapper.m_shapeId);
|
||||
|
||||
ole.Convert( &oleObjectMapping );
|
||||
|
||||
_lastOLEObject = oleObjectWriter.GetXmlString();
|
||||
}
|
||||
else
|
||||
{
|
||||
PictureDescriptor pic(chpxObj, m_document->DataStream, 0x7fffffff, m_document->nWordVersion);
|
||||
|
||||
oleWriter.WriteNodeBegin (L"w:object", true);
|
||||
oleWriter.WriteAttribute( L"w:dxaOrig", FormatUtils::IntToWideString( ( pic.dxaGoal + pic.dxaOrigin ) ) );
|
||||
oleWriter.WriteAttribute( L"w:dyaOrig", FormatUtils::IntToWideString( ( pic.dyaGoal + pic.dyaOrigin ) ) );
|
||||
oleWriter.WriteNodeEnd( L"", true, false );
|
||||
|
||||
pic.Convert(&oVmlMapper);
|
||||
RELEASEOBJECT(chpxs);
|
||||
|
||||
if ( cpFieldSep < cpFieldEnd && m_document->m_PieceTable)
|
||||
{
|
||||
int fcFieldSep = m_document->m_PieceTable->FileCharacterPositions->operator []( cpFieldSep );
|
||||
int fcFieldSep1 = m_document->FindFileCharPos( cpFieldSep );
|
||||
|
||||
std::list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions( fcFieldSep, ( fcFieldSep + 1 ) );
|
||||
CharacterPropertyExceptions* chpxSep = chpxs->front();
|
||||
|
||||
OleObject ole ( chpxSep, m_document);
|
||||
OleObjectMapping oleObjectMapping( &oleObjectWriter, m_context, &pic, _caller, oVmlMapper.m_shapeId );
|
||||
|
||||
if (oVmlMapper.m_isEmbedded)
|
||||
{
|
||||
ole.isEquation = oVmlMapper.m_isEquation;
|
||||
ole.isEmbedded = oVmlMapper.m_isEmbedded;
|
||||
ole.emeddedData = oVmlMapper.m_embeddedData;
|
||||
}
|
||||
ole.Convert( &oleObjectMapping );
|
||||
|
||||
_lastOLEObject = oleObjectWriter.GetXmlString();
|
||||
|
||||
RELEASEOBJECT( chpxs );
|
||||
}
|
||||
}
|
||||
oleWriter.WriteString( _lastOLEObject );
|
||||
oleWriter.WriteNodeEnd( L"w:object" );
|
||||
|
||||
if (!oVmlMapper.m_isEmbedded && oVmlMapper.m_isEquation)
|
||||
{
|
||||
//нельзя в Run писать oMath
|
||||
//m_pXmlWriter->WriteString(oVmlMapper.m_equationXml);
|
||||
_writeAfterRun = oVmlMapper.m_equationXml;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pXmlWriter->WriteString(oleWriter.GetXmlString());
|
||||
}
|
||||
}
|
||||
|
||||
_skipRuns = 3;
|
||||
_embeddedObject = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:fldChar", true );
|
||||
m_pXmlWriter->WriteAttribute( L"w:fldCharType", L"begin" );
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true );
|
||||
|
||||
_fieldLevels.back().bBegin = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Writes the given text to the document
|
||||
int DocumentMapping::writeText(std::vector<wchar_t>* chars, int initialCp, CharacterPropertyExceptions* chpx, bool writeDeletedText)
|
||||
{
|
||||
@ -576,289 +836,15 @@ namespace DocFileFormat
|
||||
}
|
||||
else if (TextMark::FieldBeginMark == code)
|
||||
{
|
||||
_fieldLevels.push_back(fieldLevels());
|
||||
|
||||
int cpFieldStart = initialCp + i;
|
||||
int cpFieldEnd = searchNextTextMark( m_document->Text, cpFieldStart, TextMark::FieldEndMark );
|
||||
|
||||
std::wstring f, sFieldString;
|
||||
std::wstring sFieldString;
|
||||
if (cpFieldEnd < (int)m_document->Text->size())
|
||||
sFieldString = std::wstring( ( m_document->Text->begin() + cpFieldStart ), ( m_document->Text->begin() + cpFieldEnd + 1 ) );
|
||||
|
||||
std::vector<std::wstring> arField;
|
||||
boost::algorithm::split(arField, sFieldString, boost::algorithm::is_any_of(L"\\"), boost::algorithm::token_compress_on);
|
||||
|
||||
std::wstring EMBED ( L"EMBED" );
|
||||
std::wstring embed ( L"embed" );
|
||||
std::wstring LINK ( L"LINK" );
|
||||
std::wstring FORM ( L"FORM" );
|
||||
std::wstring Excel ( L"Excel" );
|
||||
std::wstring Word ( L"Word" );
|
||||
std::wstring opendocument(L"opendocument" );
|
||||
std::wstring Equation ( L"Equation" );
|
||||
std::wstring MERGEFORMAT( L"MERGEFORMAT" );
|
||||
std::wstring QUOTE ( L"QUOTE" );
|
||||
std::wstring chart ( L"Chart" );
|
||||
std::wstring PBrush ( L"PBrush" );
|
||||
std::wstring TOC ( L"TOC" );
|
||||
std::wstring HYPERLINK ( L"HYPERLINK" );
|
||||
std::wstring PAGEREF ( L"PAGEREF" );
|
||||
std::wstring PAGE ( L"PAGE" );
|
||||
std::wstring SHAPE ( L"SHAPE" );
|
||||
writeField(sFieldString, cpFieldStart, cpFieldEnd);
|
||||
|
||||
if (arField.empty() == false)
|
||||
f = arField[0];
|
||||
else
|
||||
f = sFieldString;
|
||||
|
||||
bool bChart = search( f.begin(), f.end(), chart.begin(), chart.end()) != f.end();
|
||||
bool bEMBED = search( f.begin(), f.end(), EMBED.begin(), EMBED.end()) != f.end() ||
|
||||
search( f.begin(), f.end(), embed.begin(), embed.end()) != f.end();
|
||||
bool bLINK = search( f.begin(), f.end(), LINK.begin(), LINK.end()) != f.end();
|
||||
bool bOpendocument = search( f.begin(), f.end(), opendocument.begin(), opendocument.end()) != f.end();
|
||||
bool bFORM = search( f.begin(), f.end(), FORM.begin(), FORM.end()) != f.end();
|
||||
bool bMERGEFORMAT = search( f.begin(), f.end(), MERGEFORMAT.begin(), MERGEFORMAT.end()) != f.end();
|
||||
bool bExcel = search( f.begin(), f.end(), Excel.begin(), Excel.end()) != f.end();
|
||||
bool bWord = search( f.begin(), f.end(), Word.begin(), Word.end()) != f.end();
|
||||
bool bHYPERLINK = search( f.begin(), f.end(), HYPERLINK.begin(), HYPERLINK.end()) != f.end();
|
||||
bool bQUOTE = search( f.begin(), f.end(), QUOTE.begin(), QUOTE.end()) != f.end();
|
||||
bool bEquation = search( f.begin(), f.end(), Equation.begin(), Equation.end()) != f.end();
|
||||
bool bPAGE = search( f.begin(), f.end(), PAGE.begin(), PAGE.end()) != f.end();
|
||||
bool bTOC = search( f.begin(), f.end(), TOC.begin(), TOC.end()) != f.end();
|
||||
bool bSHAPE = search( f.begin(), f.end(), SHAPE.begin(), SHAPE.end()) != f.end();
|
||||
|
||||
bool bPAGEREF = false;
|
||||
if (bHYPERLINK && arField.size() > 1)
|
||||
{
|
||||
std::wstring f1 = arField[1];
|
||||
bPAGEREF = search( f1.begin(), f1.end(), PAGEREF.begin(), PAGEREF.end()) != f1.end();
|
||||
}
|
||||
|
||||
if (bTOC)
|
||||
_bContentWrite = true;
|
||||
|
||||
if ( bFORM )
|
||||
{
|
||||
std::wstring FORMTEXT ( L" FORMTEXT" );
|
||||
std::wstring FORMCHECKBOX ( L" FORMCHECKBOX" );
|
||||
std::wstring FORMDROPDOWN ( L" FORMDROPDOWN" );
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:fldChar" , true );
|
||||
m_pXmlWriter->WriteAttribute( L"w:fldCharType" , L"begin" );
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true, false );
|
||||
|
||||
bool bFORMTEXT = search( f.begin(), f.end(), FORMTEXT.begin(), FORMTEXT.end()) != f.end();
|
||||
bool bFORMCHECKBOX = search( f.begin(), f.end(), FORMCHECKBOX.begin(), FORMCHECKBOX.end()) != f.end();
|
||||
bool bFORMDROPDOWN = search( f.begin(), f.end(), FORMDROPDOWN.begin(), FORMDROPDOWN.end()) != f.end();
|
||||
|
||||
if (bFORMTEXT || bFORMCHECKBOX || bFORMDROPDOWN)
|
||||
{
|
||||
int cpPic = searchNextTextMark( m_document->Text, cpFieldStart, TextMark::Picture );
|
||||
if (cpPic < cpFieldEnd)
|
||||
{
|
||||
int fcPic = m_document->FindFileCharPos( cpPic );
|
||||
std::list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions(fcPic, fcPic + 1);
|
||||
|
||||
if (chpxs)
|
||||
{
|
||||
CharacterPropertyExceptions* chpxSep = chpxs->front();
|
||||
|
||||
FormFieldData ffdata (2, chpxSep, m_document->DataStream, false);
|
||||
FormFieldDataMapping data_mapping(m_pXmlWriter, m_context, _caller);
|
||||
ffdata.Convert(&data_mapping);
|
||||
|
||||
RELEASEOBJECT( chpxs );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"w:fldChar" );
|
||||
|
||||
_fieldLevels.back().bBegin = true;
|
||||
}
|
||||
else if ( ( bMERGEFORMAT || bExcel || bWord || bOpendocument )
|
||||
&&
|
||||
( ( bEMBED || bLINK ) && bChart) )
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:fldChar", true );
|
||||
m_pXmlWriter->WriteAttribute( L"w:fldCharType", L"begin" );
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true, false );
|
||||
|
||||
int cpPic = searchNextTextMark( m_document->Text, cpFieldStart, TextMark::Picture );
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"w:fldChar" );
|
||||
|
||||
_fieldLevels.back().bBegin = true;
|
||||
}
|
||||
else if (bHYPERLINK && bPAGEREF)
|
||||
{
|
||||
int cpFieldSep2 = cpFieldStart, cpFieldSep1 = cpFieldStart;
|
||||
std::vector<std::wstring> toc;
|
||||
|
||||
if (arField.size() > 1)
|
||||
f = arField[1];
|
||||
|
||||
if ( _bContentWrite )
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:fldChar", true );
|
||||
m_pXmlWriter->WriteAttribute( L"w:fldCharType", L"begin" );
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true );
|
||||
|
||||
_fieldLevels.back().bBegin = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t i = 1; i < arField.size(); i++)
|
||||
{
|
||||
std::wstring f1 = arField[1];
|
||||
int d = (int)f1.find(PAGEREF);
|
||||
|
||||
if (d > 0)
|
||||
{
|
||||
_writeWebHidden = true;
|
||||
std::wstring _writeTocLink =f1.substr(d + 9);
|
||||
d = (int)_writeTocLink.find(L" ");
|
||||
_writeTocLink = _writeTocLink.substr(0, d);
|
||||
|
||||
_writeAfterRun = std::wstring (L"<w:hyperlink w:anchor = \"");
|
||||
_writeAfterRun += _writeTocLink;
|
||||
_writeAfterRun += std::wstring (L"\" w:history=\"1\">");
|
||||
|
||||
break;
|
||||
//cp = cpFieldSep1;
|
||||
}
|
||||
//cpFieldSep1 = cpFieldSep2;
|
||||
}
|
||||
_skipRuns = 5; //with separator
|
||||
}
|
||||
}
|
||||
//else if ( bHYPERLINK )
|
||||
//{//todooo - выделение гиперссылки отдельно
|
||||
// std::vector<std::wstring> arRefs;
|
||||
// boost::algorithm::split(arRefs, f, boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on);
|
||||
//
|
||||
// std::wstring sLink = arRefs[2];
|
||||
// m_pXmlWriter->WriteNodeBegin( L"w:hyperlink", true );
|
||||
|
||||
// int relID = m_context->_docx->RegisterHyperlink(_caller, sLink);
|
||||
// m_pXmlWriter->WriteAttribute( L"r:id", L"rId"+ FormatUtils::IntToWideString( relID ) );
|
||||
// m_pXmlWriter->WriteAttribute( L"w:history", 1 );
|
||||
// m_pXmlWriter->WriteNodeEnd( L"", true, false );
|
||||
|
||||
// if (arRefs.size() > 2)
|
||||
// {
|
||||
// writeTextElement(arRefs[3].substr(1, arRefs[3].length() - 2), textType);
|
||||
// }
|
||||
// m_pXmlWriter->WriteNodeEnd( L"w:hyperlink", false, true );
|
||||
|
||||
// _skipRuns = 1;
|
||||
//}
|
||||
else if ( bEMBED || (bLINK && !bHYPERLINK)|| bQUOTE)
|
||||
{
|
||||
int cpPic = searchNextTextMark(m_document->Text, cpFieldStart, TextMark::Picture);
|
||||
int cpFieldSep = searchNextTextMark(m_document->Text, cpFieldStart, TextMark::FieldSeparator);
|
||||
|
||||
if (cpPic < cpFieldEnd)
|
||||
{
|
||||
int fcPic = m_document->FindFileCharPos( cpPic );
|
||||
std::list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions(fcPic, fcPic + 1);
|
||||
|
||||
CharacterPropertyExceptions* chpxObj = chpxs->front();
|
||||
|
||||
RevisionData oData = RevisionData(chpxObj);
|
||||
|
||||
CharacterPropertiesMapping* rPr = new CharacterPropertiesMapping(m_pXmlWriter, m_document, &oData, _lastValidPapx, false);
|
||||
if(rPr)
|
||||
{
|
||||
chpxObj->Convert(rPr);
|
||||
RELEASEOBJECT(rPr);
|
||||
}
|
||||
XMLTools::CStringXmlWriter oleWriter;
|
||||
XMLTools::CStringXmlWriter oleObjectWriter;
|
||||
|
||||
VMLPictureMapping oVmlMapper (m_context, &oleWriter, true, _caller);
|
||||
|
||||
if (!m_shapeIdOwner.empty()) //4571833.doc
|
||||
oVmlMapper.m_shapeId = m_shapeIdOwner;
|
||||
|
||||
if (m_document->nWordVersion > 0)
|
||||
{
|
||||
OleObject ole ( chpxObj, m_document);
|
||||
|
||||
oleWriter.WriteNodeBegin (L"w:object", true);
|
||||
oleWriter.WriteAttribute( L"w:dxaOrig", FormatUtils::IntToWideString( ( ole.pictureDesciptor.dxaGoal + ole.pictureDesciptor.dxaOrigin ) ));
|
||||
oleWriter.WriteAttribute( L"w:dyaOrig", FormatUtils::IntToWideString( ( ole.pictureDesciptor.dyaGoal + ole.pictureDesciptor.dyaOrigin ) ));
|
||||
oleWriter.WriteNodeEnd( L"", true, false );
|
||||
|
||||
ole.pictureDesciptor.Convert(&oVmlMapper);
|
||||
OleObjectMapping oleObjectMapping( &oleObjectWriter, m_context, &ole.pictureDesciptor, _caller, oVmlMapper.m_shapeId);
|
||||
|
||||
ole.Convert( &oleObjectMapping );
|
||||
|
||||
_lastOLEObject = oleObjectWriter.GetXmlString();
|
||||
}
|
||||
else
|
||||
{
|
||||
PictureDescriptor pic(chpxObj, m_document->DataStream, 0x7fffffff, m_document->nWordVersion);
|
||||
|
||||
oleWriter.WriteNodeBegin (L"w:object", true);
|
||||
oleWriter.WriteAttribute( L"w:dxaOrig", FormatUtils::IntToWideString( ( pic.dxaGoal + pic.dxaOrigin ) ) );
|
||||
oleWriter.WriteAttribute( L"w:dyaOrig", FormatUtils::IntToWideString( ( pic.dyaGoal + pic.dyaOrigin ) ) );
|
||||
oleWriter.WriteNodeEnd( L"", true, false );
|
||||
|
||||
pic.Convert(&oVmlMapper);
|
||||
RELEASEOBJECT(chpxs);
|
||||
|
||||
if ( cpFieldSep < cpFieldEnd && m_document->m_PieceTable)
|
||||
{
|
||||
int fcFieldSep = m_document->m_PieceTable->FileCharacterPositions->operator []( cpFieldSep );
|
||||
int fcFieldSep1 = m_document->FindFileCharPos( cpFieldSep );
|
||||
|
||||
std::list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions( fcFieldSep, ( fcFieldSep + 1 ) );
|
||||
CharacterPropertyExceptions* chpxSep = chpxs->front();
|
||||
|
||||
OleObject ole ( chpxSep, m_document);
|
||||
OleObjectMapping oleObjectMapping( &oleObjectWriter, m_context, &pic, _caller, oVmlMapper.m_shapeId );
|
||||
|
||||
if (oVmlMapper.m_isEmbedded)
|
||||
{
|
||||
ole.isEquation = oVmlMapper.m_isEquation;
|
||||
ole.isEmbedded = oVmlMapper.m_isEmbedded;
|
||||
ole.emeddedData = oVmlMapper.m_embeddedData;
|
||||
}
|
||||
ole.Convert( &oleObjectMapping );
|
||||
|
||||
_lastOLEObject = oleObjectWriter.GetXmlString();
|
||||
|
||||
RELEASEOBJECT( chpxs );
|
||||
}
|
||||
}
|
||||
oleWriter.WriteString( _lastOLEObject );
|
||||
oleWriter.WriteNodeEnd( L"w:object" );
|
||||
|
||||
if (!oVmlMapper.m_isEmbedded && oVmlMapper.m_isEquation)
|
||||
{
|
||||
//нельзя в Run писать oMath
|
||||
//m_pXmlWriter->WriteString(oVmlMapper.m_equationXml);
|
||||
_writeAfterRun = oVmlMapper.m_equationXml;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pXmlWriter->WriteString(oleWriter.GetXmlString());
|
||||
}
|
||||
}
|
||||
|
||||
_skipRuns = 3;
|
||||
_embeddedObject = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:fldChar", true );
|
||||
m_pXmlWriter->WriteAttribute( L"w:fldCharType", L"begin" );
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true );
|
||||
|
||||
_fieldLevels.back().bBegin = true;
|
||||
}
|
||||
}
|
||||
else if (TextMark::FieldSeparator == code)
|
||||
{
|
||||
@ -1006,6 +992,11 @@ namespace DocFileFormat
|
||||
_writeAfterRun = oVmlMapper.m_equationXml;
|
||||
bFormula = true;
|
||||
}
|
||||
else if (oVmlMapper.m_isBlob)
|
||||
{
|
||||
_writeAfterRun = oVmlMapper.m_blobXml;
|
||||
bFormula = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1042,7 +1033,7 @@ namespace DocFileFormat
|
||||
else if ((m_document->EndnoteReferenceCharactersPlex != NULL) && (m_document->EndnoteReferenceCharactersPlex->IsCpExists(cp)))
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:endnoteReference", true );
|
||||
EndnoteDescriptor* desc = dynamic_cast<EndnoteDescriptor*>(m_document->EndnoteReferenceCharactersPlex->Elements[_footnoteNr]);
|
||||
EndnoteDescriptor* desc = dynamic_cast<EndnoteDescriptor*>(m_document->EndnoteReferenceCharactersPlex->Elements[_endnoteNr]);
|
||||
if (desc && desc->aEndIdx == 0)
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:customMarkFollows", L"1");
|
||||
@ -1078,7 +1069,21 @@ namespace DocFileFormat
|
||||
|
||||
cp++;
|
||||
}
|
||||
if (std::wstring::npos != text.find(L"EMBED"))
|
||||
{//если есть мааркер конца поля и маркер замещающей картинки и нету маркера начала
|
||||
//О реорганизации территориальных органов ПФР с 01.11.2018.doc
|
||||
int cpFieldStart = initialCp;
|
||||
int cpPic = searchNextTextMark(m_document->Text, cpFieldStart, TextMark::Picture);
|
||||
int cpFieldEnd = searchNextTextMark( m_document->Text, cpFieldStart, TextMark::FieldEndMark );
|
||||
|
||||
bool bStartField = _fieldLevels.empty() ? false : (_fieldLevels.back().bBegin && !_fieldLevels.back().bSeparate);
|
||||
|
||||
if (cpFieldStart < cpPic && cpPic < cpFieldEnd && !bStartField)
|
||||
{
|
||||
writeField(text, cpFieldStart, cpFieldEnd);
|
||||
text.clear();
|
||||
}
|
||||
}
|
||||
if (!text.empty())
|
||||
{
|
||||
//bool preserve_space = (text.find(L"\x20")) != text.npos) ? true : false;
|
||||
@ -1348,6 +1353,8 @@ namespace DocFileFormat
|
||||
{
|
||||
iTap_current = FormatUtils::BytesToUInt32( iter->Arguments, 0, iter->argumentsSize );
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (nestingLevel == iTap_current)
|
||||
@ -1377,6 +1384,8 @@ namespace DocFileFormat
|
||||
|
||||
AddBoundary(boundary2, max_boundary, boundaries);
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,21 +85,17 @@ namespace DocFileFormat
|
||||
int getCurrentSection (int cp);
|
||||
//---------------------------------
|
||||
bool isSectionEnd ( int cp );
|
||||
// Writes a Paragraph that starts at the given cp and
|
||||
// ends at the next paragraph end mark or section end mark
|
||||
|
||||
int writeParagraph( int cp, int cpEnd );
|
||||
// Writes a Paragraph that starts at the given cpStart and
|
||||
// ends at the given cpEnd
|
||||
int writeParagraph( int initialCp, int cpEnd, bool sectionEnd, bool lastBad = false );
|
||||
// Writes a Paragraph RSID
|
||||
void writeParagraphRsid( const ParagraphPropertyExceptions* papx );
|
||||
// Writes a run with the given characters and CHPX
|
||||
int writeRun( std::vector<wchar_t>* chars, CharacterPropertyExceptions* chpx, int initialCp );
|
||||
// Writes the given text to the document
|
||||
int writeText ( std::vector<wchar_t>* chars, int initialCp, CharacterPropertyExceptions* chpx, bool writeDeletedText );
|
||||
int writeText ( std::vector<wchar_t>* chars, int initialCp, CharacterPropertyExceptions* chpx, bool writeDeletedText );
|
||||
void writeParagraphRsid ( const ParagraphPropertyExceptions* papx );
|
||||
void writeTextElement ( const std::wstring& text, const std::wstring& textType );
|
||||
void writeTextStart ( const std::wstring& textType, bool preserve_space);
|
||||
void writeTextEnd ( const std::wstring& textType );
|
||||
void writeField (const std::wstring& sFieldString, int cpFieldStart, int cpFieldEnd);
|
||||
|
||||
|
||||
std::vector<int> searchBookmarks( std::vector<wchar_t>* chars, int initialCp );
|
||||
std::vector<int> searchAnnot(std::vector<wchar_t>* chars, int initialCp);
|
||||
|
||||
@ -110,7 +110,7 @@ namespace DocFileFormat
|
||||
typedef struct FibWord2
|
||||
{
|
||||
unsigned int Spare = 0;
|
||||
unsigned char rgwSpare0[3];
|
||||
unsigned short rgwSpare0[3];
|
||||
|
||||
unsigned int fcPlcMcr = 0;
|
||||
unsigned int lcbPlcMcr = 0;
|
||||
@ -1312,10 +1312,10 @@ namespace DocFileFormat
|
||||
|
||||
flag16 = reader.ReadUInt16(); //10
|
||||
|
||||
m_FibBase.fDot = (flag16 & 0x0001) >> 2;
|
||||
m_FibBase.fGlsy = (flag16 & 0x0002) >> 1;
|
||||
m_FibBase.fComplex = (flag16 & 0x0004) >> 2;
|
||||
m_FibBase.fHasPic = (flag16 & 0x0008) >> 3;
|
||||
m_FibBase.fDot = ((flag16 & 0x0001) >> 2) != 0;
|
||||
m_FibBase.fGlsy = ((flag16 & 0x0002) >> 1) != 0;
|
||||
m_FibBase.fComplex = ((flag16 & 0x0004) >> 2) != 0;
|
||||
m_FibBase.fHasPic = ((flag16 & 0x0008) >> 3) != 0;
|
||||
m_FibBase.cQuickSaves = (WORD)(((int)flag16 & 0x00F0) >> 4);
|
||||
m_FibBase.fEncrypted = FormatUtils::BitmaskToBool((int)flag16, 0x0100);
|
||||
m_FibBase.fWhichTblStm = FormatUtils::BitmaskToBool((int)flag16, 0x0200);
|
||||
|
||||
@ -134,6 +134,8 @@ FormFieldData::FormFieldData( int type, const CharacterPropertyExceptions* chpx,
|
||||
bNilPICFAndBinData = true; // or bPICFAndOfficeArtData - shape, pic, ole
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
*/
|
||||
|
||||
#include "MainDocumentMapping.h"
|
||||
#include "OfficeDrawing/FillStyleBooleanProperties.h"
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
@ -83,16 +84,27 @@ namespace DocFileFormat
|
||||
|
||||
if ((m_document->GetOfficeArt()) && (m_document->GetOfficeArt()->GetShapeBackgound()))
|
||||
{
|
||||
bool bFilled = true;
|
||||
m_document->DocProperties->bDisplayBackgroundShape = true;
|
||||
ShapeContainer* pShape = m_document->GetOfficeArt()->GetShapeBackgound();
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin ( L"w:background", TRUE);
|
||||
m_pXmlWriter->WriteAttribute ( L"w:color", L"FFFFFF");
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
VMLShapeMapping oVmlWriter (m_context, m_pXmlWriter, NULL, NULL, _caller);
|
||||
pShape->Convert(&oVmlWriter);
|
||||
m_pXmlWriter->WriteNodeEnd (L"w:background");
|
||||
OptionEntryPtr boolFill = pShape->ExtractOption(fillStyleBooleanProperties);
|
||||
|
||||
FillStyleBooleanProperties booleans(boolFill ? boolFill->op : 0);
|
||||
if (booleans.fUsefFilled && !booleans.fFilled)
|
||||
{
|
||||
bFilled = false;
|
||||
}
|
||||
if (bFilled)
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin ( L"w:background", TRUE);
|
||||
m_pXmlWriter->WriteAttribute ( L"w:color", L"FFFFFF");
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
VMLShapeMapping oVmlWriter (m_context, m_pXmlWriter, NULL, NULL, _caller);
|
||||
pShape->Convert(&oVmlWriter);
|
||||
m_pXmlWriter->WriteNodeEnd (L"w:background");
|
||||
}
|
||||
}
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:body", FALSE );
|
||||
|
||||
@ -697,6 +697,8 @@ namespace DocFileFormat
|
||||
{
|
||||
isPictureBullet = FormatUtils::BitmaskToBool(FormatUtils::BytesToUInt16(iter->Arguments, 0, iter->argumentsSize), 0x1);
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -97,7 +97,7 @@ namespace DocFileFormat
|
||||
ShapeContainer* shape = static_cast<ShapeContainer*>(groupChild);
|
||||
if (shape)
|
||||
{
|
||||
shape->m_nIndex = i;
|
||||
shape->m_nIndex = (int)i;
|
||||
if (shape->m_bBackground)
|
||||
{
|
||||
m_pBackgroud = shape;
|
||||
|
||||
@ -112,7 +112,7 @@ namespace DocFileFormat
|
||||
if (lMinF <= point.x)
|
||||
{
|
||||
int index = (DWORD)point.x - 0x80000000;
|
||||
if (index >= 0 && index < guides.size())
|
||||
if (index >= 0 && index < (int)guides.size())
|
||||
{
|
||||
point.x = guides[index].param3;
|
||||
}
|
||||
@ -120,7 +120,7 @@ namespace DocFileFormat
|
||||
if (lMinF <= point.y)
|
||||
{
|
||||
int index = (DWORD)point.y - 0x80000000;
|
||||
if (index >= 0 && index < guides.size())
|
||||
if (index >= 0 && index < (int)guides.size())
|
||||
{
|
||||
point.y = guides[index].param3;
|
||||
}
|
||||
|
||||
@ -60,8 +60,8 @@ namespace DocFileFormat
|
||||
for ( size_t i = 0; i < this->Children.size(); ++i )
|
||||
{
|
||||
ClientAnchor *clientAnchor = dynamic_cast<ClientAnchor*>( this->Children[i] );
|
||||
if ( (clientAnchor) && (clientAnchor->value == 0x80000000))
|
||||
m_bSkip = true;
|
||||
//if ( (clientAnchor) && (clientAnchor->value == 0x80000000))
|
||||
// m_bSkip = true; //О реорганизации территориальных органов ПФР с 01.11.2018.doc
|
||||
|
||||
Shape* sh = dynamic_cast<Shape*>( this->Children[i] );
|
||||
if (sh)
|
||||
@ -101,6 +101,24 @@ namespace DocFileFormat
|
||||
return new ShapeContainer( _reader, bodySize, typeCode, version, instance );
|
||||
}
|
||||
|
||||
OptionEntryPtr ExtractOption(const PropertyId & prop) const
|
||||
{
|
||||
OptionEntryPtr ret;
|
||||
for ( size_t i = 0; i < this->Children.size(); ++i )
|
||||
{
|
||||
ShapeOptions* opt = dynamic_cast<ShapeOptions*>( this->Children[i] );
|
||||
|
||||
if ( opt == NULL ) continue;
|
||||
|
||||
std::map<PropertyId, OptionEntryPtr>::iterator pFind = opt->OptionsByID.find(prop);
|
||||
if (pFind != opt->OptionsByID.end())
|
||||
{
|
||||
ret = pFind->second;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::vector<OptionEntryPtr> ExtractOptions() const
|
||||
{
|
||||
std::vector<OptionEntryPtr> ret;
|
||||
|
||||
@ -244,6 +244,8 @@ namespace DocFileFormat
|
||||
case sprmOldCFData:
|
||||
case sprmCFData:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -117,6 +117,8 @@ namespace DocFileFormat
|
||||
this->RsidDel = FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//put the sprm on the revision stack
|
||||
|
||||
@ -130,6 +130,8 @@ namespace DocFileFormat
|
||||
appendValueAttribute( &pgBorders, L"w:display", L"notFirstPage" );
|
||||
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (_ctx->_doc->nWordVersion == 2)
|
||||
|
||||
@ -32,9 +32,38 @@
|
||||
|
||||
|
||||
#include "SettingsMapping.h"
|
||||
#include "../../OfficeCryptReader/source/CryptTransform.h"
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
std::string DecodeBase64(const std::string & value)
|
||||
{
|
||||
int nLength = 0;
|
||||
unsigned char *pData = NULL;
|
||||
std::string result;
|
||||
|
||||
NSFile::CBase64Converter::Decode(value.c_str(), value.length(), pData, nLength);
|
||||
if (pData)
|
||||
{
|
||||
result = std::string((char*)pData, nLength);
|
||||
delete []pData; pData = NULL;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
std::wstring EncodeBase64(const std::string & value)
|
||||
{
|
||||
int nLength = 0;
|
||||
char *pData = NULL;
|
||||
std::string result;
|
||||
|
||||
NSFile::CBase64Converter::Encode((BYTE*)value.c_str(), value.length(), pData, nLength, NSBase64::B64_BASE64_FLAG_NOCRLF);
|
||||
if (pData)
|
||||
{
|
||||
result = std::string(pData, nLength);
|
||||
delete []pData; pData = NULL;
|
||||
}
|
||||
return std::wstring(result.begin(), result.end());
|
||||
}
|
||||
SettingsMapping::SettingsMapping (ConversionContext* ctx): PropertiesMapping(&m_oXmlWriter)
|
||||
{
|
||||
_ctx = ctx;
|
||||
@ -49,11 +78,39 @@ namespace DocFileFormat
|
||||
//start w:settings
|
||||
m_oXmlWriter.WriteNodeBegin( L"?xml version=\"1.0\" encoding=\"UTF-8\"?" );
|
||||
m_oXmlWriter.WriteNodeBegin( L"w:settings", TRUE );
|
||||
|
||||
//write namespaces
|
||||
m_oXmlWriter.WriteAttribute( L"xmlns:w", OpenXmlNamespaces::WordprocessingML );
|
||||
m_oXmlWriter.WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
if (_ctx->_doc->FIB->m_FibBase.fWriteReservation)
|
||||
{
|
||||
m_oXmlWriter.WriteNodeBegin( L"w:writeProtection", TRUE );
|
||||
WideString* passw = static_cast<WideString*>(_ctx->_doc->AssocNames->operator[]( 17 ));
|
||||
if (passw && false == passw->empty())
|
||||
{
|
||||
CRYPT::_ecmaWriteProtectData data;
|
||||
|
||||
CRYPT::ECMAWriteProtect protect;
|
||||
protect.SetCryptData(data);
|
||||
protect.SetPassword(*passw);
|
||||
|
||||
protect.Generate();
|
||||
protect.GetCryptData(data);
|
||||
|
||||
//m_oXmlWriter.WriteAttribute ( L"w:cryptProviderType", L"rsaAES");
|
||||
//m_oXmlWriter.WriteAttribute ( L"w:cryptAlgorithmSid", 14); //sha-512
|
||||
//m_oXmlWriter.WriteAttribute ( L"w:cryptAlgorithmType", L"typeAny");
|
||||
//m_oXmlWriter.WriteAttribute ( L"w:cryptAlgorithmClass", L"hash");
|
||||
//m_oXmlWriter.WriteAttribute ( L"w:cryptSpinCount", data.spinCount);
|
||||
//m_oXmlWriter.WriteAttribute ( L"w:hash", EncodeBase64(data.hashValue));
|
||||
//m_oXmlWriter.WriteAttribute ( L"w:salt", EncodeBase64(data.saltValue));
|
||||
m_oXmlWriter.WriteAttribute ( L"w:algorithmName", L"SHA-512");
|
||||
m_oXmlWriter.WriteAttribute ( L"w:spinCount", data.spinCount);
|
||||
m_oXmlWriter.WriteAttribute ( L"w:hashValue", EncodeBase64(data.hashValue));
|
||||
m_oXmlWriter.WriteAttribute ( L"w:saltValue", EncodeBase64(data.saltValue));
|
||||
}
|
||||
m_oXmlWriter.WriteNodeEnd( L"", TRUE, TRUE );
|
||||
}
|
||||
//zoom
|
||||
m_oXmlWriter.WriteNodeBegin ( L"w:zoom", TRUE );
|
||||
m_oXmlWriter.WriteAttribute ( L"w:percent", FormatUtils::IntToWideString( dop->wScaleSaved > 0 ? dop->wScaleSaved : 100 ) );
|
||||
|
||||
@ -92,6 +92,8 @@ namespace DocFileFormat
|
||||
{
|
||||
iTap_current = FormatUtils::BytesToUInt32( iter->Arguments, 0, iter->argumentsSize );
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
std::list<SinglePropertyModifier>::const_reverse_iterator rend = tapx->grpprl->rend();
|
||||
@ -318,6 +320,8 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (_gridSpan <= 1 && nComputedCellWidth > _width && _width > 1)
|
||||
|
||||
@ -70,9 +70,7 @@ namespace DocFileFormat
|
||||
case sprmTDefTable:
|
||||
{
|
||||
//SprmTDefTable tdef = new SprmTDefTable(sprm.Arguments);
|
||||
}
|
||||
break;
|
||||
|
||||
}break;
|
||||
case sprmOldTTableHeader:
|
||||
case sprmTTableHeader:
|
||||
{ //header row
|
||||
@ -84,9 +82,7 @@ namespace DocFileFormat
|
||||
XMLTools::XMLElement header( L"w:tblHeader" );
|
||||
_trPr->AppendChild( header );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}break;
|
||||
case sprmTWidthAfter:
|
||||
{ //width after
|
||||
XMLTools::XMLElement wAfter( L"w:wAfter" );
|
||||
@ -96,9 +92,7 @@ namespace DocFileFormat
|
||||
XMLTools::XMLAttribute wAfterType( L"w:type", L"dxa" );
|
||||
wAfter.AppendAttribute( wAfterType );
|
||||
_trPr->AppendChild( wAfter, true );
|
||||
}
|
||||
break;
|
||||
|
||||
}break;
|
||||
case sprmTWidthBefore:
|
||||
{ //width before
|
||||
short before = FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize );
|
||||
@ -113,9 +107,7 @@ namespace DocFileFormat
|
||||
wBefore.AppendAttribute( wBeforeType );
|
||||
_trPr->AppendChild( wBefore, true );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}break;
|
||||
case sprmOldTDyaRowHeight:
|
||||
case sprmTDyaRowHeight:
|
||||
{ //row height
|
||||
@ -147,19 +139,19 @@ namespace DocFileFormat
|
||||
_trPr->AppendChild( rowHeight );
|
||||
}
|
||||
break;
|
||||
case sprmOldTFCantSplit:
|
||||
case sprmTFCantSplit:
|
||||
case sprmTFCantSplit90:
|
||||
{ //can't split
|
||||
appendFlagElement( _trPr, *iter, L"cantSplit", true );
|
||||
}break;
|
||||
|
||||
case sprmOldTFCantSplit:
|
||||
case sprmTFCantSplit:
|
||||
case sprmTFCantSplit90:
|
||||
{ //can't split
|
||||
appendFlagElement( _trPr, *iter, L"cantSplit", true );
|
||||
}break;
|
||||
|
||||
//div id
|
||||
case sprmTIpgp:// = PGPInfo.ipgpSelf (PGPInfo structure describes the border and margin properties)
|
||||
{
|
||||
}break;
|
||||
|
||||
//div id
|
||||
case sprmTIpgp:// = PGPInfo.ipgpSelf (PGPInfo structure describes the border and margin properties)
|
||||
{
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
//borders 80 exceptions
|
||||
//case SinglePropertyModifier.OperationCode.sprmTTableBorders80:
|
||||
// unsigned char[] brc80 = new unsigned char[4];
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
#include "OfficeDrawing/GroupShapeBooleanProperties.h"
|
||||
#include "OfficeDrawing/MetafilePictBlip.h"
|
||||
|
||||
#include "../../DesktopEditor/common/String.h"
|
||||
#include "../../DesktopEditor/common/StringExt.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Document.h"
|
||||
|
||||
#include "../../DesktopEditor/common/File.h"
|
||||
@ -138,6 +138,51 @@ namespace DocFileFormat
|
||||
}
|
||||
return btWin32;
|
||||
}
|
||||
bool VMLPictureMapping::ParseEmbeddedBlob( const std::string & xmlString, std::wstring & newXmlString)
|
||||
{
|
||||
newXmlString.clear();
|
||||
|
||||
std::wstring sTempFolder = m_context->_doc->m_sTempFolder;
|
||||
if (sTempFolder.empty())
|
||||
{
|
||||
sTempFolder = NSFile::CFileBinary::GetTempPath();
|
||||
}
|
||||
|
||||
std::wstring sTempXmlFile = NSDirectory::CreateTempFileWithUniqueName(sTempFolder, L"emb");
|
||||
|
||||
NSFile::CFileBinary file;
|
||||
file.CreateFileW(sTempXmlFile);
|
||||
file.WriteFile((BYTE*)xmlString.c_str(), xmlString.size());
|
||||
file.CloseFile();
|
||||
|
||||
COfficeUtils officeUtils(NULL);
|
||||
|
||||
BYTE *utf8Data = NULL;
|
||||
ULONG utf8DataSize = 0;
|
||||
if (S_OK != officeUtils.LoadFileFromArchive(sTempXmlFile, L"drs/shapexml.xml", &utf8Data, utf8DataSize))
|
||||
{
|
||||
if (S_OK == officeUtils.IsFileExistInArchive(sTempXmlFile, L"drs/diagrams"))
|
||||
{
|
||||
officeUtils.LoadFileFromArchive(sTempXmlFile, L"drs/diagrams/drawing1.xml", &utf8Data, utf8DataSize);
|
||||
}
|
||||
else if (S_OK != officeUtils.LoadFileFromArchive(sTempXmlFile, L"drs/e2oDoc.xml", &utf8Data, utf8DataSize))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (utf8Data && utf8DataSize > 0)
|
||||
{
|
||||
newXmlString = NSFile::CUtf8Converter::GetUnicodeStringFromUTF8(utf8Data, utf8DataSize);
|
||||
|
||||
delete []utf8Data;
|
||||
}
|
||||
NSFile::CFileBinary::Remove(sTempXmlFile);
|
||||
|
||||
if (newXmlString.empty()) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
bool VMLPictureMapping::ParseEmbeddedEquation( const std::string & xmlString, std::wstring & newXmlString)
|
||||
{
|
||||
newXmlString.clear();
|
||||
@ -221,6 +266,7 @@ namespace DocFileFormat
|
||||
m_isBullete = false;
|
||||
m_isEquation = false;
|
||||
m_isEmbedded = false;
|
||||
m_isBlob = false;
|
||||
|
||||
m_imageData = new XMLTools::XMLElement( L"v:imagedata" );
|
||||
}
|
||||
@ -314,7 +360,9 @@ namespace DocFileFormat
|
||||
case metroBlob:
|
||||
{
|
||||
//встроенная неведомая хуйня
|
||||
m_isBlob = true;
|
||||
m_isEmbedded = true;
|
||||
|
||||
m_embeddedData = std::string((char*)iter->opComplex.get(), iter->op);
|
||||
|
||||
//if (ParseEmbeddedBlob( m_embeddedData, m_blobXml)) // todoooo
|
||||
@ -427,8 +475,9 @@ namespace DocFileFormat
|
||||
{
|
||||
appendStyleProperty(&strStyle, L"visibility", L"hidden");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -58,6 +58,7 @@ namespace DocFileFormat
|
||||
void writePictureBorder (const std::wstring & name, const BorderCode* brc);
|
||||
void appendStyleProperty( std::wstring* b, const std::wstring& propName, const std::wstring& propValue ) const;
|
||||
bool ParseEmbeddedEquation( const std::string & xmlString, std::wstring & newXmlString );
|
||||
bool ParseEmbeddedBlob(const std::string & xmlString, std::wstring & newXmlString);
|
||||
std::wstring GetShapeID(const Shape* pShape) const;
|
||||
protected:
|
||||
/// Copies the picture from the binary stream to the zip archive
|
||||
@ -69,11 +70,13 @@ namespace DocFileFormat
|
||||
static std::wstring GetTargetExt (Global::BlipType nType);
|
||||
static std::wstring GetContentType (Global::BlipType nType);
|
||||
|
||||
bool m_isBlob;
|
||||
bool m_isBullete;
|
||||
bool m_isEquation;
|
||||
bool m_isEmbedded;
|
||||
std::string m_embeddedData;
|
||||
std::wstring m_equationXml;
|
||||
std::wstring m_blobXml;
|
||||
|
||||
std::wstring m_shapeId;
|
||||
private:
|
||||
|
||||
@ -55,7 +55,7 @@
|
||||
|
||||
#include "DrawingPrimitives.h"
|
||||
|
||||
#include "../../DesktopEditor/common/String.h"
|
||||
#include "../../DesktopEditor/common/StringExt.h"
|
||||
|
||||
#include "../Common/FormatUtils.h"
|
||||
|
||||
@ -168,6 +168,8 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteAttribute(L"wrapcoords", wrapCoords);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1682,6 +1684,8 @@ namespace DocFileFormat
|
||||
{
|
||||
appendStyleProperty(oStyle, L"mso-wrap-distance-top", (FormatUtils::DoubleToWideString(EmuValue((int)iter->op).ToPoints()) + std::wstring(L"pt")));
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1819,12 +1823,12 @@ namespace DocFileFormat
|
||||
{
|
||||
switch ( op )
|
||||
{
|
||||
default: return L"none";
|
||||
case 1: return L"block";
|
||||
case 2: return L"classic";
|
||||
case 3: return L"diamond";
|
||||
case 4: return L"oval";
|
||||
case 5: return L"open";
|
||||
default: return L"none";
|
||||
}
|
||||
}
|
||||
|
||||
@ -1832,9 +1836,9 @@ namespace DocFileFormat
|
||||
{
|
||||
switch ( op )
|
||||
{
|
||||
default: return L"short";
|
||||
case 1: return L"medium";
|
||||
case 2: return L"long";
|
||||
default: return L"short";
|
||||
}
|
||||
}
|
||||
|
||||
@ -1842,9 +1846,9 @@ namespace DocFileFormat
|
||||
{
|
||||
switch ( op )
|
||||
{
|
||||
default: return L"narrow";
|
||||
case 1: return L"medium";
|
||||
case 2: return L"wide";
|
||||
default: return L"narrow";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -88,6 +88,7 @@ namespace DocFileFormat
|
||||
friend class VMLPictureMapping;
|
||||
friend class OpenXmlPackage;
|
||||
friend class TextboxMapping;
|
||||
friend class SettingsMapping;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ namespace Writers
|
||||
NSDirectory::CreateDirectories(sCustomXmlRelsDir);
|
||||
|
||||
m_pDrawingConverter->SetDstContentRels();
|
||||
long lId;
|
||||
unsigned int lId;
|
||||
m_pDrawingConverter->WriteRels(OOX::FileTypes::CustomXmlProps.RelationType(), sCustomXMLPropsFilename, L"", &lId);
|
||||
m_pDrawingConverter->SaveDstContentRels(sCustomXmlRelsDir + FILE_SEPARATOR_STR + sCustomXmlFilename + L".rels");
|
||||
|
||||
|
||||
@ -42,15 +42,15 @@ class SectPr
|
||||
{
|
||||
public:
|
||||
std::wstring sHeaderFooterReference;
|
||||
double W;
|
||||
double H;
|
||||
long W;
|
||||
long H;
|
||||
BYTE cOrientation;
|
||||
double Left;
|
||||
double Top;
|
||||
double Right;
|
||||
double Bottom;
|
||||
double Header;
|
||||
double Footer;
|
||||
long Left;
|
||||
long Top;
|
||||
long Right;
|
||||
long Bottom;
|
||||
long Header;
|
||||
long Footer;
|
||||
bool TitlePg;
|
||||
bool EvenAndOddHeaders;
|
||||
BYTE SectionType;
|
||||
@ -61,6 +61,13 @@ public:
|
||||
std::wstring footnotePr;
|
||||
std::wstring endnotePr;
|
||||
|
||||
bool bW;
|
||||
bool bH;
|
||||
bool bOrientation;
|
||||
bool bLeft;
|
||||
bool bTop;
|
||||
bool bRight;
|
||||
bool bBottom;
|
||||
bool bHeader;
|
||||
bool bFooter;
|
||||
bool bTitlePg;
|
||||
@ -69,18 +76,16 @@ public:
|
||||
bool bPageNumStart;
|
||||
SectPr()
|
||||
{
|
||||
W = Page_Width;
|
||||
H = Page_Height;
|
||||
cOrientation = orientation_Portrait;
|
||||
Left = 30;
|
||||
Top = 20;
|
||||
Right = 15;
|
||||
Bottom = 20;
|
||||
Header = 12.5;
|
||||
Footer = 12.5;
|
||||
sHeaderFooterReference = _T("");
|
||||
cols = _T("<w:cols w:space=\"708\"/>");
|
||||
|
||||
bW = false;
|
||||
bH = false;
|
||||
bOrientation = false;
|
||||
bLeft = false;
|
||||
bTop = false;
|
||||
bRight = false;
|
||||
bBottom = false;
|
||||
bHeader = false;
|
||||
bFooter = false;
|
||||
bTitlePg = false;
|
||||
@ -91,14 +96,6 @@ public:
|
||||
std::wstring Write()
|
||||
{
|
||||
std::wstring sRes = _T("");
|
||||
long nWidth = SerializeCommon::Round(W * g_dKoef_mm_to_twips);
|
||||
long nHeight = SerializeCommon::Round(H * g_dKoef_mm_to_twips);
|
||||
long nMLeft = SerializeCommon::Round(Left * g_dKoef_mm_to_twips);
|
||||
long nMTop = SerializeCommon::Round(Top * g_dKoef_mm_to_twips);
|
||||
long nMRight = SerializeCommon::Round(Right * g_dKoef_mm_to_twips);
|
||||
long nMBottom = SerializeCommon::Round(Bottom * g_dKoef_mm_to_twips);
|
||||
long nMHeader = SerializeCommon::Round(Header * g_dKoef_mm_to_twips);
|
||||
long nMFooter = SerializeCommon::Round(Footer * g_dKoef_mm_to_twips);
|
||||
|
||||
if(!sHeaderFooterReference.empty())
|
||||
sRes += sHeaderFooterReference;
|
||||
@ -120,19 +117,41 @@ public:
|
||||
}
|
||||
sRes += L"<w:type w:val=\"" + sType + L"\"/>";
|
||||
}
|
||||
sRes += L"<w:pgSz w:w=\"" + std::to_wstring(nWidth) + L"\" w:h=\"" + std::to_wstring(nHeight) + L"\"";
|
||||
if(orientation_Portrait != cOrientation)
|
||||
sRes += L" w:orient=\"landscape\"";
|
||||
sRes += L"/>";
|
||||
if((bW && bH) || bOrientation)
|
||||
{
|
||||
sRes += L"<w:pgSz";
|
||||
if(bW && bH)
|
||||
{
|
||||
sRes += L" w:w=\"" + std::to_wstring(W) + L"\" w:h=\"" + std::to_wstring(H) + L"\"";
|
||||
}
|
||||
if(bOrientation)
|
||||
{
|
||||
if(orientation_Portrait != cOrientation)
|
||||
sRes += L" w:orient=\"landscape\"";
|
||||
else
|
||||
sRes += L" w:orient=\"portrait\"";
|
||||
}
|
||||
|
||||
sRes += L"<w:pgMar w:top=\"" + std::to_wstring(nMTop) + L"\" w:right=\"" + std::to_wstring(nMRight) +
|
||||
L"\" w:bottom=\"" + std::to_wstring(nMBottom) + L"\" w:left=\"" + std::to_wstring(nMLeft) + L"\" w:gutter=\"0\"";
|
||||
sRes += L"/>";
|
||||
}
|
||||
|
||||
if(bHeader)
|
||||
sRes += L" w:header=\"" + std::to_wstring(nMHeader) + L"\"";
|
||||
if(bFooter)
|
||||
sRes += L" w:footer=\"" + std::to_wstring(nMFooter) + L"\"";
|
||||
sRes += L"/>";
|
||||
if(bLeft || bTop || bRight || bBottom || bHeader || bFooter)
|
||||
{
|
||||
sRes += L"<w:pgMar";
|
||||
if(bTop)
|
||||
sRes += L" w:top=\"" + std::to_wstring(Top) + L"\"";
|
||||
if(bRight)
|
||||
sRes += L" w:right=\"" + std::to_wstring(Right) + L"\"";
|
||||
if(bBottom)
|
||||
sRes += L" w:bottom=\"" + std::to_wstring(Bottom) + L"\"";
|
||||
if(bLeft)
|
||||
sRes += L" w:left=\"" + std::to_wstring(Left) + L"\"";
|
||||
if(bHeader)
|
||||
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(!pgBorders.empty())
|
||||
sRes += pgBorders;
|
||||
|
||||
@ -245,6 +264,7 @@ class Spacing
|
||||
public:
|
||||
bool bLineRule;
|
||||
bool bLine;
|
||||
bool bLineTwips;
|
||||
bool bAfter;
|
||||
bool bBefore;
|
||||
bool bAfterAuto;
|
||||
@ -252,14 +272,16 @@ public:
|
||||
|
||||
BYTE LineRule;
|
||||
double Line;
|
||||
double After;
|
||||
double Before;
|
||||
long LineTwips;
|
||||
long After;
|
||||
long Before;
|
||||
bool AfterAuto;
|
||||
bool BeforeAuto;
|
||||
Spacing()
|
||||
{
|
||||
bLineRule = false;
|
||||
bLine = false;
|
||||
bLineTwips = false;
|
||||
bAfter = false;
|
||||
bBefore = false;
|
||||
bAfterAuto = false;
|
||||
@ -401,7 +423,7 @@ class Tab
|
||||
{
|
||||
public:
|
||||
BYTE Val;
|
||||
double Pos;
|
||||
long Pos;
|
||||
BYTE Leader;
|
||||
bool bLeader;
|
||||
Tab()
|
||||
@ -435,11 +457,11 @@ public:
|
||||
docRGB HighLight;
|
||||
std::wstring Shd;
|
||||
std::wstring RStyle;
|
||||
double Spacing;
|
||||
long Spacing;
|
||||
bool DStrikeout;
|
||||
bool Caps;
|
||||
bool SmallCaps;
|
||||
double Position;
|
||||
long Position;
|
||||
BYTE FontHint;
|
||||
bool BoldCs;
|
||||
bool ItalicCs;
|
||||
@ -680,13 +702,11 @@ public:
|
||||
}
|
||||
if(bSpacing)
|
||||
{
|
||||
long nSpacing = SerializeCommon::Round( g_dKoef_mm_to_twips * Spacing);
|
||||
pCStringWriter->WriteString(L"<w:spacing w:val=\"" + std::to_wstring(nSpacing) + L"\"/>");
|
||||
pCStringWriter->WriteString(L"<w:spacing w:val=\"" + std::to_wstring(Spacing) + L"\"/>");
|
||||
}
|
||||
if(bPosition)
|
||||
{
|
||||
long nPosition = SerializeCommon::Round( g_dKoef_mm_to_hps * Position);
|
||||
std::wstring sPosition = L"<w:position w:val=\"" + std::to_wstring(nPosition) + L"\"/>";
|
||||
std::wstring sPosition = L"<w:position w:val=\"" + std::to_wstring(Position) + L"\"/>";
|
||||
pCStringWriter->WriteString(sPosition);
|
||||
}
|
||||
if(bFontSize)
|
||||
@ -1039,6 +1059,26 @@ public:
|
||||
};
|
||||
class PaddingsToWrite
|
||||
{
|
||||
public:
|
||||
long Left;
|
||||
long Top;
|
||||
long Right;
|
||||
long Bottom;
|
||||
|
||||
bool bLeft;
|
||||
bool bTop;
|
||||
bool bRight;
|
||||
bool bBottom;
|
||||
public: PaddingsToWrite()
|
||||
{
|
||||
bLeft = false;
|
||||
bTop = false;
|
||||
bRight = false;
|
||||
bBottom = false;
|
||||
}
|
||||
};
|
||||
class PaddingsToWriteMM
|
||||
{
|
||||
public:
|
||||
double Left;
|
||||
double Top;
|
||||
@ -1049,7 +1089,7 @@ public:
|
||||
bool bTop;
|
||||
bool bRight;
|
||||
bool bBottom;
|
||||
public: PaddingsToWrite()
|
||||
public: PaddingsToWriteMM()
|
||||
{
|
||||
bLeft = false;
|
||||
bTop = false;
|
||||
@ -1066,7 +1106,7 @@ public:
|
||||
double Y;
|
||||
double Width;
|
||||
double Height;
|
||||
PaddingsToWrite Paddings;
|
||||
PaddingsToWriteMM Paddings;
|
||||
int m_nDocPr;
|
||||
|
||||
bool bMediaId;
|
||||
@ -1205,8 +1245,8 @@ class docBorder
|
||||
{
|
||||
public:
|
||||
docRGB Color;
|
||||
double Space;
|
||||
double Size;
|
||||
long Space;
|
||||
long Size;
|
||||
BYTE Value;
|
||||
CThemeColor ThemeColor;
|
||||
|
||||
@ -1239,13 +1279,11 @@ public:
|
||||
}
|
||||
if(bSize)
|
||||
{
|
||||
long nSize = SerializeCommon::Round(g_dKoef_mm_to_eightpoint * Size);
|
||||
pCStringWriter->WriteString(L" w:sz=\"" + std::to_wstring(nSize) + L"\"");
|
||||
pCStringWriter->WriteString(L" w:sz=\"" + std::to_wstring(Size) + L"\"");
|
||||
}
|
||||
if(bSpace)
|
||||
{
|
||||
long nSpace = SerializeCommon::Round(g_dKoef_mm_to_pt * Space);
|
||||
pCStringWriter->WriteString(L" w:space=\"" + std::to_wstring(nSpace) + L"\"");
|
||||
pCStringWriter->WriteString(L" w:space=\"" + std::to_wstring(Space) + L"\"");
|
||||
}
|
||||
if(bThemeColor && ThemeColor.IsNoEmpty())
|
||||
{
|
||||
@ -2112,8 +2150,8 @@ public:
|
||||
class CDrawingPropertyWrapPoint
|
||||
{
|
||||
public:
|
||||
double X;
|
||||
double Y;
|
||||
__int64 X;
|
||||
__int64 Y;
|
||||
|
||||
bool bX;
|
||||
bool bY;
|
||||
@ -2153,36 +2191,36 @@ class CDrawingProperty
|
||||
public:
|
||||
bool bObject;
|
||||
std::wstring sObjectProgram;
|
||||
long nObjectId;
|
||||
unsigned int nObjectId;
|
||||
BYTE nObjectType;
|
||||
|
||||
long DataPos;
|
||||
long DataLength;
|
||||
BYTE Type;
|
||||
bool BehindDoc;
|
||||
double DistL;
|
||||
double DistT;
|
||||
double DistR;
|
||||
double DistB;
|
||||
__int64 DistL;
|
||||
__int64 DistT;
|
||||
__int64 DistR;
|
||||
__int64 DistB;
|
||||
bool LayoutInCell;
|
||||
unsigned long RelativeHeight;
|
||||
bool BSimplePos;
|
||||
double EffectExtentL;
|
||||
double EffectExtentT;
|
||||
double EffectExtentR;
|
||||
double EffectExtentB;
|
||||
double Width;
|
||||
double Height;
|
||||
__int64 EffectExtentL;
|
||||
__int64 EffectExtentT;
|
||||
__int64 EffectExtentR;
|
||||
__int64 EffectExtentB;
|
||||
__int64 Width;
|
||||
__int64 Height;
|
||||
BYTE PositionHRelativeFrom;
|
||||
BYTE PositionHAlign;
|
||||
double PositionHPosOffset;
|
||||
double PositionHPctOffset;
|
||||
__int64 PositionHPosOffset;
|
||||
double PositionHPctOffset;
|
||||
BYTE PositionVRelativeFrom;
|
||||
BYTE PositionVAlign;
|
||||
double PositionVPosOffset;
|
||||
__int64 PositionVPosOffset;
|
||||
double PositionVPctOffset;
|
||||
double SimplePosX;
|
||||
double SimplePosY;
|
||||
__int64 SimplePosX;
|
||||
__int64 SimplePosY;
|
||||
std::wstring sChartRels;
|
||||
std::wstring sSizeRelH;
|
||||
std::wstring sSizeRelV;
|
||||
@ -2272,24 +2310,17 @@ public:
|
||||
{
|
||||
if(bWidth && bHeight)
|
||||
{
|
||||
__int64 emuWidth = (__int64)(g_dKoef_mm_to_emu * Width);
|
||||
__int64 emuHeight = (__int64)(g_dKoef_mm_to_emu * Height);
|
||||
|
||||
if(false == bChart)
|
||||
sXml += L"<wp:inline xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" \
|
||||
distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\"><wp:extent cx=\"" + std::to_wstring(emuWidth) + L"\" cy=\"" + std::to_wstring(emuHeight) + L"\"/>";
|
||||
distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\"><wp:extent cx=\"" + std::to_wstring(Width) + L"\" cy=\"" + std::to_wstring(Height) + L"\"/>";
|
||||
else
|
||||
sXml += L"<w:drawing><wp:inline distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\">\
|
||||
<wp:extent cx=\"" + std::to_wstring(emuWidth) + L"\" cy=\"" + std::to_wstring(emuHeight) + L"\"/>";
|
||||
<wp:extent cx=\"" + std::to_wstring(Width) + L"\" cy=\"" + std::to_wstring(Height) + L"\"/>";
|
||||
|
||||
if(bEffectExtentL && bEffectExtentT && bEffectExtentR && bEffectExtentB)
|
||||
{
|
||||
__int64 emuEffectExtentL = (__int64)(g_dKoef_mm_to_emu * EffectExtentL);
|
||||
__int64 emuEffectExtentT = (__int64)(g_dKoef_mm_to_emu * EffectExtentT);
|
||||
__int64 emuEffectExtentR = (__int64)(g_dKoef_mm_to_emu * EffectExtentR);
|
||||
__int64 emuEffectExtentB = (__int64)(g_dKoef_mm_to_emu * EffectExtentB);
|
||||
sXml += L"<wp:effectExtent l=\"" + std::to_wstring(emuEffectExtentL) + L"\" t=\"" + std::to_wstring(emuEffectExtentT) +
|
||||
L"\" r=\"" + std::to_wstring(emuEffectExtentR) + L"\" b=\"" + std::to_wstring(emuEffectExtentB) + L"\"/>";
|
||||
sXml += L"<wp:effectExtent l=\"" + std::to_wstring(EffectExtentL) + L"\" t=\"" + std::to_wstring(EffectExtentT) +
|
||||
L"\" r=\"" + std::to_wstring(EffectExtentR) + L"\" b=\"" + std::to_wstring(EffectExtentB) + L"\"/>";
|
||||
}
|
||||
|
||||
if(!sDocPr.empty())
|
||||
@ -2331,13 +2362,13 @@ distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\"><wp:extent cx=\"" + std::to_wstr
|
||||
__int64 emuDistB = 0;
|
||||
|
||||
if(bDistL)
|
||||
emuDistL = (__int64)(g_dKoef_mm_to_emu * DistL);
|
||||
emuDistL = DistL;
|
||||
if(bDistT)
|
||||
emuDistT = (__int64)(g_dKoef_mm_to_emu * DistT);
|
||||
emuDistT = DistT;
|
||||
if(bDistR)
|
||||
emuDistR = (__int64)(g_dKoef_mm_to_emu * DistR);
|
||||
emuDistR = DistR;
|
||||
if(bDistB)
|
||||
emuDistB = (__int64)(g_dKoef_mm_to_emu * DistB);
|
||||
emuDistB = DistB;
|
||||
int nSimplePos = 0;
|
||||
if(bBSimplePos && BSimplePos)
|
||||
nSimplePos = 1;
|
||||
@ -2366,10 +2397,10 @@ distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\"><wp:extent cx=\"" + std::to_wstr
|
||||
|
||||
__int64 emuX = 0;
|
||||
if(bSimplePosX)
|
||||
emuX = (__int64)(g_dKoef_mm_to_emu * SimplePosX);
|
||||
emuX = SimplePosX;
|
||||
__int64 emuY = 0;
|
||||
if(bSimplePosY)
|
||||
emuY = (__int64)(g_dKoef_mm_to_emu * SimplePosY);
|
||||
emuY = SimplePosY;
|
||||
sXml += L"<wp:simplePos x=\"" + std::to_wstring(emuX) + L"\" y=\"" + std::to_wstring(emuY) + L"\"/>";
|
||||
|
||||
if(bPositionHRelativeFrom && (bPositionHAlign || bPositionHPosOffset || bPositionHPctOffset))
|
||||
@ -2400,8 +2431,7 @@ distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\"><wp:extent cx=\"" + std::to_wstr
|
||||
}
|
||||
else if(bPositionHPosOffset)
|
||||
{
|
||||
__int64 emuPosOffset = (__int64)(g_dKoef_mm_to_emu * PositionHPosOffset);
|
||||
sContent = L"<wp:posOffset>" + std::to_wstring(emuPosOffset) + L"</wp:posOffset>";
|
||||
sContent = L"<wp:posOffset>" + std::to_wstring(PositionHPosOffset) + L"</wp:posOffset>";
|
||||
}
|
||||
else if(bPositionHPctOffset)
|
||||
{
|
||||
@ -2438,8 +2468,7 @@ distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\"><wp:extent cx=\"" + std::to_wstr
|
||||
}
|
||||
else if(bPositionVPosOffset)
|
||||
{
|
||||
__int64 emuPosOffset = (__int64)(g_dKoef_mm_to_emu * PositionVPosOffset);
|
||||
sContent = L"<wp:posOffset>" + std::to_wstring(emuPosOffset) + L"</wp:posOffset>";
|
||||
sContent = L"<wp:posOffset>" + std::to_wstring(PositionVPosOffset) + L"</wp:posOffset>";
|
||||
}
|
||||
else if(bPositionVPctOffset)
|
||||
{
|
||||
@ -2448,20 +2477,13 @@ distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\"><wp:extent cx=\"" + std::to_wstr
|
||||
}
|
||||
sXml += L"<wp:positionV relativeFrom=\"" + sRelativeFrom + L"\">" + sContent + L"</wp:positionV>";
|
||||
}
|
||||
__int64 emuWidth = (__int64)(g_dKoef_mm_to_emu * Width);
|
||||
__int64 emuHeight = (__int64)(g_dKoef_mm_to_emu * Height);
|
||||
|
||||
sXml += L"<wp:extent cx=\"" + std::to_wstring(emuWidth) + L"\" cy=\"" + std::to_wstring(emuHeight)+ L"\"/>";
|
||||
sXml += L"<wp:extent cx=\"" + std::to_wstring(Width) + L"\" cy=\"" + std::to_wstring(Height)+ L"\"/>";
|
||||
|
||||
if(bEffectExtentL && bEffectExtentT && bEffectExtentR && bEffectExtentB)
|
||||
{
|
||||
__int64 emuEffectExtentL = (__int64)(g_dKoef_mm_to_emu * EffectExtentL);
|
||||
__int64 emuEffectExtentT = (__int64)(g_dKoef_mm_to_emu * EffectExtentT);
|
||||
__int64 emuEffectExtentR = (__int64)(g_dKoef_mm_to_emu * EffectExtentR);
|
||||
__int64 emuEffectExtentB = (__int64)(g_dKoef_mm_to_emu * EffectExtentB);
|
||||
sXml += L"<wp:effectExtent l=\"" + std::to_wstring(emuEffectExtentL) +
|
||||
L"\" t=\"" + std::to_wstring(emuEffectExtentT) + L"\" r=\"" + std::to_wstring(emuEffectExtentR) +
|
||||
L"\" b=\"" + std::to_wstring(emuEffectExtentB) + L"\"/>";
|
||||
sXml += L"<wp:effectExtent l=\"" + std::to_wstring(EffectExtentL) +
|
||||
L"\" t=\"" + std::to_wstring(EffectExtentT) + L"\" r=\"" + std::to_wstring(EffectExtentR) +
|
||||
L"\" b=\"" + std::to_wstring(EffectExtentB) + L"\"/>";
|
||||
}
|
||||
if(bDrawingPropertyWrap && DrawingPropertyWrap.bWrappingType)
|
||||
{
|
||||
@ -2492,9 +2514,7 @@ distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\"><wp:extent cx=\"" + std::to_wstr
|
||||
|
||||
if(DrawingPropertyWrap.bStart && DrawingPropertyWrap.Start.bX && DrawingPropertyWrap.Start.bY)
|
||||
{
|
||||
__int64 emuX = (__int64)(g_dKoef_mm_to_emu * DrawingPropertyWrap.Start.X);
|
||||
__int64 emuY = (__int64)(g_dKoef_mm_to_emu * DrawingPropertyWrap.Start.Y);
|
||||
sXml += L"<wp:start x=\"" + std::to_wstring(emuX) + L"\" y=\"" + std::to_wstring(emuY) + L"\"/>";
|
||||
sXml += L"<wp:start x=\"" + std::to_wstring(DrawingPropertyWrap.Start.X) + L"\" y=\"" + std::to_wstring(DrawingPropertyWrap.Start.Y) + L"\"/>";
|
||||
}
|
||||
|
||||
for(size_t i = 0; i < DrawingPropertyWrap.Points.size(); ++i)
|
||||
@ -2502,9 +2522,7 @@ distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\"><wp:extent cx=\"" + std::to_wstr
|
||||
CDrawingPropertyWrapPoint* pWrapPoint = DrawingPropertyWrap.Points[i];
|
||||
if(pWrapPoint->bX && pWrapPoint->bY)
|
||||
{
|
||||
__int64 emuX = (__int64)(g_dKoef_mm_to_emu * pWrapPoint->X);
|
||||
__int64 emuY = (__int64)(g_dKoef_mm_to_emu * pWrapPoint->Y);
|
||||
sXml += L"<wp:lineTo x=\"" + std::to_wstring(emuX) + L"\" y=\"" + std::to_wstring(emuY) + L"\"/>";
|
||||
sXml += L"<wp:lineTo x=\"" + std::to_wstring(pWrapPoint->X) + L"\" y=\"" + std::to_wstring(pWrapPoint->Y) + L"\"/>";
|
||||
}
|
||||
}
|
||||
sXml += L"</wp:wrapPolygon>";
|
||||
|
||||
@ -100,10 +100,9 @@ public:
|
||||
RELEASEOBJECT(m_oRPr)
|
||||
}
|
||||
};
|
||||
|
||||
#define READ1_DEF(stLen, res, fReadFunction, arg) {\
|
||||
long read1defCurPos = 0;\
|
||||
while(read1defCurPos < stLen)\
|
||||
while(read1defCurPos < (long)stLen)\
|
||||
{\
|
||||
BYTE read1defType = m_oBufferedStream.GetUChar();\
|
||||
long read1defLength = m_oBufferedStream.GetLong();\
|
||||
@ -120,7 +119,7 @@ public:
|
||||
}
|
||||
#define READ2_DEF(stLen, res, fReadFunction, arg) {\
|
||||
long read2defCurPos = 0;\
|
||||
while(read2defCurPos < stLen)\
|
||||
while(read2defCurPos < (long)stLen)\
|
||||
{\
|
||||
BYTE read2defType = m_oBufferedStream.GetUChar();\
|
||||
long read2defLenType = m_oBufferedStream.GetUChar();\
|
||||
@ -456,7 +455,13 @@ public:
|
||||
case c_oSerProp_rPrType::Spacing:
|
||||
{
|
||||
orPr->bSpacing = true;
|
||||
orPr->Spacing = m_oBufferedStream.GetDouble();
|
||||
orPr->Spacing = SerializeCommon::Round( g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble());
|
||||
}
|
||||
break;
|
||||
case c_oSerProp_rPrType::SpacingTwips:
|
||||
{
|
||||
orPr->bSpacing = true;
|
||||
orPr->Spacing = m_oBufferedStream.GetLong();
|
||||
}
|
||||
break;
|
||||
case c_oSerProp_rPrType::DStrikeout:
|
||||
@ -480,7 +485,13 @@ public:
|
||||
case c_oSerProp_rPrType::Position:
|
||||
{
|
||||
orPr->bPosition = true;
|
||||
orPr->Position = m_oBufferedStream.GetDouble();
|
||||
orPr->Position = SerializeCommon::Round( g_dKoef_mm_to_hps * m_oBufferedStream.GetDouble());
|
||||
}
|
||||
break;
|
||||
case c_oSerProp_rPrType::PositionHps:
|
||||
{
|
||||
orPr->bPosition = true;
|
||||
orPr->Position = m_oBufferedStream.GetLong();
|
||||
}
|
||||
break;
|
||||
case c_oSerProp_rPrType::FontHint:
|
||||
@ -724,12 +735,12 @@ public:
|
||||
{
|
||||
Spacing oSpacing;
|
||||
READ2_DEF(length, res, this->ReadSpacing, &oSpacing);
|
||||
if(oSpacing.bLine || oSpacing.bAfter || oSpacing.bAfterAuto || oSpacing.bBefore || oSpacing.bBeforeAuto)
|
||||
if(oSpacing.bLine || oSpacing.bLineTwips || oSpacing.bAfter || oSpacing.bAfterAuto || oSpacing.bBefore || oSpacing.bBeforeAuto)
|
||||
{
|
||||
pCStringWriter->WriteString(std::wstring(L"<w:spacing"));
|
||||
BYTE bLineRule = linerule_Auto;
|
||||
//проверяется bLine, а не bLineRule чтобы всегда писать LineRule, если есть w:line
|
||||
if(oSpacing.bLine)
|
||||
if(oSpacing.bLine || oSpacing.bLineTwips)
|
||||
{
|
||||
if(oSpacing.bLineRule)
|
||||
bLineRule = oSpacing.LineRule;
|
||||
@ -757,10 +768,13 @@ public:
|
||||
}
|
||||
pCStringWriter->WriteString(sLine);
|
||||
}
|
||||
else if(oSpacing.bLineTwips)
|
||||
{
|
||||
pCStringWriter->WriteString(L" w:line=\"" + std::to_wstring(oSpacing.LineTwips) + L"\"");
|
||||
}
|
||||
if(oSpacing.bAfter)
|
||||
{
|
||||
long After = SerializeCommon::Round( g_dKoef_mm_to_twips * oSpacing.After);
|
||||
std::wstring sAfter = L" w:after=\"" + std::to_wstring(After) + L"\"";
|
||||
std::wstring sAfter = L" w:after=\"" + std::to_wstring(oSpacing.After) + L"\"";
|
||||
pCStringWriter->WriteString(sAfter);
|
||||
}
|
||||
if(oSpacing.bAfterAuto)
|
||||
@ -772,8 +786,7 @@ public:
|
||||
}
|
||||
if(oSpacing.bBefore)
|
||||
{
|
||||
long Before = SerializeCommon::Round( g_dKoef_mm_to_twips * oSpacing.Before);
|
||||
std::wstring sBefore = L" w:before=\"" + std::to_wstring(Before) + L"\"";
|
||||
std::wstring sBefore = L" w:before=\"" + std::to_wstring(oSpacing.Before) + L"\"";
|
||||
pCStringWriter->WriteString(sBefore);
|
||||
}
|
||||
if(oSpacing.bBeforeAuto)
|
||||
@ -817,7 +830,6 @@ public:
|
||||
for(size_t i = 0; i < nLen; ++i)
|
||||
{
|
||||
Tab& oTab = oTabs.m_aTabs[i];
|
||||
long nTab = SerializeCommon::Round( g_dKoef_mm_to_twips * oTab.Pos);
|
||||
std::wstring sVal;
|
||||
switch(oTab.Val)
|
||||
{
|
||||
@ -826,7 +838,7 @@ public:
|
||||
case g_tabtype_clear: sVal = L"clear"; break;
|
||||
default: sVal = L"left"; break;
|
||||
}
|
||||
pCStringWriter->WriteString(L"<w:tab w:val=\"" + sVal + L"\" w:pos=\"" + std::to_wstring(nTab) + L"\"");
|
||||
pCStringWriter->WriteString(L"<w:tab w:val=\"" + sVal + L"\" w:pos=\"" + std::to_wstring(oTab.Pos) + L"\"");
|
||||
if (oTab.bLeader)
|
||||
{
|
||||
std::wstring sLeader;
|
||||
@ -938,6 +950,11 @@ public:
|
||||
pCStringWriter->WriteString(L" w:left=\"" + std::to_wstring(nIndLeft) + L"\"");
|
||||
break;
|
||||
}
|
||||
case c_oSerProp_pPrType::Ind_LeftTwips:
|
||||
{
|
||||
pCStringWriter->WriteString(L" w:left=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"");
|
||||
break;
|
||||
}
|
||||
case c_oSerProp_pPrType::Ind_Right:
|
||||
{
|
||||
double dIndRight = m_oBufferedStream.GetDouble();
|
||||
@ -946,18 +963,34 @@ public:
|
||||
pCStringWriter->WriteString(L" w:right=\"" + std::to_wstring(nIndRight) + L"\"");
|
||||
break;
|
||||
}
|
||||
case c_oSerProp_pPrType::Ind_RightTwips:
|
||||
{
|
||||
pCStringWriter->WriteString(L" w:right=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"");
|
||||
break;
|
||||
}
|
||||
case c_oSerProp_pPrType::Ind_FirstLine:
|
||||
{
|
||||
double dIndFirstLine = m_oBufferedStream.GetDouble();
|
||||
long nIndFirstLine = SerializeCommon::Round(dIndFirstLine * g_dKoef_mm_to_twips);
|
||||
std::wstring sIndFirstLine;
|
||||
if(nIndFirstLine > 0)
|
||||
if(nIndFirstLine >= 0)
|
||||
sIndFirstLine = L" w:firstLine =\"" + std::to_wstring(nIndFirstLine) + L"\"";
|
||||
else
|
||||
sIndFirstLine = L" w:hanging=\"" + std::to_wstring(-nIndFirstLine) + L"\"";
|
||||
pCStringWriter->WriteString(sIndFirstLine);
|
||||
break;
|
||||
}
|
||||
case c_oSerProp_pPrType::Ind_FirstLineTwips:
|
||||
{
|
||||
long nIndFirstLine = m_oBufferedStream.GetLong();
|
||||
std::wstring sIndFirstLine;
|
||||
if(nIndFirstLine >= 0)
|
||||
sIndFirstLine = L" w:firstLine =\"" + std::to_wstring(nIndFirstLine) + L"\"";
|
||||
else
|
||||
sIndFirstLine = L" w:hanging=\"" + std::to_wstring(-nIndFirstLine) + L"\"";
|
||||
pCStringWriter->WriteString(sIndFirstLine);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
break;
|
||||
@ -974,17 +1007,29 @@ public:
|
||||
pSpacing->bLine = true;
|
||||
pSpacing->Line = m_oBufferedStream.GetDouble();
|
||||
break;
|
||||
case c_oSerProp_pPrType::Spacing_LineTwips:
|
||||
pSpacing->bLineTwips = true;
|
||||
pSpacing->LineTwips = m_oBufferedStream.GetLong();
|
||||
break;
|
||||
case c_oSerProp_pPrType::Spacing_LineRule:
|
||||
pSpacing->bLineRule = true;
|
||||
pSpacing->LineRule = m_oBufferedStream.GetUChar();
|
||||
break;
|
||||
case c_oSerProp_pPrType::Spacing_Before:
|
||||
pSpacing->bBefore = true;
|
||||
pSpacing->Before = m_oBufferedStream.GetDouble();
|
||||
pSpacing->Before = SerializeCommon::Round( g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble());
|
||||
break;
|
||||
case c_oSerProp_pPrType::Spacing_BeforeTwips:
|
||||
pSpacing->bBefore = true;
|
||||
pSpacing->Before = m_oBufferedStream.GetLong();
|
||||
break;
|
||||
case c_oSerProp_pPrType::Spacing_After:
|
||||
pSpacing->bAfter = true;
|
||||
pSpacing->After = m_oBufferedStream.GetDouble();
|
||||
pSpacing->After = SerializeCommon::Round( g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble());
|
||||
break;
|
||||
case c_oSerProp_pPrType::Spacing_AfterTwips:
|
||||
pSpacing->bAfter = true;
|
||||
pSpacing->After = m_oBufferedStream.GetLong();
|
||||
break;
|
||||
case c_oSerProp_pPrType::Spacing_BeforeAuto:
|
||||
pSpacing->bBeforeAuto = true;
|
||||
@ -1021,7 +1066,9 @@ public:
|
||||
if(c_oSerProp_pPrType::Tab_Item_Val == type)
|
||||
poTabItem->Val = m_oBufferedStream.GetUChar();
|
||||
else if(c_oSerProp_pPrType::Tab_Item_Pos == type)
|
||||
poTabItem->Pos = m_oBufferedStream.GetDouble();
|
||||
poTabItem->Pos = SerializeCommon::Round( g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble());
|
||||
else if(c_oSerProp_pPrType::Tab_Item_PosTwips == type)
|
||||
poTabItem->Pos = m_oBufferedStream.GetLong();
|
||||
else if(c_oSerProp_pPrType::Tab_Item_Leader == type)
|
||||
{
|
||||
poTabItem->bLeader = true;
|
||||
@ -1114,12 +1161,22 @@ public:
|
||||
else if( c_oSerBorderType::Space == type )
|
||||
{
|
||||
odocBorder->bSpace = true;
|
||||
odocBorder->Space = m_oBufferedStream.GetDouble();
|
||||
odocBorder->Space = SerializeCommon::Round(g_dKoef_mm_to_pt * m_oBufferedStream.GetDouble());
|
||||
}
|
||||
else if( c_oSerBorderType::SpacePoint == type )
|
||||
{
|
||||
odocBorder->bSpace = true;
|
||||
odocBorder->Space = m_oBufferedStream.GetLong();
|
||||
}
|
||||
else if( c_oSerBorderType::Size == type )
|
||||
{
|
||||
odocBorder->bSize = true;
|
||||
odocBorder->Size = m_oBufferedStream.GetDouble();
|
||||
odocBorder->Size = SerializeCommon::Round(g_dKoef_mm_to_eightpoint * m_oBufferedStream.GetDouble());
|
||||
}
|
||||
else if( c_oSerBorderType::Size8Point == type )
|
||||
{
|
||||
odocBorder->bSize = true;
|
||||
odocBorder->Size = m_oBufferedStream.GetLong();
|
||||
}
|
||||
else if( c_oSerBorderType::Value == type )
|
||||
{
|
||||
@ -1375,15 +1432,28 @@ public:
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
if( c_oSer_pgSzType::Orientation == type )
|
||||
{
|
||||
pSectPr->bOrientation = true;
|
||||
pSectPr->cOrientation = m_oBufferedStream.GetUChar();
|
||||
}
|
||||
else if( c_oSer_pgSzType::W == type )
|
||||
{
|
||||
pSectPr->W = m_oBufferedStream.GetDouble();
|
||||
pSectPr->bW = true;
|
||||
pSectPr->W = SerializeCommon::Round(g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble());
|
||||
}
|
||||
else if( c_oSer_pgSzType::WTwips == type )
|
||||
{
|
||||
pSectPr->bW = true;
|
||||
pSectPr->W = m_oBufferedStream.GetLong();
|
||||
}
|
||||
else if( c_oSer_pgSzType::H == type )
|
||||
{
|
||||
pSectPr->H = m_oBufferedStream.GetDouble();
|
||||
pSectPr->bH = true;
|
||||
pSectPr->H = SerializeCommon::Round(g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble());
|
||||
}
|
||||
else if( c_oSer_pgSzType::HTwips == type )
|
||||
{
|
||||
pSectPr->bH = true;
|
||||
pSectPr->H = m_oBufferedStream.GetLong();
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
@ -1395,29 +1465,63 @@ public:
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
if( c_oSer_pgMarType::Left == type )
|
||||
{
|
||||
pSectPr->Left = m_oBufferedStream.GetDouble();
|
||||
pSectPr->bLeft = true;
|
||||
pSectPr->Left = SerializeCommon::Round(g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble());
|
||||
}
|
||||
else if( c_oSer_pgMarType::LeftTwips == type )
|
||||
{
|
||||
pSectPr->bLeft = true;
|
||||
pSectPr->Left = m_oBufferedStream.GetLong();
|
||||
}
|
||||
else if( c_oSer_pgMarType::Top == type )
|
||||
{
|
||||
pSectPr->Top = m_oBufferedStream.GetDouble();
|
||||
pSectPr->bTop = true;
|
||||
pSectPr->Top = SerializeCommon::Round(g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble());
|
||||
}
|
||||
else if( c_oSer_pgMarType::TopTwips == type )
|
||||
{
|
||||
pSectPr->bTop = true;
|
||||
pSectPr->Top = m_oBufferedStream.GetLong();
|
||||
}
|
||||
else if( c_oSer_pgMarType::Right == type )
|
||||
{
|
||||
pSectPr->Right = m_oBufferedStream.GetDouble();
|
||||
pSectPr->bRight = true;
|
||||
pSectPr->Right = SerializeCommon::Round(g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble());
|
||||
}
|
||||
else if( c_oSer_pgMarType::RightTwips == type )
|
||||
{
|
||||
pSectPr->bRight = true;
|
||||
pSectPr->Right = m_oBufferedStream.GetLong();
|
||||
}
|
||||
else if( c_oSer_pgMarType::Bottom == type )
|
||||
{
|
||||
pSectPr->Bottom = m_oBufferedStream.GetDouble();
|
||||
pSectPr->bBottom = true;
|
||||
pSectPr->Bottom = SerializeCommon::Round(g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble());
|
||||
}
|
||||
else if( c_oSer_pgMarType::BottomTwips == type )
|
||||
{
|
||||
pSectPr->bBottom = true;
|
||||
pSectPr->Bottom = m_oBufferedStream.GetLong();
|
||||
}
|
||||
else if( c_oSer_pgMarType::Header == type )
|
||||
{
|
||||
pSectPr->bHeader = true;
|
||||
pSectPr->Header = m_oBufferedStream.GetDouble();
|
||||
pSectPr->Header = SerializeCommon::Round(g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble());
|
||||
}
|
||||
else if( c_oSer_pgMarType::HeaderTwips == type )
|
||||
{
|
||||
pSectPr->bHeader = true;
|
||||
pSectPr->Header = m_oBufferedStream.GetLong();
|
||||
}
|
||||
else if( c_oSer_pgMarType::Footer == type )
|
||||
{
|
||||
pSectPr->bFooter = true;
|
||||
pSectPr->Footer = m_oBufferedStream.GetDouble();
|
||||
pSectPr->Footer = SerializeCommon::Round(g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble());
|
||||
}
|
||||
else if( c_oSer_pgMarType::FooterTwips == type )
|
||||
{
|
||||
pSectPr->bFooter = true;
|
||||
pSectPr->Footer = m_oBufferedStream.GetLong();
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
@ -1717,6 +1821,10 @@ public:
|
||||
long nInd = SerializeCommon::Round( g_dKoef_mm_to_twips * dInd);
|
||||
pWiterTblPr->TableInd = L"<w:tblInd w:w=\"" + std::to_wstring(nInd) + L"\" w:type=\"dxa\"/>";
|
||||
}
|
||||
else if( c_oSerProp_tblPrType::TableIndTwips == type )
|
||||
{
|
||||
pWiterTblPr->TableInd = L"<w:tblInd w:w=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\" w:type=\"dxa\"/>";
|
||||
}
|
||||
else if( c_oSerProp_tblPrType::TableW == type )
|
||||
{
|
||||
docW odocW;
|
||||
@ -1816,6 +1924,10 @@ public:
|
||||
long nSpacing = SerializeCommon::Round( g_dKoef_mm_to_twips * dSpacing);
|
||||
pWiterTblPr->TableCellSpacing = L"<w:tblCellSpacing w:w=\"" + std::to_wstring(nSpacing) + L"\" w:type=\"dxa\"/>";
|
||||
}
|
||||
else if( c_oSerProp_tblPrType::TableCellSpacingTwips == type )
|
||||
{
|
||||
pWiterTblPr->TableCellSpacing = L"<w:tblCellSpacing w:w=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\" w:type=\"dxa\"/>";
|
||||
}
|
||||
else if( c_oSerProp_tblPrType::tblCaption == type )
|
||||
{
|
||||
pWiterTblPr->Caption = m_oBufferedStream.GetString3(length);
|
||||
@ -1960,6 +2072,10 @@ public:
|
||||
|
||||
pCStringWriter->WriteString(L" w:tblpX=\"" + std::to_wstring(nX) + L"\"");
|
||||
}
|
||||
else if( c_oSer_tblpPrType2::TblpXTwips == type )
|
||||
{
|
||||
pCStringWriter->WriteString(L" w:tblpX=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"");
|
||||
}
|
||||
else if( c_oSer_tblpPrType2::TblpXSpec == type )
|
||||
{
|
||||
std::wstring sXml;
|
||||
@ -1993,6 +2109,10 @@ public:
|
||||
|
||||
pCStringWriter->WriteString(L" w:tblpY=\"" + std::to_wstring(nY) + L"\"");
|
||||
}
|
||||
else if( c_oSer_tblpPrType2::TblpYTwips == type )
|
||||
{
|
||||
pCStringWriter->WriteString(L" w:tblpY=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"");
|
||||
}
|
||||
else if( c_oSer_tblpPrType2::TblpYSpec == type )
|
||||
{
|
||||
std::wstring sXml;
|
||||
@ -2056,7 +2176,7 @@ public:
|
||||
if(true == orowPrAfterBefore.bGridAfter && orowPrAfterBefore.nGridAfter > 0 && false == orowPrAfterBefore.oAfterWidth.bW)
|
||||
{
|
||||
//ищем по tblGrid
|
||||
if(orowPrAfterBefore.nGridAfter < m_aCurTblGrid.size())
|
||||
if(orowPrAfterBefore.nGridAfter < (long)m_aCurTblGrid.size())
|
||||
{
|
||||
double nSumW = 0;
|
||||
for(int i = 0; i < orowPrAfterBefore.nGridAfter; i++)
|
||||
@ -2088,6 +2208,10 @@ public:
|
||||
|
||||
pCStringWriter->WriteString(L"<w:tblCellSpacing w:w=\"" + std::to_wstring(nSpacing) + L"\" w:type=\"dxa\"/>");
|
||||
}
|
||||
else if( c_oSerProp_rowPrType::TableCellSpacingTwips == type )
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:tblCellSpacing w:w=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\" w:type=\"dxa\"/>");
|
||||
}
|
||||
else if( c_oSerProp_rowPrType::Height == type )
|
||||
{
|
||||
RowHeight val;
|
||||
@ -2181,6 +2305,10 @@ public:
|
||||
double dHeight = m_oBufferedStream.GetDouble();
|
||||
pHeight->nHeight = SerializeCommon::Round( g_dKoef_mm_to_twips * dHeight);
|
||||
}
|
||||
else if( c_oSerProp_rowPrType::Height_ValueTwips == type )
|
||||
{
|
||||
pHeight->nHeight = m_oBufferedStream.GetLong();
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
@ -2359,6 +2487,10 @@ public:
|
||||
|
||||
pCStringWriter->WriteString(L" w:leftFromText=\"" + std::to_wstring(nLeft) + L"\"");
|
||||
}
|
||||
else if (c_oSerPaddingType::leftTwips == type)
|
||||
{
|
||||
pCStringWriter->WriteString(L" w:leftFromText=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"");
|
||||
}
|
||||
else if (c_oSerPaddingType::top == type)
|
||||
{
|
||||
double dTop = m_oBufferedStream.GetDouble();
|
||||
@ -2366,6 +2498,10 @@ public:
|
||||
|
||||
pCStringWriter->WriteString(L" w:topFromText=\"" + std::to_wstring(nTop) + L"\"");
|
||||
}
|
||||
else if (c_oSerPaddingType::topTwips == type)
|
||||
{
|
||||
pCStringWriter->WriteString(L" w:topFromText=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"");
|
||||
}
|
||||
else if (c_oSerPaddingType::right == type)
|
||||
{
|
||||
double dRight = m_oBufferedStream.GetDouble();
|
||||
@ -2373,6 +2509,10 @@ public:
|
||||
|
||||
pCStringWriter->WriteString(L" w:rightFromText=\"" + std::to_wstring(nRight) + L"\"");
|
||||
}
|
||||
else if (c_oSerPaddingType::rightTwips == type)
|
||||
{
|
||||
pCStringWriter->WriteString(L" w:rightFromText=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"");
|
||||
}
|
||||
else if (c_oSerPaddingType::bottom == type)
|
||||
{
|
||||
double dBottom = m_oBufferedStream.GetDouble();
|
||||
@ -2380,6 +2520,10 @@ public:
|
||||
|
||||
pCStringWriter->WriteString(L" w:bottomFromText=\"" + std::to_wstring(nBottom) + L"\"");
|
||||
}
|
||||
else if (c_oSerPaddingType::bottomTwips == type)
|
||||
{
|
||||
pCStringWriter->WriteString(L" w:bottomFromText=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"");
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
@ -2598,7 +2742,7 @@ public:
|
||||
if ( c_oSerNumTypes::Lvl == type )
|
||||
{
|
||||
docLvl* odocLvl = new docLvl();
|
||||
odocLvl->ILvl = odocANum->Lvls.size();
|
||||
odocLvl->ILvl = (long)odocANum->Lvls.size();
|
||||
READ2_DEF(length, res, this->ReadLevel, odocLvl);
|
||||
odocANum->Lvls.push_back(odocLvl);
|
||||
}
|
||||
@ -2832,7 +2976,8 @@ public:
|
||||
}
|
||||
else if(c_oSer_sts::Style_Default == type)
|
||||
{
|
||||
odocStyle->bDefault = (0 != m_oBufferedStream.GetUChar());
|
||||
odocStyle->bDefault = true;
|
||||
odocStyle->Default = m_oBufferedStream.GetBool();
|
||||
}
|
||||
else if(c_oSer_sts::Style_BasedOn == type)
|
||||
{
|
||||
@ -3295,10 +3440,12 @@ public:
|
||||
{
|
||||
double dDefTabStop = m_oBufferedStream.GetDouble();
|
||||
long nDefTabStop = SerializeCommon::Round(dDefTabStop * g_dKoef_mm_to_twips);
|
||||
std::wstring sXml;
|
||||
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<w:defaultTabStop w:val=\"" + std::to_wstring(nDefTabStop) + L"\"/>");
|
||||
}
|
||||
else if ( c_oSer_SettingsType::DefaultTabStopTwips == type )
|
||||
{
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<w:defaultTabStop w:val=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"/>");
|
||||
}
|
||||
else if ( c_oSer_SettingsType::MathPr == type )
|
||||
{
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(_T("<m:mathPr>"));
|
||||
@ -3583,6 +3730,10 @@ public:
|
||||
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:interSp m:val=\"" + std::to_wstring(lVal) + L"\"/>");
|
||||
}
|
||||
else if ( c_oSer_OMathBottomNodesValType::ValTwips == type )
|
||||
{
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:interSp m:val=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"/>");
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
@ -3615,6 +3766,10 @@ public:
|
||||
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:intraSp m:val=\"" + std::to_wstring(lVal) + L"\"/>");
|
||||
}
|
||||
else if ( c_oSer_OMathBottomNodesValType::ValTwips == type )
|
||||
{
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:intraSp m:val=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"/>");
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
@ -3628,6 +3783,10 @@ public:
|
||||
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:lMargin m:val=\"" + std::to_wstring(lVal) + L"\"/>");
|
||||
}
|
||||
else if ( c_oSer_OMathBottomNodesValType::ValTwips == type )
|
||||
{
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:lMargin m:val=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"/>");
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
@ -3679,6 +3838,10 @@ public:
|
||||
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:postSp m:val=\"" + std::to_wstring(lVal) + L"\"/>");
|
||||
}
|
||||
else if ( c_oSer_OMathBottomNodesValType::ValTwips == type )
|
||||
{
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:postSp m:val=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"/>");
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
@ -3692,6 +3855,10 @@ public:
|
||||
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:preSp m:val=\"" + std::to_wstring(lVal)+ L"\"/>");
|
||||
}
|
||||
else if ( c_oSer_OMathBottomNodesValType::ValTwips == type )
|
||||
{
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:preSp m:val=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"/>");
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
@ -3705,6 +3872,10 @@ public:
|
||||
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:rMargin m:val=\"" + std::to_wstring(lVal) + L"\"/>");
|
||||
}
|
||||
else if ( c_oSer_OMathBottomNodesValType::ValTwips == type )
|
||||
{
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:rMargin m:val=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"/>");
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
@ -3735,6 +3906,10 @@ public:
|
||||
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:wrapIndent m:val=\"" + std::to_wstring(lVal) + L"\"/>");
|
||||
}
|
||||
else if ( c_oSer_OMathBottomNodesValType::ValTwips == type )
|
||||
{
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:wrapIndent m:val=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"/>");
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
@ -3893,7 +4068,7 @@ public:
|
||||
oFile.WriteFile(pData, length);
|
||||
oFile.CloseFile();
|
||||
|
||||
long lId;
|
||||
unsigned int lId = 0;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(OOX::FileTypes::JsaProject.RelationType(), sJsaProject.GetPath(), L"", &lId);
|
||||
m_oFileWriter.m_pDrawingConverter->m_pImageManager->m_pContentTypes->AddDefault(sJsaProject.GetExtention(false));
|
||||
}
|
||||
@ -3970,6 +4145,12 @@ public:
|
||||
READ1_DEF(length, res, this->ReadMathArg, poResult);
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("</m:oMath>")));
|
||||
}
|
||||
else if ( c_oSerParType::MRun == type )
|
||||
{
|
||||
GetRunStringWriter().WriteString(std::wstring(_T("<m:r>")));
|
||||
READ1_DEF(length, res, this->ReadMathMRun, poResult);
|
||||
GetRunStringWriter().WriteString(std::wstring(_T("</m:r>")));
|
||||
}
|
||||
else if ( c_oSerParType::Hyperlink == type )
|
||||
{
|
||||
CHyperlink oHyperlink;
|
||||
@ -4520,7 +4701,7 @@ public:
|
||||
READ1_DEF(length, res, this->ReadParagraphContent, NULL);
|
||||
if (!pHyperlink->sLink.empty())
|
||||
{
|
||||
long rId;
|
||||
unsigned int rId;
|
||||
std::wstring sHref = XmlUtils::EncodeXmlString(pHyperlink->sLink);
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink")), sHref, std::wstring(_T("External")), &rId);
|
||||
pHyperlink->rId = L"rId" + std::to_wstring(rId);
|
||||
@ -4592,6 +4773,12 @@ public:
|
||||
READ1_DEF(length, res, this->ReadMathDelimiter, poResult);
|
||||
GetRunStringWriter().WriteString(std::wstring(_T("</m:d>")));
|
||||
}
|
||||
else if ( c_oSer_OMathContentType::Del == type )
|
||||
{
|
||||
TrackRevision oTrackRevision;
|
||||
READ1_DEF(length, res, this->ReadDelIns, &oTrackRevision);
|
||||
oTrackRevision.Write(&GetRunStringWriter(), _T("w:del"));
|
||||
}
|
||||
else if ( c_oSer_OMathContentType::EqArr == type )
|
||||
{
|
||||
GetRunStringWriter().WriteString(std::wstring(_T("<m:eqArr>")));
|
||||
@ -4616,6 +4803,12 @@ public:
|
||||
READ1_DEF(length, res, this->ReadMathGroupChr, poResult);
|
||||
GetRunStringWriter().WriteString(std::wstring(_T("</m:groupChr>")));
|
||||
}
|
||||
else if ( c_oSer_OMathContentType::Ins == type )
|
||||
{
|
||||
TrackRevision oTrackRevision;
|
||||
READ1_DEF(length, res, this->ReadDelIns, &oTrackRevision);
|
||||
oTrackRevision.Write(&GetRunStringWriter(), _T("w:ins"));
|
||||
}
|
||||
else if ( c_oSer_OMathContentType::LimLow == type )
|
||||
{
|
||||
GetRunStringWriter().WriteString(std::wstring(_T("<m:limLow>")));
|
||||
@ -6871,7 +7064,7 @@ public:
|
||||
std::wstring sNewImgRel = _T("media/") + sNewImgName;
|
||||
|
||||
sNewImgRel = XmlUtils::EncodeXmlString(sNewImgRel);
|
||||
long rId;
|
||||
unsigned int rId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/image")), sNewImgRel, std::wstring(), &rId);
|
||||
odocImg.srId = L"rId" + std::to_wstring(rId);
|
||||
//odocImg.srId = m_oMediaWriter.m_poDocumentRelsWriter->AddRels(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"), sNewImgRel, false);
|
||||
@ -7132,6 +7325,10 @@ public:
|
||||
|
||||
pCStringWriter->WriteString(L"<w:gridCol w:w=\"" + std::to_wstring(ngridCol)+ L"\"/>");
|
||||
}
|
||||
else if( c_oSerDocTableType::tblGrid_ItemTwips == type )
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:gridCol w:w=\"" + std::to_wstring(m_oBufferedStream.GetLong())+ L"\"/>");
|
||||
}
|
||||
else if( c_oSerDocTableType::tblGridChange == type )
|
||||
{
|
||||
TrackRevision oTrackRevision;
|
||||
@ -7412,7 +7609,7 @@ public:
|
||||
if (oXlsxSerializer.writeChartXlsx(sXlsxPath, *pChartSpace))
|
||||
{
|
||||
std::wstring sChartsWorksheetRelsName = L"../embeddings/" + sXlsxFilename;
|
||||
long rIdXlsx;
|
||||
unsigned int rIdXlsx;
|
||||
std::wstring bstrChartsWorksheetRelType = OOX::FileTypes::MicrosoftOfficeExcelWorksheet.RelationType();
|
||||
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(bstrChartsWorksheetRelType, sChartsWorksheetRelsName, std::wstring(), &rIdXlsx);
|
||||
@ -7439,7 +7636,7 @@ public:
|
||||
OOX::CPath pathChartsRels = pathChartsRelsDir.GetPath() + FILE_SEPARATOR_STR + sFilename + L".rels";
|
||||
m_oFileWriter.m_pDrawingConverter->SaveDstContentRels(pathChartsRels.GetPath());
|
||||
|
||||
long rIdChart;
|
||||
unsigned int rIdChart;
|
||||
std::wstring bstrChartRelType = OOX::FileTypes::Chart.RelationType();
|
||||
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(bstrChartRelType, sRelsName, std::wstring(), &rIdChart);
|
||||
@ -7472,22 +7669,42 @@ public:
|
||||
else if ( c_oSerImageType2::DistL == type )
|
||||
{
|
||||
pDrawingProperty->bDistL = true;
|
||||
pDrawingProperty->DistL = m_oBufferedStream.GetDouble();
|
||||
pDrawingProperty->DistL = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
|
||||
}
|
||||
else if ( c_oSerImageType2::DistLEmu == type )
|
||||
{
|
||||
pDrawingProperty->bDistL = true;
|
||||
pDrawingProperty->DistL = (__int64)m_oBufferedStream.GetULong();
|
||||
}
|
||||
else if ( c_oSerImageType2::DistT == type )
|
||||
{
|
||||
pDrawingProperty->bDistT = true;
|
||||
pDrawingProperty->DistT = m_oBufferedStream.GetDouble();
|
||||
pDrawingProperty->DistT = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
|
||||
}
|
||||
else if ( c_oSerImageType2::DistTEmu == type )
|
||||
{
|
||||
pDrawingProperty->bDistT = true;
|
||||
pDrawingProperty->DistT = (__int64)m_oBufferedStream.GetULong();
|
||||
}
|
||||
else if ( c_oSerImageType2::DistR == type )
|
||||
{
|
||||
pDrawingProperty->bDistR = true;
|
||||
pDrawingProperty->DistR = m_oBufferedStream.GetDouble();
|
||||
pDrawingProperty->DistR = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
|
||||
}
|
||||
else if ( c_oSerImageType2::DistREmu == type )
|
||||
{
|
||||
pDrawingProperty->bDistR = true;
|
||||
pDrawingProperty->DistR = (__int64)m_oBufferedStream.GetULong();
|
||||
}
|
||||
else if ( c_oSerImageType2::DistB == type )
|
||||
{
|
||||
pDrawingProperty->bDistB = true;
|
||||
pDrawingProperty->DistB = m_oBufferedStream.GetDouble();
|
||||
pDrawingProperty->DistB = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
|
||||
}
|
||||
else if ( c_oSerImageType2::DistBEmu == type )
|
||||
{
|
||||
pDrawingProperty->bDistB = true;
|
||||
pDrawingProperty->DistB = (__int64)m_oBufferedStream.GetULong();
|
||||
}
|
||||
else if ( c_oSerImageType2::LayoutInCell == type )
|
||||
{
|
||||
@ -7727,22 +7944,42 @@ public:
|
||||
if ( c_oSerEffectExtent::Left == type )
|
||||
{
|
||||
pDrawingProperty->bEffectExtentL = true;
|
||||
pDrawingProperty->EffectExtentL = m_oBufferedStream.GetDouble();
|
||||
pDrawingProperty->EffectExtentL = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
|
||||
}
|
||||
else if ( c_oSerEffectExtent::LeftEmu == type )
|
||||
{
|
||||
pDrawingProperty->bEffectExtentL = true;
|
||||
pDrawingProperty->EffectExtentL = (__int64)m_oBufferedStream.GetLong();
|
||||
}
|
||||
else if ( c_oSerEffectExtent::Top == type )
|
||||
{
|
||||
pDrawingProperty->bEffectExtentT = true;
|
||||
pDrawingProperty->EffectExtentT = m_oBufferedStream.GetDouble();
|
||||
pDrawingProperty->EffectExtentT = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
|
||||
}
|
||||
else if ( c_oSerEffectExtent::TopEmu == type )
|
||||
{
|
||||
pDrawingProperty->bEffectExtentT = true;
|
||||
pDrawingProperty->EffectExtentT = (__int64)m_oBufferedStream.GetLong();
|
||||
}
|
||||
else if ( c_oSerEffectExtent::Right == type )
|
||||
{
|
||||
pDrawingProperty->bEffectExtentR = true;
|
||||
pDrawingProperty->EffectExtentR = m_oBufferedStream.GetDouble();
|
||||
pDrawingProperty->EffectExtentR = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
|
||||
}
|
||||
else if ( c_oSerEffectExtent::RightEmu == type )
|
||||
{
|
||||
pDrawingProperty->bEffectExtentR = true;
|
||||
pDrawingProperty->EffectExtentR = (__int64)m_oBufferedStream.GetLong();
|
||||
}
|
||||
else if ( c_oSerEffectExtent::Bottom == type )
|
||||
{
|
||||
pDrawingProperty->bEffectExtentB = true;
|
||||
pDrawingProperty->EffectExtentB = m_oBufferedStream.GetDouble();
|
||||
pDrawingProperty->EffectExtentB = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
|
||||
}
|
||||
else if ( c_oSerEffectExtent::BottomEmu == type )
|
||||
{
|
||||
pDrawingProperty->bEffectExtentB = true;
|
||||
pDrawingProperty->EffectExtentB = (__int64)m_oBufferedStream.GetLong();
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
@ -7755,12 +7992,22 @@ public:
|
||||
if ( c_oSerExtent::Cx == type )
|
||||
{
|
||||
pDrawingProperty->bWidth = true;
|
||||
pDrawingProperty->Width = m_oBufferedStream.GetDouble();
|
||||
pDrawingProperty->Width = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
|
||||
}
|
||||
else if ( c_oSerExtent::CxEmu == type )
|
||||
{
|
||||
pDrawingProperty->bWidth = true;
|
||||
pDrawingProperty->Width = (__int64)m_oBufferedStream.GetULong();
|
||||
}
|
||||
else if ( c_oSerExtent::Cy == type )
|
||||
{
|
||||
pDrawingProperty->bHeight = true;
|
||||
pDrawingProperty->Height = m_oBufferedStream.GetDouble();
|
||||
pDrawingProperty->Height = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
|
||||
}
|
||||
else if ( c_oSerExtent::CyEmu == type )
|
||||
{
|
||||
pDrawingProperty->bHeight = true;
|
||||
pDrawingProperty->Height = (__int64)m_oBufferedStream.GetULong();
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
@ -7783,7 +8030,12 @@ public:
|
||||
else if ( c_oSerPosHV::PosOffset == type )
|
||||
{
|
||||
pDrawingProperty->bPositionHPosOffset = true;
|
||||
pDrawingProperty->PositionHPosOffset = m_oBufferedStream.GetDouble();
|
||||
pDrawingProperty->PositionHPosOffset = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
|
||||
}
|
||||
else if ( c_oSerPosHV::PosOffsetEmu == type )
|
||||
{
|
||||
pDrawingProperty->bPositionHPosOffset = true;
|
||||
pDrawingProperty->PositionHPosOffset = (__int64)m_oBufferedStream.GetLong();
|
||||
}
|
||||
else if ( c_oSerPosHV::PctOffset == type )
|
||||
{
|
||||
@ -7811,7 +8063,12 @@ public:
|
||||
else if ( c_oSerPosHV::PosOffset == type )
|
||||
{
|
||||
pDrawingProperty->bPositionVPosOffset = true;
|
||||
pDrawingProperty->PositionVPosOffset = m_oBufferedStream.GetDouble();
|
||||
pDrawingProperty->PositionVPosOffset = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
|
||||
}
|
||||
else if ( c_oSerPosHV::PosOffsetEmu == type )
|
||||
{
|
||||
pDrawingProperty->bPositionVPosOffset = true;
|
||||
pDrawingProperty->PositionVPosOffset = (__int64)m_oBufferedStream.GetLong();
|
||||
}
|
||||
else if ( c_oSerPosHV::PctOffset == type )
|
||||
{
|
||||
@ -7829,12 +8086,22 @@ public:
|
||||
if ( c_oSerSimplePos::X == type )
|
||||
{
|
||||
pDrawingProperty->bSimplePosX = true;
|
||||
pDrawingProperty->SimplePosX = m_oBufferedStream.GetDouble();
|
||||
pDrawingProperty->SimplePosX = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
|
||||
}
|
||||
else if ( c_oSerSimplePos::XEmu == type )
|
||||
{
|
||||
pDrawingProperty->bSimplePosX = true;
|
||||
pDrawingProperty->SimplePosX = (__int64)m_oBufferedStream.GetLong();
|
||||
}
|
||||
else if ( c_oSerSimplePos::Y == type )
|
||||
{
|
||||
pDrawingProperty->bSimplePosY = true;
|
||||
pDrawingProperty->SimplePosY = m_oBufferedStream.GetDouble();
|
||||
pDrawingProperty->SimplePosY = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
|
||||
}
|
||||
else if ( c_oSerSimplePos::YEmu == type )
|
||||
{
|
||||
pDrawingProperty->bSimplePosY = true;
|
||||
pDrawingProperty->SimplePosY = (__int64)m_oBufferedStream.GetLong();
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
@ -7930,12 +8197,22 @@ public:
|
||||
if ( c_oSerPoint2D::X == type )
|
||||
{
|
||||
pWrapPoint->bX = true;
|
||||
pWrapPoint->X = m_oBufferedStream.GetDouble();
|
||||
pWrapPoint->X = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
|
||||
}
|
||||
else if ( c_oSerPoint2D::XEmu == type )
|
||||
{
|
||||
pWrapPoint->bX = true;
|
||||
pWrapPoint->X = (__int64)m_oBufferedStream.GetLong();
|
||||
}
|
||||
else if ( c_oSerPoint2D::Y == type )
|
||||
{
|
||||
pWrapPoint->bY = true;
|
||||
pWrapPoint->Y = m_oBufferedStream.GetDouble();
|
||||
pWrapPoint->Y = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
|
||||
}
|
||||
else if ( c_oSerPoint2D::YEmu == type )
|
||||
{
|
||||
pWrapPoint->bY = true;
|
||||
pWrapPoint->Y = (__int64)m_oBufferedStream.GetLong();
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
@ -8546,7 +8823,7 @@ public:
|
||||
m_oBufferedStream.Seek(nDocumentOffset);
|
||||
|
||||
m_oFileWriter.m_pDrawingConverter->SetDstContentRels();
|
||||
long stamdartRId;
|
||||
unsigned int stamdartRId;
|
||||
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles", L"styles.xml", L"", &stamdartRId);
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings", L"settings.xml", L"", &stamdartRId);
|
||||
@ -8574,19 +8851,19 @@ public:
|
||||
|
||||
if(false == m_oFileWriter.m_oNumberingWriter.IsEmpty())
|
||||
{
|
||||
long rId;
|
||||
unsigned int rId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering", L"numbering.xml", std::wstring(), &rId);
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml", L"/word", L"numbering.xml");
|
||||
}
|
||||
if(false == m_oFileWriter.m_oFootnotesWriter.IsEmpty())
|
||||
{
|
||||
long rId;
|
||||
unsigned int rId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes", L"footnotes.xml", std::wstring(), &rId);
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml", L"/word", L"footnotes.xml");
|
||||
}
|
||||
if(false == m_oFileWriter.m_oEndnotesWriter.IsEmpty())
|
||||
{
|
||||
long rId;
|
||||
unsigned int rId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes", L"endnotes.xml", std::wstring(), &rId);
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml", L"/word", L"endnotes.xml");
|
||||
}
|
||||
@ -8595,7 +8872,7 @@ public:
|
||||
Writers::HdrFtrItem* pHeader = m_oFileWriter.m_oHeaderFooterWriter.m_aHeaders[i];
|
||||
if(false == pHeader->IsEmpty())
|
||||
{
|
||||
long rId;
|
||||
unsigned int rId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", pHeader->m_sFilename, std::wstring(), &rId);
|
||||
pHeader->rId = L"rId" + std::to_wstring( rId );
|
||||
|
||||
@ -8607,7 +8884,7 @@ public:
|
||||
Writers::HdrFtrItem* pFooter = m_oFileWriter.m_oHeaderFooterWriter.m_aFooters[i];
|
||||
if(false == pFooter->IsEmpty())
|
||||
{
|
||||
long rId;
|
||||
unsigned int rId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", pFooter->m_sFilename, std::wstring(), &rId);
|
||||
pFooter->rId = L"rId" + std::to_wstring( rId );
|
||||
|
||||
@ -8617,7 +8894,7 @@ public:
|
||||
if(!oSettingsCustom.IsEmpty()){
|
||||
std::wstring sFilename = m_oFileWriter.m_oCustomXmlWriter.WriteCustomXml(oSettingsCustom.GetSchemaUrl(), oSettingsCustom.ToXml());
|
||||
std::wstring sRelsPath = L"../" + OOX::FileTypes::CustomXml.DefaultDirectory().GetPath() + L"/" + sFilename;
|
||||
long rId;
|
||||
unsigned int rId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(OOX::FileTypes::CustomXml.RelationType(), sRelsPath, L"", &rId);
|
||||
}
|
||||
|
||||
@ -8638,19 +8915,19 @@ public:
|
||||
|
||||
if(false == oCommentsWriter.m_sComment.empty())
|
||||
{
|
||||
long rId;
|
||||
unsigned int rId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments", L"comments.xml", std::wstring(), &rId);
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml", L"/word", L"comments.xml");
|
||||
}
|
||||
if(false == oCommentsWriter.m_sCommentExt.empty())
|
||||
{
|
||||
long rId;
|
||||
unsigned int rId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.microsoft.com/office/2011/relationships/commentsExtended", L"commentsExtended.xml", std::wstring(), &rId);
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml", L"/word", L"commentsExtended.xml");
|
||||
}
|
||||
if(false == oCommentsWriter.m_sPeople.empty())
|
||||
{
|
||||
long rId;
|
||||
unsigned int rId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.microsoft.com/office/2011/relationships/people", L"people.xml", std::wstring(), &rId);
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.people+xml", L"/word", L"people.xml");
|
||||
}
|
||||
|
||||
@ -1438,8 +1438,8 @@ namespace MathEquation
|
||||
}
|
||||
else if (eType == commandBrackets)
|
||||
{
|
||||
MBRACKETSTYPE ebType;
|
||||
EndBrackets(ebType, false,false);
|
||||
MBRACKETSTYPE ebType = MBRACKETSTYPE::bracketsAngle; //???
|
||||
EndBrackets(ebType, false, false);
|
||||
}
|
||||
}
|
||||
virtual void BeginAngleBracketsWithSeparator(MANGLEBRACKETSWITHSEPARATORTYPE eType)
|
||||
|
||||
@ -36,17 +36,6 @@ namespace BinDocxRW
|
||||
{
|
||||
const double eps = 0.001;
|
||||
|
||||
const int Page_Width = 210;
|
||||
const int Page_Height = 297;
|
||||
|
||||
const int X_Left_Margin = 30; // 3 cm
|
||||
const int X_Right_Margin = 15; // 1.5 cm
|
||||
const int Y_Bottom_Margin = 20; // 2 cm
|
||||
const int Y_Top_Margin = 20; // 2 cm
|
||||
|
||||
const double Y_Default_Header = 12.5; // 1.25 cm расстояние от верха страницы до верха верхнего колонтитула
|
||||
const double Y_Default_Footer = 12.5; // 1.25 cm расстояние от низа страницы до низа нижнего колонтитула
|
||||
|
||||
const int shd_Clear = 0;
|
||||
const int shd_Nil = 1;
|
||||
|
||||
@ -156,7 +145,8 @@ extern int g_nCurFormatVersion;
|
||||
Endnotes = 11,
|
||||
Background = 12,
|
||||
VbaProject = 13,
|
||||
App = 14
|
||||
App = 15,
|
||||
Core = 16
|
||||
};}
|
||||
namespace c_oSerSigTypes{enum c_oSerSigTypes
|
||||
{
|
||||
@ -311,7 +301,9 @@ extern int g_nCurFormatVersion;
|
||||
RowBandSize = 15,
|
||||
ColBandSize = 16,
|
||||
tblCaption = 17,
|
||||
tblDescription = 18
|
||||
tblDescription = 18,
|
||||
TableIndTwips = 19,
|
||||
TableCellSpacingTwips = 20
|
||||
};}
|
||||
namespace c_oSer_tblpPrType{enum c_oSer_tblpPrType
|
||||
{
|
||||
@ -328,7 +320,9 @@ extern int g_nCurFormatVersion;
|
||||
VertAnchor = 3,
|
||||
TblpY = 4,
|
||||
TblpYSpec = 5,
|
||||
Paddings = 6
|
||||
Paddings = 6,
|
||||
TblpXTwips = 7,
|
||||
TblpYTwips = 8
|
||||
};}
|
||||
namespace c_oSerProp_pPrType{enum c_oSerProp_pPrType
|
||||
{
|
||||
@ -365,7 +359,14 @@ extern int g_nCurFormatVersion;
|
||||
numPr_Ins = 32,
|
||||
pPrChange = 33,
|
||||
outlineLvl = 34,
|
||||
Tab_Item_Leader = 35
|
||||
Tab_Item_Leader = 35,
|
||||
Ind_LeftTwips = 36,
|
||||
Ind_RightTwips = 37,
|
||||
Ind_FirstLineTwips = 38,
|
||||
Spacing_LineTwips = 39,
|
||||
Spacing_BeforeTwips = 40,
|
||||
Spacing_AfterTwips = 41,
|
||||
Tab_Item_PosTwips = 42
|
||||
};}
|
||||
namespace c_oSerProp_rPrType{enum c_oSerProp_rPrType
|
||||
{
|
||||
@ -406,7 +407,9 @@ extern int g_nCurFormatVersion;
|
||||
Ins = 34,
|
||||
rPrChange = 35,
|
||||
MoveFrom = 36,
|
||||
MoveTo = 37
|
||||
MoveTo = 37,
|
||||
SpacingTwips = 38,
|
||||
PositionHps = 39
|
||||
};}
|
||||
namespace c_oSerProp_rowPrType{enum c_oSerProp_rowPrType
|
||||
{
|
||||
@ -427,7 +430,9 @@ extern int g_nCurFormatVersion;
|
||||
TableHeader = 14,
|
||||
Del = 15,
|
||||
Ins = 16,
|
||||
trPrChange = 17
|
||||
trPrChange = 17,
|
||||
TableCellSpacingTwips = 18,
|
||||
Height_ValueTwips = 19
|
||||
};}
|
||||
namespace c_oSerProp_cellPrType{enum c_oSerProp_cellPrType
|
||||
{
|
||||
@ -499,8 +504,8 @@ extern int g_nCurFormatVersion;
|
||||
MoveToRangeEnd = 21,
|
||||
JsaProject = 22,
|
||||
BookmarkStart = 23,
|
||||
BookmarkEnd = 24
|
||||
|
||||
BookmarkEnd = 24,
|
||||
MRun = 25
|
||||
};}
|
||||
namespace c_oSerDocTableType{enum c_oSerDocTableType
|
||||
{
|
||||
@ -517,7 +522,8 @@ extern int g_nCurFormatVersion;
|
||||
tblGridChange = 9,
|
||||
Sdt = 10,
|
||||
BookmarkStart = 11,
|
||||
BookmarkEnd = 12
|
||||
BookmarkEnd = 12,
|
||||
tblGrid_ItemTwips = 13
|
||||
};}
|
||||
namespace c_oSerRunType{enum c_oSerRunType
|
||||
{
|
||||
@ -607,26 +613,37 @@ extern int g_nCurFormatVersion;
|
||||
SizeRelV = 28,
|
||||
Embedded = 29,
|
||||
GraphicFramePr = 30,
|
||||
DocPr = 31
|
||||
DocPr = 31,
|
||||
DistBEmu = 32,
|
||||
DistLEmu = 33,
|
||||
DistREmu = 34,
|
||||
DistTEmu = 35
|
||||
};}
|
||||
namespace c_oSerEffectExtent{enum c_oSerEffectExtent
|
||||
{
|
||||
Left = 0,
|
||||
Top = 1,
|
||||
Right = 2,
|
||||
Bottom = 3
|
||||
Bottom = 3,
|
||||
LeftEmu = 4,
|
||||
TopEmu = 5,
|
||||
RightEmu = 6,
|
||||
BottomEmu = 7
|
||||
};}
|
||||
namespace c_oSerExtent{enum c_oSerExtent
|
||||
{
|
||||
Cx = 0,
|
||||
Cy = 1
|
||||
Cy = 1,
|
||||
CxEmu = 2,
|
||||
CyEmu = 3
|
||||
};}
|
||||
namespace c_oSerPosHV{enum c_oSerPosHV
|
||||
{
|
||||
RelativeFrom = 0,
|
||||
Align = 1,
|
||||
PosOffset = 2,
|
||||
PctOffset = 3
|
||||
PctOffset = 3,
|
||||
PosOffsetEmu = 4
|
||||
};}
|
||||
namespace c_oSerSizeRelHV{enum c_oSerSizeRelHV
|
||||
{
|
||||
@ -636,7 +653,9 @@ extern int g_nCurFormatVersion;
|
||||
namespace c_oSerSimplePos{enum c_oSerSimplePos
|
||||
{
|
||||
X = 0,
|
||||
Y = 1
|
||||
Y = 1,
|
||||
XEmu = 2,
|
||||
YEmu = 3
|
||||
};}
|
||||
namespace c_oSerWrapSquare{enum c_oSerWrapSquare
|
||||
{
|
||||
@ -645,20 +664,28 @@ extern int g_nCurFormatVersion;
|
||||
DistR = 2,
|
||||
DistB = 3,
|
||||
WrapText = 4,
|
||||
EffectExtent = 5
|
||||
EffectExtent = 5,
|
||||
DistLEmu = 6,
|
||||
DistTEmu = 7,
|
||||
DistREmu = 8,
|
||||
DistBEmu = 9
|
||||
};}
|
||||
namespace c_oSerWrapThroughTight{enum c_oSerWrapThroughTight
|
||||
{
|
||||
DistL = 0,
|
||||
DistR = 1,
|
||||
WrapText = 2,
|
||||
WrapPolygon = 3
|
||||
WrapPolygon = 3,
|
||||
DistLEmu = 4,
|
||||
DistREmu = 5
|
||||
};}
|
||||
namespace c_oSerWrapTopBottom{enum c_oSerWrapTopBottom
|
||||
{
|
||||
DistT = 0,
|
||||
DistB = 1,
|
||||
EffectExtent = 2
|
||||
EffectExtent = 2,
|
||||
DistTEmu = 3,
|
||||
DistBEmu = 4
|
||||
};}
|
||||
namespace c_oSerWrapPolygon{enum c_oSerWrapPolygon
|
||||
{
|
||||
@ -670,7 +697,9 @@ extern int g_nCurFormatVersion;
|
||||
namespace c_oSerPoint2D{enum c_oSerPoint2D
|
||||
{
|
||||
X = 0,
|
||||
Y = 1
|
||||
Y = 1,
|
||||
XEmu = 2,
|
||||
YEmu = 3
|
||||
};}
|
||||
namespace c_oSerBorderType{enum c_oSerBorderType
|
||||
{
|
||||
@ -678,7 +707,9 @@ extern int g_nCurFormatVersion;
|
||||
Space = 1,
|
||||
Size = 2,
|
||||
Value = 3,
|
||||
ColorTheme = 4
|
||||
ColorTheme = 4,
|
||||
SpacePoint = 5,
|
||||
Size8Point = 6
|
||||
};}
|
||||
namespace c_oSerShdType{enum c_oSerShdType
|
||||
{
|
||||
@ -691,7 +722,11 @@ extern int g_nCurFormatVersion;
|
||||
left = 0,
|
||||
top = 1,
|
||||
right = 2,
|
||||
bottom = 3
|
||||
bottom = 3,
|
||||
leftTwips = 4,
|
||||
topTwips = 5,
|
||||
rightTwips = 6,
|
||||
bottomTwips = 7
|
||||
};}
|
||||
namespace c_oSerMarginsType{enum c_oSerMarginsType
|
||||
{
|
||||
@ -725,7 +760,9 @@ extern int g_nCurFormatVersion;
|
||||
{
|
||||
W = 0,
|
||||
H = 1,
|
||||
Orientation = 2
|
||||
Orientation = 2,
|
||||
WTwips = 3,
|
||||
HTwips = 4
|
||||
};}
|
||||
namespace c_oSer_pgMarType{enum c_oSer_pgMarType
|
||||
{
|
||||
@ -734,7 +771,13 @@ extern int g_nCurFormatVersion;
|
||||
Right = 2,
|
||||
Bottom = 3,
|
||||
Header = 4,
|
||||
Footer = 5
|
||||
Footer = 5,
|
||||
LeftTwips = 6,
|
||||
TopTwips = 7,
|
||||
RightTwips = 8,
|
||||
BottomTwips = 9,
|
||||
HeaderTwips = 10,
|
||||
FooterTwips = 11
|
||||
};}
|
||||
namespace c_oSer_ColorType{enum c_oSer_ColorType
|
||||
{
|
||||
@ -765,7 +808,8 @@ extern int g_nCurFormatVersion;
|
||||
EndnotePr = 5,
|
||||
SdtGlobalColor = 6,
|
||||
SdtGlobalShowHighlight = 7,
|
||||
Compat = 8
|
||||
Compat = 8,
|
||||
DefaultTabStopTwips = 9
|
||||
};}
|
||||
namespace c_oSer_MathPrType{enum c_oSer_SettingsType
|
||||
{
|
||||
@ -860,7 +904,8 @@ extern int g_nCurFormatVersion;
|
||||
namespace c_oSer_OMathBottomNodesValType{enum c_oSer_OMathBottomNodesValType
|
||||
{
|
||||
Val = 0,
|
||||
AlnAt = 1
|
||||
AlnAt = 1,
|
||||
ValTwips = 2
|
||||
};}
|
||||
namespace c_oSer_OMathContentType{enum c_oSer_OMathContentType
|
||||
{
|
||||
|
||||
@ -36,6 +36,8 @@
|
||||
#include "../DocWrapper/FontProcessor.h"
|
||||
#include "../../Common/Base64.h"
|
||||
#include "../../ASCOfficePPTXFile/Editor/FontCutter.h"
|
||||
#include "../../ASCOfficePPTXFile/PPTXFormat/App.h"
|
||||
#include "../../ASCOfficePPTXFile/PPTXFormat/Core.h"
|
||||
#include "../../XlsxSerializerCom/Reader/BinaryWriter.h"
|
||||
#include "BinEquationWriter.h"
|
||||
|
||||
@ -148,15 +150,15 @@ namespace BinDocxRW
|
||||
WriteThemeColor(c_oSerBorderType::ColorTheme, border.m_oColor, border.m_oThemeColor, border.m_oThemeTint, border.m_oThemeShade);
|
||||
if(border.m_oSpace.IsInit())
|
||||
{
|
||||
m_oStream.WriteBYTE(c_oSerBorderType::Space);
|
||||
m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oStream.WriteDouble(border.m_oSpace->ToMM());
|
||||
m_oStream.WriteBYTE(c_oSerBorderType::SpacePoint);
|
||||
m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oStream.WriteLONG(border.m_oSpace->GetValue());
|
||||
}
|
||||
if(border.m_oSz.IsInit())
|
||||
{
|
||||
m_oStream.WriteBYTE(c_oSerBorderType::Size);
|
||||
m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oStream.WriteDouble(border.m_oSz->ToMM());
|
||||
m_oStream.WriteBYTE(c_oSerBorderType::Size8Point);
|
||||
m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oStream.WriteLONG(border.m_oSz->GetValue());
|
||||
}
|
||||
//Val
|
||||
m_oStream.WriteBYTE(c_oSerBorderType::Value);
|
||||
@ -330,70 +332,36 @@ namespace BinDocxRW
|
||||
|
||||
WriteThemeColor(c_oSerShdType::ColorTheme, Shd.m_oFill, Shd.m_oThemeFill, Shd.m_oThemeFillTint, Shd.m_oThemeFillShade);
|
||||
}
|
||||
void WriteDistance(const NSCommon::nullable<SimpleTypes::CWrapDistance<>>& m_oDistL,
|
||||
const NSCommon::nullable<SimpleTypes::CWrapDistance<>>& m_oDistT,
|
||||
const NSCommon::nullable<SimpleTypes::CWrapDistance<>>& m_oDistR,
|
||||
const NSCommon::nullable<SimpleTypes::CWrapDistance<>>& m_oDistB)
|
||||
{
|
||||
//left
|
||||
if(false != m_oDistL.IsInit())
|
||||
{
|
||||
m_oStream.WriteBYTE(c_oSerPaddingType::left);
|
||||
m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oStream.WriteDouble(m_oDistL.get().ToMM());
|
||||
}
|
||||
//top
|
||||
if(false != m_oDistT.IsInit())
|
||||
{
|
||||
m_oStream.WriteBYTE(c_oSerPaddingType::top);
|
||||
m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oStream.WriteDouble(m_oDistT.get().ToMM());
|
||||
}
|
||||
//Right
|
||||
if(false != m_oDistR.IsInit())
|
||||
{
|
||||
m_oStream.WriteBYTE(c_oSerPaddingType::right);
|
||||
m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oStream.WriteDouble(m_oDistR.get().ToMM());
|
||||
}
|
||||
//bottom
|
||||
if(false != m_oDistB.IsInit())
|
||||
{
|
||||
m_oStream.WriteBYTE(c_oSerPaddingType::bottom);
|
||||
m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oStream.WriteDouble(m_oDistB.get().ToMM());
|
||||
}
|
||||
}
|
||||
void WritePaddings(const nullable<SimpleTypes::CTwipsMeasure>& left, const nullable<SimpleTypes::CTwipsMeasure>& top,
|
||||
const nullable<SimpleTypes::CTwipsMeasure>& right, const nullable<SimpleTypes::CTwipsMeasure>& bottom)
|
||||
{
|
||||
//left
|
||||
if(left.IsInit())
|
||||
{
|
||||
m_oStream.WriteBYTE(c_oSerPaddingType::left);
|
||||
m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oStream.WriteDouble(left.get().ToMm());
|
||||
m_oStream.WriteBYTE(c_oSerPaddingType::leftTwips);
|
||||
m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oStream.WriteLONG(left->ToTwips());
|
||||
}
|
||||
//top
|
||||
if(top.IsInit())
|
||||
{
|
||||
m_oStream.WriteBYTE(c_oSerPaddingType::top);
|
||||
m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oStream.WriteDouble(top.get().ToMm());
|
||||
m_oStream.WriteBYTE(c_oSerPaddingType::topTwips);
|
||||
m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oStream.WriteLONG(top->ToTwips());
|
||||
}
|
||||
//Right
|
||||
if(right.IsInit())
|
||||
{
|
||||
m_oStream.WriteBYTE(c_oSerPaddingType::right);
|
||||
m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oStream.WriteDouble(right.get().ToMm());
|
||||
m_oStream.WriteBYTE(c_oSerPaddingType::rightTwips);
|
||||
m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oStream.WriteLONG(right->ToTwips());
|
||||
}
|
||||
//bottom
|
||||
if(bottom.IsInit())
|
||||
{
|
||||
m_oStream.WriteBYTE(c_oSerPaddingType::bottom);
|
||||
m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oStream.WriteDouble(bottom.get().ToMm());
|
||||
m_oStream.WriteBYTE(c_oSerPaddingType::bottomTwips);
|
||||
m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oStream.WriteLONG(bottom->ToTwips());
|
||||
}
|
||||
}
|
||||
void WriteFont(std::wstring& sFontName, BYTE bType, DocWrapper::FontProcessor& m_oFontProcessor)
|
||||
@ -701,9 +669,9 @@ namespace BinDocxRW
|
||||
//Spacing
|
||||
if(false != rPr->m_oSpacing.IsInit() && false != rPr->m_oSpacing->m_oVal.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::Spacing);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(rPr->m_oSpacing->m_oVal->ToMm());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::SpacingTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(rPr->m_oSpacing->m_oVal->ToTwips());
|
||||
}
|
||||
//DStrikeout
|
||||
if(false != rPr->m_oDStrike.IsInit())
|
||||
@ -729,9 +697,9 @@ namespace BinDocxRW
|
||||
//Position
|
||||
if(false != rPr->m_oPosition.IsInit() && false != rPr->m_oPosition->m_oVal.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::Position);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(rPr->m_oPosition->m_oVal->ToMm());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::PositionHps);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(rPr->m_oPosition->m_oVal->ToHps());
|
||||
}
|
||||
//BoldCs
|
||||
if(rPr->m_oBoldCs.IsInit())
|
||||
@ -1066,29 +1034,29 @@ namespace BinDocxRW
|
||||
//Left
|
||||
if(false != Ind.m_oStart.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Ind_Left);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(Ind.m_oStart.get().ToMm());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Ind_LeftTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(Ind.m_oStart.get().ToTwips());
|
||||
}
|
||||
//Right
|
||||
if(false != Ind.m_oEnd.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Ind_Right);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(Ind.m_oEnd.get().ToMm());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Ind_RightTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(Ind.m_oEnd.get().ToTwips());
|
||||
}
|
||||
//FirstLine
|
||||
if(false != Ind.m_oFirstLine.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Ind_FirstLine);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(Ind.m_oFirstLine.get().ToMm());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Ind_FirstLineTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(Ind.m_oFirstLine.get().ToTwips());
|
||||
}
|
||||
else if(false != Ind.m_oHanging.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Ind_FirstLine);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble( -1 * Ind.m_oHanging.get().ToMm());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Ind_FirstLineTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG( -1 * Ind.m_oHanging.get().ToTwips());
|
||||
}
|
||||
}
|
||||
void WriteSpacing(const ComplexTypes::Word::CSpacing& Spacing)
|
||||
@ -1101,24 +1069,9 @@ namespace BinDocxRW
|
||||
//Line
|
||||
if(false != Spacing.m_oLine.IsInit())
|
||||
{
|
||||
const SimpleTypes::CSignedTwipsMeasure& oLine = Spacing.m_oLine.get();
|
||||
double dLineMm = oLine.ToMm();
|
||||
if(dLineMm < 0)
|
||||
{
|
||||
dLineMm = -dLineMm;
|
||||
eLineSpacingRule = SimpleTypes::linespacingruleExact;
|
||||
}
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Spacing_Line);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
if(SimpleTypes::linespacingruleAuto == eLineSpacingRule)
|
||||
{
|
||||
SimpleTypes::CSignedTwipsMeasure oTmp;oTmp.FromPoints(12);//240 twips
|
||||
m_oBcw.m_oStream.WriteDouble(dLineMm / oTmp.ToMm());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_oBcw.m_oStream.WriteDouble(dLineMm);
|
||||
}
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Spacing_LineTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(Spacing.m_oLine->ToTwips());
|
||||
//Write LineRule
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Spacing_LineRule);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
@ -1138,9 +1091,9 @@ namespace BinDocxRW
|
||||
}
|
||||
if(false != Spacing.m_oBefore.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Spacing_Before);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(Spacing.m_oBefore.get().ToMm());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Spacing_BeforeTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(Spacing.m_oBefore.get().ToTwips());
|
||||
}
|
||||
//After
|
||||
if(Spacing.m_oAfterAutospacing.IsInit())
|
||||
@ -1151,9 +1104,9 @@ namespace BinDocxRW
|
||||
}
|
||||
if(false != Spacing.m_oAfter.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Spacing_After);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(Spacing.m_oAfter.get().ToMm());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Spacing_AfterTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(Spacing.m_oAfter.get().ToTwips());
|
||||
}
|
||||
}
|
||||
void WriteTabs(const OOX::Logic::CTabs& Tab, const nullable<ComplexTypes::Word::CInd>& oInd)
|
||||
@ -1197,9 +1150,9 @@ namespace BinDocxRW
|
||||
//pos
|
||||
if(false != TabItem.m_oPos.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Tab_Item_Pos);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(TabItem.m_oPos.get().ToMm());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Tab_Item_PosTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(TabItem.m_oPos.get().ToTwips());
|
||||
}
|
||||
if(false != TabItem.m_oLeader.IsInit())
|
||||
{
|
||||
@ -1425,93 +1378,78 @@ namespace BinDocxRW
|
||||
}
|
||||
void WritePageSize(OOX::Logic::CSectionProperty* pSectPr)
|
||||
{
|
||||
double W = Page_Width;
|
||||
double H = Page_Height;
|
||||
BYTE Orientation = orientation_Portrait;
|
||||
if(NULL != pSectPr && pSectPr->m_oPgSz.IsInit())
|
||||
{
|
||||
const ComplexTypes::Word::CPageSz& pSz = pSectPr->m_oPgSz.get();
|
||||
if(pSz.m_oW.IsInit())
|
||||
W = pSz.m_oW.get().ToMm();
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgSzType::WTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(pSz.m_oW->ToTwips());
|
||||
}
|
||||
if(pSz.m_oH.IsInit())
|
||||
H = pSz.m_oH.get().ToMm();
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgSzType::HTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(pSz.m_oH->ToTwips());
|
||||
}
|
||||
if(pSz.m_oOrient.IsInit())
|
||||
{
|
||||
BYTE Orientation = orientation_Portrait;
|
||||
switch(pSz.m_oOrient.get().GetValue())
|
||||
{
|
||||
case SimpleTypes::pageorientPortrait: Orientation = orientation_Portrait;break;
|
||||
case SimpleTypes::pageorientLandscape: Orientation = orientation_Landscape;break;
|
||||
default: break;
|
||||
}
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgSzType::Orientation);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE(Orientation);
|
||||
}
|
||||
}
|
||||
//W
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgSzType::W);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(W);
|
||||
//H
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgSzType::H);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(H);
|
||||
//Orientation
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgSzType::Orientation);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE(Orientation);
|
||||
}
|
||||
void WritePageMargin(OOX::Logic::CSectionProperty* pSectPr)
|
||||
{
|
||||
double H = Page_Height;
|
||||
double L = X_Left_Margin;
|
||||
double T = Y_Top_Margin;
|
||||
double R = X_Right_Margin;
|
||||
double B = Y_Bottom_Margin;
|
||||
double Header = Y_Default_Header;
|
||||
double Footer = Y_Default_Footer;
|
||||
|
||||
if(NULL != pSectPr && pSectPr->m_oPgSz.IsInit() && pSectPr->m_oPgMar.IsInit())
|
||||
{
|
||||
const ComplexTypes::Word::CPageSz& pSz = pSectPr->m_oPgSz.get();
|
||||
if(pSz.m_oH.IsInit())
|
||||
H = pSz.m_oH.get().ToMm();
|
||||
|
||||
const ComplexTypes::Word::CPageMar& pMar = pSectPr->m_oPgMar.get();
|
||||
if(pMar.m_oLeft.IsInit())
|
||||
L = pMar.m_oLeft.get().ToMm();
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgMarType::LeftTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(pMar.m_oLeft->ToTwips());
|
||||
}
|
||||
if(pMar.m_oTop.IsInit())
|
||||
T = pMar.m_oTop.get().ToMm();
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgMarType::TopTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(pMar.m_oTop->ToTwips());
|
||||
}
|
||||
if(pMar.m_oRight.IsInit())
|
||||
R = pMar.m_oRight.get().ToMm();
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgMarType::RightTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(pMar.m_oRight->ToTwips());
|
||||
}
|
||||
if(pMar.m_oBottom.IsInit())
|
||||
B = pMar.m_oBottom.get().ToMm();
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgMarType::BottomTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(pMar.m_oBottom->ToTwips());
|
||||
}
|
||||
if(pMar.m_oHeader.IsInit())
|
||||
Header = pMar.m_oHeader.get().ToMm();
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgMarType::HeaderTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(pMar.m_oHeader->ToTwips());
|
||||
}
|
||||
if(pMar.m_oFooter.IsInit())
|
||||
Footer = pMar.m_oFooter.get().ToMm();
|
||||
}
|
||||
//Left
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgMarType::Left);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(L);
|
||||
//Top
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgMarType::Top);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(T);
|
||||
//Right
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgMarType::Right);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(R);
|
||||
//Bottom
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgMarType::Bottom);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(B);
|
||||
//Header
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgMarType::Header);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(Header);
|
||||
//Footer
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgMarType::Footer);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(Footer);
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgMarType::FooterTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(pMar.m_oFooter->ToTwips());
|
||||
}
|
||||
}
|
||||
}
|
||||
void WriteHeaderFooter(OOX::Logic::CSectionProperty* pSectPr, std::vector<ComplexTypes::Word::CHdrFtrRef*>& aRefs, bool bHdr)
|
||||
{
|
||||
@ -1816,11 +1754,8 @@ namespace BinDocxRW
|
||||
if(tblPr.m_oTblInd->m_oW.IsInit() && false == tblPr.m_oTblInd->m_oW->IsPercent() &&
|
||||
tblPr.m_oTblInd->m_oType.IsInit() && SimpleTypes::tblwidthDxa == tblPr.m_oTblInd->m_oType->GetValue())
|
||||
{
|
||||
SimpleTypes::CPoint oPoint;
|
||||
oPoint.FromTwips(tblPr.m_oTblInd->m_oW->GetValue());
|
||||
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerProp_tblPrType::TableInd);
|
||||
m_oBcw.m_oStream.WriteDouble(oPoint.ToMm());
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerProp_tblPrType::TableIndTwips);
|
||||
m_oBcw.m_oStream.WriteLONG(tblPr.m_oTblInd->m_oW->GetValue());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
@ -1886,11 +1821,8 @@ namespace BinDocxRW
|
||||
if(cs.m_oW.IsInit() && false == cs.m_oW->IsPercent() &&
|
||||
cs.m_oType.IsInit() && SimpleTypes::tblwidthDxa == cs.m_oType->GetValue())
|
||||
{
|
||||
SimpleTypes::CPoint oPoint;
|
||||
oPoint.FromTwips(cs.m_oW->GetValue());
|
||||
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerProp_tblPrType::TableCellSpacing);
|
||||
m_oBcw.m_oStream.WriteDouble(oPoint.ToMm() * 2);//Умножаем на 2 из-за разного понимания cellSpacing
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerProp_tblPrType::TableCellSpacingTwips);
|
||||
m_oBcw.m_oStream.WriteLONG(cs.m_oW->GetValue());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
@ -1948,9 +1880,9 @@ namespace BinDocxRW
|
||||
}
|
||||
if(pr.m_oTblpX.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_tblpPrType2::TblpX);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(pr.m_oTblpX->ToMm());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_tblpPrType2::TblpXTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(pr.m_oTblpX->ToTwips());
|
||||
}
|
||||
if(pr.m_oTblpXSpec.IsInit())
|
||||
{
|
||||
@ -1966,9 +1898,9 @@ namespace BinDocxRW
|
||||
}
|
||||
if(pr.m_oTblpY.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_tblpPrType2::TblpY);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(pr.m_oTblpY->ToMm());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_tblpPrType2::TblpYTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(pr.m_oTblpY->ToTwips());
|
||||
}
|
||||
if(pr.m_oTblpYSpec.IsInit())
|
||||
{
|
||||
@ -2035,12 +1967,9 @@ namespace BinDocxRW
|
||||
if(cs.m_oW.IsInit() && false == cs.m_oW->IsPercent() &&
|
||||
cs.m_oType.IsInit() && SimpleTypes::tblwidthDxa == cs.m_oType->GetValue())
|
||||
{
|
||||
SimpleTypes::CPoint oPoint;
|
||||
oPoint.FromTwips(cs.m_oW->GetValue());
|
||||
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rowPrType::TableCellSpacing);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(oPoint.ToMm() * 2);//Умножаем на 2 из-за разного понимания cellSpacing
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rowPrType::TableCellSpacingTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(cs.m_oW->GetValue());
|
||||
}
|
||||
}
|
||||
//Height
|
||||
@ -2133,9 +2062,9 @@ namespace BinDocxRW
|
||||
|
||||
|
||||
//Value
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rowPrType::Height_Value);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(rowHeight.m_oVal->ToMm());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rowPrType::Height_ValueTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(rowHeight.m_oVal->ToTwips());
|
||||
}
|
||||
}
|
||||
void WriteW(int nType, const ComplexTypes::Word::CTblWidth& tableW, bool bWrite2 = false)
|
||||
@ -3505,6 +3434,14 @@ namespace BinDocxRW
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
break;
|
||||
}
|
||||
case OOX::et_m_r:
|
||||
{
|
||||
OOX::Logic::CMRun* pMRun = static_cast<OOX::Logic::CMRun*>(item);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::MRun);
|
||||
WriteMathRunContent(pMRun);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -4114,6 +4051,14 @@ namespace BinDocxRW
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
break;
|
||||
}
|
||||
case OOX::et_w_del:
|
||||
{
|
||||
OOX::Logic::CDel* pDel = static_cast<OOX::Logic::CDel*>(item);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_OMathContentType::Del);
|
||||
WriteDel(*pDel);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
break;
|
||||
}
|
||||
case OOX::et_m_eqArr:
|
||||
{
|
||||
OOX::Logic::CEqArr* pEqArr = static_cast<OOX::Logic::CEqArr*>(item);
|
||||
@ -4166,6 +4111,14 @@ namespace BinDocxRW
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
break;
|
||||
}
|
||||
case OOX::et_w_ins:
|
||||
{
|
||||
OOX::Logic::CIns* pIns = static_cast<OOX::Logic::CIns*>(item);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_OMathContentType::Ins);
|
||||
WriteIns(*pIns);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
break;
|
||||
}
|
||||
case OOX::et_m_limLow:
|
||||
{
|
||||
OOX::Logic::CLimLow* pLimLow = static_cast<OOX::Logic::CLimLow*>(item);
|
||||
@ -6117,27 +6070,28 @@ namespace BinDocxRW
|
||||
}
|
||||
if(pAnchor.m_oDistL.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerImageType2::DistL);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(pAnchor.m_oDistL->ToMM());
|
||||
//document is corrupted if the value is greater UINT32
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerImageType2::DistLEmu);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteULONG((_UINT32)pAnchor.m_oDistL->GetValue());
|
||||
}
|
||||
if(pAnchor.m_oDistT.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerImageType2::DistT);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(pAnchor.m_oDistT->ToMM());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerImageType2::DistTEmu);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteULONG((_UINT32)pAnchor.m_oDistT->GetValue());
|
||||
}
|
||||
if(pAnchor.m_oDistR.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerImageType2::DistR);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(pAnchor.m_oDistR->ToMM());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerImageType2::DistREmu);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteULONG((_UINT32)pAnchor.m_oDistR->GetValue());
|
||||
}
|
||||
if(pAnchor.m_oDistB.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerImageType2::DistB);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(pAnchor.m_oDistB->ToMM());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerImageType2::DistBEmu);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteULONG((_UINT32)pAnchor.m_oDistB->GetValue());
|
||||
}
|
||||
if(pAnchor.m_oHidden.IsInit())
|
||||
{
|
||||
@ -6356,34 +6310,39 @@ namespace BinDocxRW
|
||||
}
|
||||
void WriteEffectExtent(const OOX::Drawing::CEffectExtent& oEffectExtent)
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerEffectExtent::Left);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(oEffectExtent.m_oL.ToMm());
|
||||
int nCurPos = 0;
|
||||
//document is corrupted if the value is greater INT32
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerEffectExtent::LeftEmu);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG((_INT32)oEffectExtent.m_oL.ToEmu());
|
||||
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerEffectExtent::Top);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(oEffectExtent.m_oT.ToMm());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerEffectExtent::TopEmu);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG((_INT32)oEffectExtent.m_oT.ToEmu());
|
||||
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerEffectExtent::Right);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(oEffectExtent.m_oR.ToMm());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerEffectExtent::RightEmu);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG((_INT32)oEffectExtent.m_oR.ToEmu());
|
||||
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerEffectExtent::Bottom);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(oEffectExtent.m_oB.ToMm());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerEffectExtent::BottomEmu);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG((_INT32)oEffectExtent.m_oB.ToEmu());
|
||||
}
|
||||
void WriteExtent(const ComplexTypes::Drawing::CPositiveSize2D& oExtent)
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerExtent::Cx);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(oExtent.m_oCx.ToMM());
|
||||
int nCurPos = 0;
|
||||
//document is corrupted if the value is greater UINT32
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerExtent::CxEmu);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteULONG((_UINT32)oExtent.m_oCx.GetValue());
|
||||
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerExtent::Cy);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(oExtent.m_oCy.ToMM());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerExtent::CyEmu);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteULONG((_UINT32)oExtent.m_oCy.GetValue());
|
||||
}
|
||||
void WritePositionH(const OOX::Drawing::CPosH& oPosH)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oPosH.m_oRelativeFrom.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPosHV::RelativeFrom);
|
||||
@ -6398,9 +6357,10 @@ namespace BinDocxRW
|
||||
}
|
||||
if(oPosH.m_oPosOffset.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPosHV::PosOffset);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(oPosH.m_oPosOffset->ToMM());
|
||||
//document is corrupted if the value is greater INT32
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPosHV::PosOffsetEmu);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG((_INT32)oPosH.m_oPosOffset->GetValue());
|
||||
}
|
||||
if(oPosH.m_oPctOffset.IsInit())
|
||||
{
|
||||
@ -6411,6 +6371,7 @@ namespace BinDocxRW
|
||||
}
|
||||
void WritePositionV(const OOX::Drawing::CPosV& oPosV)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oPosV.m_oRelativeFrom.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPosHV::RelativeFrom);
|
||||
@ -6425,9 +6386,9 @@ namespace BinDocxRW
|
||||
}
|
||||
if(oPosV.m_oPosOffset.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPosHV::PosOffset);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(oPosV.m_oPosOffset->ToMM());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPosHV::PosOffsetEmu);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG((_INT32)oPosV.m_oPosOffset->GetValue());
|
||||
}
|
||||
if(oPosV.m_oPctOffset.IsInit())
|
||||
{
|
||||
@ -6468,40 +6429,43 @@ namespace BinDocxRW
|
||||
}
|
||||
void WriteSimplePos(const ComplexTypes::Drawing::CPoint2D& oSimplePos)
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerSimplePos::X);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(oSimplePos.m_oX.ToMm());
|
||||
int nCurPos = 0;
|
||||
//document is corrupted if the value is greater INT32
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerSimplePos::XEmu);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG((_INT32)oSimplePos.m_oX.GetValue());
|
||||
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerSimplePos::Y);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(oSimplePos.m_oY.ToMm());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerSimplePos::YEmu);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG((_INT32)oSimplePos.m_oY.GetValue());
|
||||
}
|
||||
void WriteWrapSquare(const OOX::Drawing::CWrapSquare& oWrapSquare)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oWrapSquare.m_oDistL.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapSquare::DistL);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(oWrapSquare.m_oDistL->ToMM());
|
||||
//document is corrupted if the value is greater UINT32
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapSquare::DistLEmu);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteULONG((_UINT32)oWrapSquare.m_oDistL->GetValue());
|
||||
}
|
||||
if(oWrapSquare.m_oDistT.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapSquare::DistT);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(oWrapSquare.m_oDistT->ToMM());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapSquare::DistTEmu);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteULONG((_UINT32)oWrapSquare.m_oDistT->GetValue());
|
||||
}
|
||||
if(oWrapSquare.m_oDistR.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapSquare::DistR);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(oWrapSquare.m_oDistR->ToMM());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapSquare::DistREmu);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteULONG((_UINT32)oWrapSquare.m_oDistR->GetValue());
|
||||
}
|
||||
if(oWrapSquare.m_oDistB.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapSquare::DistB);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(oWrapSquare.m_oDistB->ToMM());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapSquare::DistBEmu);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteULONG((_UINT32)oWrapSquare.m_oDistB->GetValue());
|
||||
}
|
||||
if(oWrapSquare.m_oWrapText.IsInit())
|
||||
{
|
||||
@ -6524,15 +6488,16 @@ namespace BinDocxRW
|
||||
int nCurPos = 0;
|
||||
if(oWrapThrough.m_oDistL.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapThroughTight::DistL);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(oWrapThrough.m_oDistL->ToMM());
|
||||
//document is corrupted if the value is greater UINT32
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapThroughTight::DistLEmu);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteULONG((_UINT32)oWrapThrough.m_oDistL->GetValue());
|
||||
}
|
||||
if(oWrapThrough.m_oDistR.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapThroughTight::DistR);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(oWrapThrough.m_oDistR->ToMM());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapThroughTight::DistREmu);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteULONG((_UINT32)oWrapThrough.m_oDistR->GetValue());
|
||||
}
|
||||
if(oWrapThrough.m_oWrapText.IsInit())
|
||||
{
|
||||
@ -6555,15 +6520,16 @@ namespace BinDocxRW
|
||||
int nCurPos = 0;
|
||||
if(oWrapTight.m_oDistL.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapThroughTight::DistL);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(oWrapTight.m_oDistL->ToMM());
|
||||
//document is corrupted if the value is greater UINT32
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapThroughTight::DistLEmu);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteULONG((_UINT32)oWrapTight.m_oDistL->GetValue());
|
||||
}
|
||||
if(oWrapTight.m_oDistR.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapThroughTight::DistR);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(oWrapTight.m_oDistR->ToMM());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapThroughTight::DistREmu);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteULONG((_UINT32)oWrapTight.m_oDistR->GetValue());
|
||||
}
|
||||
if(oWrapTight.m_oWrapText.IsInit())
|
||||
{
|
||||
@ -6586,23 +6552,23 @@ namespace BinDocxRW
|
||||
int nCurPos = 0;
|
||||
if(oWrapTopBottom.m_oDistT.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapTopBottom::DistT);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(oWrapTopBottom.m_oDistT->ToMM());
|
||||
//document is corrupted if the value is greater UINT32
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapTopBottom::DistTEmu);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteULONG((_UINT32)oWrapTopBottom.m_oDistT->GetValue());
|
||||
}
|
||||
if(oWrapTopBottom.m_oDistB.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapTopBottom::DistB);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(oWrapTopBottom.m_oDistB->ToMM());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapTopBottom::DistBEmu);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteULONG((_UINT32)oWrapTopBottom.m_oDistB->GetValue());
|
||||
}
|
||||
if(oWrapTopBottom.m_oEffectExtent.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapTopBottom::EffectExtent);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
|
||||
|
||||
nCurPos = m_oBcw.WriteItemWithLengthStart();
|
||||
WriteEffectExtent(oWrapTopBottom.m_oEffectExtent.get());
|
||||
WriteEffectExtent(oWrapTopBottom.m_oEffectExtent.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
@ -6619,9 +6585,8 @@ namespace BinDocxRW
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapPolygon::Start);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
|
||||
|
||||
nCurPos = m_oBcw.WriteItemWithLengthStart();
|
||||
WritePoint2D(oWrapPath.m_oStart.get());
|
||||
WritePoint2D(oWrapPath.m_oStart.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(oWrapPath.m_arrLineTo.size() > 0)
|
||||
@ -6648,14 +6613,15 @@ namespace BinDocxRW
|
||||
}
|
||||
void WritePoint2D(const ComplexTypes::Drawing::CPoint2D& oPoint2D)
|
||||
{
|
||||
//document is corrupted if the value is greater INT32
|
||||
int nCurPos = 0;
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPoint2D::X);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(oPoint2D.m_oX.ToMm());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPoint2D::XEmu);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG((_INT32)oPoint2D.m_oX.ToEmu());
|
||||
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPoint2D::Y);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(oPoint2D.m_oY.ToMm());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPoint2D::YEmu);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG((_INT32)oPoint2D.m_oY.ToEmu());
|
||||
}
|
||||
void WriteDocTable(OOX::Logic::CTbl* tbl)
|
||||
{
|
||||
@ -6856,9 +6822,9 @@ namespace BinDocxRW
|
||||
const ComplexTypes::Word::CTblGridCol& item = *grid.m_arrGridCol[i];
|
||||
if(item.m_oW.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerDocTableType::tblGrid_Item);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(item.m_oW->ToMm());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerDocTableType::tblGrid_ItemTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(item.m_oW->ToTwips());
|
||||
}
|
||||
}
|
||||
if(grid.m_oTblGridChange.IsInit())
|
||||
@ -7533,8 +7499,8 @@ namespace BinDocxRW
|
||||
}
|
||||
if(oSettings.m_oDefaultTabStop.IsInit() && oSettings.m_oDefaultTabStop->m_oVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_SettingsType::DefaultTabStop);
|
||||
m_oBcw.m_oStream.WriteDouble(oSettings.m_oDefaultTabStop->m_oVal->ToMm());
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_SettingsType::DefaultTabStopTwips);
|
||||
m_oBcw.m_oStream.WriteLONG(oSettings.m_oDefaultTabStop->m_oVal->ToTwips());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oSettings.m_oMathPr.IsInit())
|
||||
@ -7651,9 +7617,9 @@ namespace BinDocxRW
|
||||
int nCurPos = m_oBcw.WriteItemStart(c_oSer_MathPrType::InterSp);
|
||||
if (pInterSp->m_val.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_OMathBottomNodesValType::Val);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(pInterSp->m_val->ToMm());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_OMathBottomNodesValType::ValTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(pInterSp->m_val->ToTwips());
|
||||
}
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
break;
|
||||
@ -7677,9 +7643,9 @@ namespace BinDocxRW
|
||||
int nCurPos = m_oBcw.WriteItemStart(c_oSer_MathPrType::IntraSp);
|
||||
if (pIntraSp->m_val.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_OMathBottomNodesValType::Val);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(pIntraSp->m_val->ToMm());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_OMathBottomNodesValType::ValTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(pIntraSp->m_val->ToTwips());
|
||||
}
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
break;
|
||||
@ -7690,9 +7656,9 @@ namespace BinDocxRW
|
||||
int nCurPos = m_oBcw.WriteItemStart(c_oSer_MathPrType::LMargin);
|
||||
if (pLMargin->m_val.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_OMathBottomNodesValType::Val);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(pLMargin->m_val->ToMm());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_OMathBottomNodesValType::ValTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(pLMargin->m_val->ToTwips());
|
||||
}
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
break;
|
||||
@ -7729,9 +7695,9 @@ namespace BinDocxRW
|
||||
int nCurPos = m_oBcw.WriteItemStart(c_oSer_MathPrType::PostSp);
|
||||
if (pPostSp->m_val.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_OMathBottomNodesValType::Val);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(pPostSp->m_val->ToMm());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_OMathBottomNodesValType::ValTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(pPostSp->m_val->ToTwips());
|
||||
}
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
break;
|
||||
@ -7742,9 +7708,9 @@ namespace BinDocxRW
|
||||
int nCurPos = m_oBcw.WriteItemStart(c_oSer_MathPrType::PreSp);
|
||||
if (pPreSp->m_val.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_OMathBottomNodesValType::Val);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(pPreSp->m_val->ToMm());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_OMathBottomNodesValType::ValTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(pPreSp->m_val->ToTwips());
|
||||
}
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
break;
|
||||
@ -7755,9 +7721,9 @@ namespace BinDocxRW
|
||||
int nCurPos = m_oBcw.WriteItemStart(c_oSer_MathPrType::RMargin);
|
||||
if (pRMargin->m_val.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_OMathBottomNodesValType::Val);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(pRMargin->m_val->ToMm());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_OMathBottomNodesValType::ValTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(pRMargin->m_val->ToTwips());
|
||||
}
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
break;
|
||||
@ -7781,9 +7747,9 @@ namespace BinDocxRW
|
||||
int nCurPos = m_oBcw.WriteItemStart(c_oSer_MathPrType::WrapIndent);
|
||||
if (pWrapIndent->m_val.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_OMathBottomNodesValType::Val);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
|
||||
m_oBcw.m_oStream.WriteDouble(pWrapIndent->m_val->ToMm());
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSer_OMathBottomNodesValType::ValTwips);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(pWrapIndent->m_val->ToTwips());
|
||||
}
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
break;
|
||||
@ -7997,38 +7963,6 @@ namespace BinDocxRW
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
};
|
||||
class BinaryAppTableWriter
|
||||
{
|
||||
BinaryCommonWriter m_oBcw;
|
||||
ParamsWriter& m_oParamsWriter;
|
||||
public:
|
||||
BinaryAppTableWriter(ParamsWriter& oParamsWriter):
|
||||
m_oBcw(oParamsWriter),m_oParamsWriter(oParamsWriter)
|
||||
{
|
||||
}
|
||||
void Write(OOX::CApp& oApp)
|
||||
{
|
||||
int nStart = m_oBcw.WriteItemWithLengthStart();
|
||||
WriteProperties(oApp);
|
||||
m_oBcw.WriteItemWithLengthEnd(nStart);
|
||||
}
|
||||
void WriteProperties(OOX::CApp& oApp)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if (oApp.m_sApplication.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerApp::Application);
|
||||
m_oBcw.m_oStream.WriteStringW3(oApp.m_sApplication.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if (oApp.m_sAppVersion.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerApp::AppVersion);
|
||||
m_oBcw.m_oStream.WriteStringW3(oApp.m_sAppVersion.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
};
|
||||
class BinaryFileWriter
|
||||
{
|
||||
BinaryCommonWriter m_oBcw;
|
||||
@ -8184,9 +8118,15 @@ namespace BinDocxRW
|
||||
//Write App
|
||||
if(NULL != oDocx.m_pApp)
|
||||
{
|
||||
BinDocxRW::BinaryAppTableWriter oBinaryAppWriter(m_oParamsWriter);
|
||||
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::App);
|
||||
oBinaryAppWriter.Write(*oDocx.m_pApp);
|
||||
oDocx.m_pApp->ToPptxApp()->toPPTY(&oBufferedStream);
|
||||
this->WriteTableEnd(nCurPos);
|
||||
}
|
||||
|
||||
if(NULL != oDocx.m_pCore)
|
||||
{
|
||||
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Core);
|
||||
oDocx.m_pCore->ToPptxCore()->toPPTY(&oBufferedStream);
|
||||
this->WriteTableEnd(nCurPos);
|
||||
}
|
||||
|
||||
|
||||
@ -282,7 +282,7 @@ namespace BinXlsxRW{
|
||||
{
|
||||
OOX::Spreadsheet::CTableColumn* pTableColumn = new OOX::Spreadsheet::CTableColumn();
|
||||
pTableColumn->m_oId.Init();
|
||||
pTableColumn->m_oId->SetValue(i + 1);
|
||||
pTableColumn->m_oId->SetValue((unsigned int)i + 1);
|
||||
pTableColumn->m_oName.Init();
|
||||
pTableColumn->m_oName->append(m_aTableNames[i]);
|
||||
pTable->m_oTable->m_oTableColumns->m_arrItems.push_back(pTableColumn);
|
||||
@ -604,7 +604,7 @@ namespace BinXlsxRW{
|
||||
// Не число
|
||||
aSharedStrings.push_back(val);
|
||||
pCell->m_oType->SetValue(SimpleTypes::Spreadsheet::celltypeSharedString);
|
||||
pCell->m_oValue->m_sText = std::to_wstring(aSharedStrings.size() - 1);
|
||||
pCell->m_oValue->m_sText = std::to_wstring((int)aSharedStrings.size() - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -658,7 +658,7 @@ namespace BinXlsxRW{
|
||||
|
||||
if(NULL != format)
|
||||
{
|
||||
int nXfsIndex = m_aXfs.size();
|
||||
int nXfsIndex = (int)m_aXfs.size();
|
||||
|
||||
boost::unordered_map<std::wstring, int>::const_iterator itFormat = m_mapFormats.find(*format);
|
||||
if(itFormat == m_mapFormats.end())
|
||||
|
||||
@ -196,7 +196,7 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
|
||||
bool bValidFormat = false;
|
||||
std::wstring sSignature(g_sFormatSignature);
|
||||
int nSigLength = (int)sSignature.length();
|
||||
if(nBase64DataSize > nSigLength)
|
||||
if((int)nBase64DataSize > nSigLength)
|
||||
{
|
||||
std::string sCurSig((char*)pBase64Data, nSigLength);
|
||||
if(sSignature == std::wstring(sCurSig.begin(), sCurSig.end()))
|
||||
|
||||
@ -186,7 +186,7 @@ namespace BinXlsxRW{
|
||||
pReader->m_pRels->m_pManager->m_pContentTypes->AddDefault(L"xlsx");
|
||||
|
||||
std::wstring sChartsWorksheetRelsName = L"../embeddings/" + sXlsxFilename;
|
||||
long rId;
|
||||
unsigned int rId;
|
||||
std::wstring bstrChartsWorksheetRelType = OOX::FileTypes::MicrosoftOfficeExcelWorksheet.RelationType();
|
||||
m_pExternalDrawingConverter->WriteRels(bstrChartsWorksheetRelType, sChartsWorksheetRelsName, std::wstring(), &rId);
|
||||
|
||||
@ -265,4 +265,11 @@ namespace BinXlsxRW{
|
||||
NSDirectory::DeleteDirectory(sTempDir);
|
||||
return res;
|
||||
}
|
||||
bool CXlsxSerializer::hasPivot(const std::wstring& sSrcPath)
|
||||
{
|
||||
//todo CXlsx
|
||||
std::wstring sData;
|
||||
NSFile::CFileBinary::ReadAllTextUtf8(sSrcPath + FILE_SEPARATOR_STR + L"[Content_Types].xml", sData);
|
||||
return std::wstring::npos != sData.find(OOX::Spreadsheet::FileTypes::PivotTable.OverrideType());
|
||||
}
|
||||
};
|
||||
|
||||
@ -74,6 +74,7 @@ namespace BinXlsxRW {
|
||||
void setIsNoBase64 (bool bIsNoBase64);
|
||||
|
||||
bool writeChartXlsx (const std::wstring& sDstFile ,const OOX::Spreadsheet::CChartSpace& oChart);
|
||||
bool hasPivot (const std::wstring& sSrcPath);
|
||||
};
|
||||
}
|
||||
#endif // #ifndef XLSX_SERIALIZER
|
||||
|
||||
@ -55,10 +55,6 @@
|
||||
8A404FD5208A01CE00F2D5CF /* FileDownloader_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A404FD4208A01CE00F2D5CF /* FileDownloader_private.h */; };
|
||||
8AB24BFD213004E400E80DDD /* CustormXmlWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AB24BFB213004E300E80DDD /* CustormXmlWriter.cpp */; };
|
||||
8AB24BFE213004E400E80DDD /* CustormXmlWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 8AB24BFC213004E300E80DDD /* CustormXmlWriter.h */; };
|
||||
8AC6D2052130146000D9C0F1 /* xmlutils.h in Headers */ = {isa = PBXBuildFile; fileRef = 8AC6D2042130146000D9C0F1 /* xmlutils.h */; };
|
||||
8AC6D2092130146800D9C0F1 /* xmllight_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 8AC6D2062130146800D9C0F1 /* xmllight_private.h */; };
|
||||
8AC6D20A2130146800D9C0F1 /* xmldom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AC6D2072130146800D9C0F1 /* xmldom.cpp */; };
|
||||
8AC6D20B2130146800D9C0F1 /* xmllight.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AC6D2082130146800D9C0F1 /* xmllight.cpp */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
@ -111,10 +107,6 @@
|
||||
8A404FD4208A01CE00F2D5CF /* FileDownloader_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileDownloader_private.h; path = ../../../Common/FileDownloader/FileDownloader_private.h; sourceTree = "<group>"; };
|
||||
8AB24BFB213004E300E80DDD /* CustormXmlWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CustormXmlWriter.cpp; sourceTree = "<group>"; };
|
||||
8AB24BFC213004E300E80DDD /* CustormXmlWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustormXmlWriter.h; sourceTree = "<group>"; };
|
||||
8AC6D2042130146000D9C0F1 /* xmlutils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = xmlutils.h; path = ../../../DesktopEditor/xml/include/xmlutils.h; sourceTree = "<group>"; };
|
||||
8AC6D2062130146800D9C0F1 /* xmllight_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = xmllight_private.h; path = ../../../DesktopEditor/xml/src/xmllight_private.h; sourceTree = "<group>"; };
|
||||
8AC6D2072130146800D9C0F1 /* xmldom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = xmldom.cpp; path = ../../../DesktopEditor/xml/src/xmldom.cpp; sourceTree = "<group>"; };
|
||||
8AC6D2082130146800D9C0F1 /* xmllight.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = xmllight.cpp; path = ../../../DesktopEditor/xml/src/xmllight.cpp; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -147,7 +139,6 @@
|
||||
17E17EDE1AC453F800BEA2EA /* ASCOfficeDocxFile2Lib */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8AC6D2032130145600D9C0F1 /* XmlUtils */,
|
||||
17E17F4D1AC454E200BEA2EA /* Common */,
|
||||
17E17F1A1AC4549B00BEA2EA /* XlsxSerializerCom */,
|
||||
17E17F0D1AC4546100BEA2EA /* DocWrapper */,
|
||||
@ -267,17 +258,6 @@
|
||||
name = BinWriter;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8AC6D2032130145600D9C0F1 /* XmlUtils */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8AC6D2072130146800D9C0F1 /* xmldom.cpp */,
|
||||
8AC6D2062130146800D9C0F1 /* xmllight_private.h */,
|
||||
8AC6D2082130146800D9C0F1 /* xmllight.cpp */,
|
||||
8AC6D2042130146000D9C0F1 /* xmlutils.h */,
|
||||
);
|
||||
name = XmlUtils;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
@ -302,9 +282,7 @@
|
||||
17C1FEAD1ACC42C4006B99B3 /* ChartWriter.h in Headers */,
|
||||
17C1FEAE1ACC42C4006B99B3 /* DocumentRelsWriter.h in Headers */,
|
||||
17C1FEAF1ACC42C4006B99B3 /* CommentsWriter.h in Headers */,
|
||||
8AC6D2052130146000D9C0F1 /* xmlutils.h in Headers */,
|
||||
69F181AF1C77274E00B2952B /* FileDownloader.h in Headers */,
|
||||
8AC6D2092130146800D9C0F1 /* xmllight_private.h in Headers */,
|
||||
17C1FEB01ACC42C4006B99B3 /* BinaryCommonReader.h in Headers */,
|
||||
17C1FEB11ACC42C4006B99B3 /* Common.h in Headers */,
|
||||
8A404FD5208A01CE00F2D5CF /* FileDownloader_private.h in Headers */,
|
||||
@ -381,14 +359,12 @@
|
||||
17C1FE981ACC42C4006B99B3 /* CSVReader.cpp in Sources */,
|
||||
17C1FE991ACC42C4006B99B3 /* DocxSerializer.cpp in Sources */,
|
||||
17C1FE9A1ACC42C4006B99B3 /* CommonWriter.cpp in Sources */,
|
||||
8AC6D20B2130146800D9C0F1 /* xmllight.cpp in Sources */,
|
||||
17C1FE9B1ACC42C4006B99B3 /* CSVWriter.cpp in Sources */,
|
||||
69414A301CB51666003E771B /* ChartWriter.cpp in Sources */,
|
||||
6967917E1D9E8AEE002CA4BA /* BinWriters.cpp in Sources */,
|
||||
69BBDF251F0B8AAC00EB1BF7 /* FileDownloader_mac.mm in Sources */,
|
||||
17C1FE9C1ACC42C4006B99B3 /* XlsxSerializer.cpp in Sources */,
|
||||
690FE0851E9BBD68004B26D0 /* Readers.cpp in Sources */,
|
||||
8AC6D20A2130146800D9C0F1 /* xmldom.cpp in Sources */,
|
||||
17C1FE9D1ACC42C4006B99B3 /* FontProcessor.cpp in Sources */,
|
||||
8A404FD3208A01AF00F2D5CF /* FileDownloader.cpp in Sources */,
|
||||
);
|
||||
@ -407,18 +383,11 @@
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
UNICODE,
|
||||
_UNICODE,
|
||||
NODOCX,
|
||||
_USE_XMLLITE_READER_,
|
||||
USE_LITE_READER,
|
||||
USE_ATL_CSTRING,
|
||||
USE_AVSOFFICESTUDIO_XMLUTILS,
|
||||
SOLUTION_ASCOFFICEDOCXFILE2,
|
||||
_USE_LIBXML2_READER_,
|
||||
LIBXML_READER_ENABLED,
|
||||
DONT_WRITE_EMBEDDED_FONTS,
|
||||
MAC,
|
||||
unix,
|
||||
_IOS,
|
||||
DONT_WRITE_EMBEDDED_FONTS,
|
||||
_XCODE,
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
@ -446,18 +415,11 @@
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
UNICODE,
|
||||
_UNICODE,
|
||||
NODOCX,
|
||||
_USE_XMLLITE_READER_,
|
||||
USE_LITE_READER,
|
||||
USE_ATL_CSTRING,
|
||||
USE_AVSOFFICESTUDIO_XMLUTILS,
|
||||
SOLUTION_ASCOFFICEDOCXFILE2,
|
||||
_USE_LIBXML2_READER_,
|
||||
LIBXML_READER_ENABLED,
|
||||
DONT_WRITE_EMBEDDED_FONTS,
|
||||
MAC,
|
||||
unix,
|
||||
_IOS,
|
||||
DONT_WRITE_EMBEDDED_FONTS,
|
||||
_XCODE,
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
#include "../include/CPScopedPtr.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
|
||||
namespace formulasconvert {
|
||||
|
||||
|
||||
@ -44,7 +45,7 @@ namespace formulasconvert {
|
||||
class odf2oox_converter
|
||||
{
|
||||
public:
|
||||
odf2oox_converter();
|
||||
odf2oox_converter();
|
||||
~odf2oox_converter();
|
||||
|
||||
// of:=SUM([.DDA1:.BA3]) -> SUM(DDA1:BA3)
|
||||
|
||||
@ -35,6 +35,7 @@
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include"../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
#include "../src/docx/xlsxconversioncontext.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace formulasconvert {
|
||||
@ -42,6 +43,9 @@ namespace formulasconvert {
|
||||
class odf2oox_converter::Impl
|
||||
{
|
||||
public:
|
||||
Impl() {}
|
||||
|
||||
static std::unordered_map<std::wstring, int> & mapExternalLink_;
|
||||
|
||||
std::wstring convert(const std::wstring& expr);
|
||||
std::wstring convert_chart_distance(const std::wstring& expr);
|
||||
@ -54,21 +58,155 @@ namespace formulasconvert {
|
||||
void replace_tilda(std::wstring& expr);
|
||||
void replace_vertical(std::wstring& expr);
|
||||
void replace_space(std::wstring& expr);
|
||||
|
||||
|
||||
std::wstring convert_named_ref(const std::wstring& expr, bool withTableName, std::wstring separator);
|
||||
std::wstring convert_named_expr(const std::wstring& expr, bool withTableName);
|
||||
|
||||
static std::wstring replace_named_ref_formater(boost::wsmatch const & what);
|
||||
static std::wstring replace_named_ref_formater1(boost::wsmatch const & what);
|
||||
static std::wstring replace_cell_range_formater(boost::wsmatch const & what);
|
||||
//static std::wstring replace_cell_range_formater(boost::wsmatch const & what);
|
||||
|
||||
void replace_named_formula(std::wstring & expr, bool w = true);
|
||||
void replace_named_ref(std::wstring & expr, bool w = true);
|
||||
|
||||
bool find_first_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref);
|
||||
bool find_first_last_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref_first,std::wstring & ref_last);
|
||||
|
||||
static bool convert_with_TableName;
|
||||
static std::wstring table_name_;
|
||||
static bool convert_with_TableName;
|
||||
static std::wstring table_name_;
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
static std::wstring replace_semicolons_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
return L",";
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
else
|
||||
return L"";
|
||||
}
|
||||
static std::wstring replace_tilda_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
return L";";
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
else
|
||||
return L"";
|
||||
}
|
||||
static std::wstring replace_vertical_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
{
|
||||
std::wstring inner = what[1].str();
|
||||
XmlUtils::replace_all( inner, L"|", L";");
|
||||
return L"{" + inner + L"}";
|
||||
}
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
|
||||
return L"";
|
||||
}
|
||||
|
||||
static void replace_tmp_back(std::wstring &expr)
|
||||
{
|
||||
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 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"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 std::wstring convert_scobci(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
{
|
||||
std::wstring inner = what[1].str();
|
||||
|
||||
replace_tmp(inner);
|
||||
|
||||
return inner;
|
||||
}
|
||||
else if (what[2].matched)
|
||||
{
|
||||
std::wstring inner = what[2].str();
|
||||
|
||||
replace_tmp(inner);
|
||||
|
||||
return inner;
|
||||
}
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
|
||||
return L"";
|
||||
}
|
||||
static std::wstring replace_space_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
{
|
||||
std::wstring inner = what[1].str();
|
||||
XmlUtils::replace_all( inner, L" ", L",");
|
||||
return inner;
|
||||
}
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
|
||||
return L"";
|
||||
}
|
||||
|
||||
static std::wstring is_forbidden(const std::wstring & formula)
|
||||
{
|
||||
std::wstring result = formula;
|
||||
std::map<std::wstring, std::wstring> forbidden_formulas;
|
||||
|
||||
forbidden_formulas.insert(std::make_pair(L"FORMULA", L"_xlfn.FORMULATEXT"));
|
||||
|
||||
for (std::map<std::wstring, std::wstring>::iterator it = forbidden_formulas.begin(); it != forbidden_formulas.end(); ++it)
|
||||
{
|
||||
if (boost::algorithm::contains(formula, it->first))
|
||||
{
|
||||
|
||||
XmlUtils::replace_all(result, it->first, it->second);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
bool odf2oox_converter::Impl::convert_with_TableName = true;
|
||||
std::wstring odf2oox_converter::Impl::table_name_ = L"";
|
||||
|
||||
std::unordered_map<std::wstring, int> &odf2oox_converter::Impl::mapExternalLink_ = oox::xlsx_conversion_context::mapExternalLink_;
|
||||
|
||||
bool odf2oox_converter::Impl::find_first_last_ref(std::wstring const & expr, std::wstring & table,std::wstring & ref_first,std::wstring & ref_last)
|
||||
{
|
||||
@ -76,14 +214,14 @@ namespace formulasconvert {
|
||||
|
||||
boost::algorithm::split(splitted, expr, boost::algorithm::is_any_of(L".:"), boost::algorithm::token_compress_on);
|
||||
|
||||
if (splitted.size()==3)
|
||||
if (splitted.size() == 3)
|
||||
{
|
||||
table = splitted[0];
|
||||
ref_first = splitted[1];
|
||||
ref_last = splitted[2];
|
||||
return true;
|
||||
}
|
||||
if (splitted.size()==4)
|
||||
if (splitted.size() == 4)
|
||||
{
|
||||
table = splitted[0];
|
||||
ref_first = splitted[1];
|
||||
@ -95,7 +233,7 @@ namespace formulasconvert {
|
||||
|
||||
bool odf2oox_converter::Impl::find_first_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref)
|
||||
{
|
||||
boost::wregex re(L"\\[(?:\\$)?([^\\.]+?){0,1}\\.([a-zA-Z\\$]+\\d+)(?::\\.([a-zA-Z]+\\d+)){0,1}\\]");
|
||||
boost::wregex re(L"\\[(?:\\$)?([^\\.]+?){0,1}\\.([\\w^0-9\\$]+\\d+)(?::\\.([\\w^0-9]+\\d+)){0,1}\\]");
|
||||
boost::wsmatch result;
|
||||
bool b = boost::regex_search(expr, result, re);
|
||||
|
||||
@ -118,101 +256,92 @@ namespace formulasconvert {
|
||||
}
|
||||
|
||||
|
||||
std::wstring odf2oox_converter::Impl::replace_cell_range_formater(boost::wsmatch const & what)
|
||||
{
|
||||
const size_t sz = what.size();
|
||||
if (sz == 4 && !what[1].matched)
|
||||
{
|
||||
const std::wstring c1 = what[2].str();
|
||||
const std::wstring c2 = what[3].str();
|
||||
const std::wstring s = c1 + (c2.empty() ? L"" : (L":" + c2) );
|
||||
return s;
|
||||
}
|
||||
else if (sz == 4 && what[1].matched)
|
||||
{
|
||||
std::wstring sheet1 = what[1].str();
|
||||
XmlUtils::replace_all( sheet1, L"$", L"");
|
||||
//std::wstring odf2oox_converter::Impl::replace_cell_range_formater(boost::wsmatch const & what)
|
||||
//{
|
||||
// const size_t sz = what.size();
|
||||
// if (sz == 4 && !what[1].matched)
|
||||
// {
|
||||
// const std::wstring c1 = what[2].str();
|
||||
// const std::wstring c2 = what[3].str();
|
||||
// const std::wstring s = c1 + (c2.empty() ? L"" : (L":" + c2) );
|
||||
// return s;
|
||||
// }
|
||||
// else if (sz == 4 && what[1].matched)
|
||||
// {
|
||||
// std::wstring sheet1 = what[1].str();
|
||||
// XmlUtils::replace_all( sheet1, L"$", L"");
|
||||
|
||||
const std::wstring c1 = what[2].str();
|
||||
std::wstring c2 = what[3].str();
|
||||
if (c2.empty()) c2 = what[4].str();
|
||||
const std::wstring s = sheet1 + L"!" + c1 + (c2.empty() ? L"" : (L":" + c2) );
|
||||
return s;
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
// const std::wstring c1 = what[2].str();
|
||||
// std::wstring c2 = what[3].str();
|
||||
// if (c2.empty()) c2 = what[4].str();
|
||||
// const std::wstring s = sheet1 + L"!" + c1 + (c2.empty() ? L"" : (L":" + c2) );
|
||||
// return s;
|
||||
// }
|
||||
// return L"";
|
||||
//}
|
||||
|
||||
std::wstring odf2oox_converter::Impl::replace_named_ref_formater(boost::wsmatch const & what)
|
||||
{
|
||||
const size_t sz = what.size();
|
||||
|
||||
if (sz == 4 && !what[1].matched)
|
||||
if (sz < 6) return what[0].str();
|
||||
|
||||
std::wstring c0 = what[0].str();
|
||||
std::wstring external = sz == 7 ? what[1].matched ? what[1].str() : what[2].str() : what[1].str();
|
||||
std::wstring sheet1 = sz == 7 ? what[3].str() : what[2].str();
|
||||
std::wstring ref1 = sz == 7 ? what[4].str() : what[3].str();
|
||||
std::wstring sheet2 = sz == 7 ? what[5].str() : what[4].str();
|
||||
std::wstring ref2 = sz == 7 ? what[6].str() : what[5].str();
|
||||
|
||||
XmlUtils::replace_all( sheet1, L"$", L"");
|
||||
//XmlUtils::replace_all( sheet2, L"$", L"");
|
||||
|
||||
std::wstring result;
|
||||
|
||||
if (false == external.empty())
|
||||
{
|
||||
const std::wstring c1 = what[2].str();
|
||||
const std::wstring c2 = what[3].str();
|
||||
const std::wstring s = c1 + (c2.empty() ? L"" : (L":" + c2) );
|
||||
return s;
|
||||
}
|
||||
else if (sz == 4 && what[1].matched)
|
||||
{
|
||||
std::wstring sheet1 = what[1].str();
|
||||
XmlUtils::replace_all( sheet1, L"$", L"");
|
||||
replace_tmp_back(external);
|
||||
|
||||
table_name_ = sheet1;
|
||||
|
||||
const std::wstring c1 = what[2].str();
|
||||
const std::wstring c2 = what[3].str();
|
||||
|
||||
if (convert_with_TableName)
|
||||
int id = -1;//add_external_link(external);
|
||||
std::unordered_map<std::wstring, int>::iterator pFind = mapExternalLink_.find(external);
|
||||
if ( pFind == mapExternalLink_.end())
|
||||
{
|
||||
if (std::wstring::npos != sheet1.find(L" "))
|
||||
{
|
||||
if (sheet1[0] != L'\'')
|
||||
{
|
||||
sheet1 = L"'" + sheet1 + L"'";
|
||||
}
|
||||
}
|
||||
return (sheet1 + L"!") + c1 + (c2.empty() ? L"" : (L":" + c2) );
|
||||
id = (int)mapExternalLink_.size() + 1;
|
||||
mapExternalLink_.insert(std::make_pair(external, id));
|
||||
}
|
||||
else
|
||||
{
|
||||
return c1 + (c2.empty() ? L"" : (L":" + c2) );
|
||||
id = pFind->second;
|
||||
}
|
||||
}
|
||||
else if (sz == 5 && what[1].matched)
|
||||
{
|
||||
std::wstring sheet1 = what[1].str();
|
||||
XmlUtils::replace_all( sheet1, L"$", L"");
|
||||
|
||||
const std::wstring c1 = what[2].str();
|
||||
const std::wstring c2 = what[3].str(); //sheet name 2
|
||||
const std::wstring c3 = what[4].str();
|
||||
|
||||
table_name_ = sheet1;
|
||||
|
||||
if (convert_with_TableName)
|
||||
if (sheet1[0] == L'\'')
|
||||
{
|
||||
return (sheet1 + L"!") + c1 + (c3.empty() ? L"" : (L":" + c3) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return c1 + (c3.empty() ? L"" : (L":" + c3) );
|
||||
sheet1 = sheet1.substr(1, sheet1.length() - 2);
|
||||
}
|
||||
sheet1 = L"'[" + std::to_wstring(id) + L"]" + sheet1 + L"'";
|
||||
}
|
||||
else if (sz == 5 && !what[1].matched)
|
||||
else if (std::wstring::npos != sheet1.find(L" "))
|
||||
{
|
||||
const std::wstring c1 = what[2].str();
|
||||
const std::wstring c2 = what[3].str(); //sheet name 2
|
||||
const std::wstring c3 = what[4].str();
|
||||
|
||||
return c1 + (c3.empty() ? L"" : (L":" + c3) );
|
||||
if (sheet1[0] != L'\'')
|
||||
{
|
||||
sheet1 = L"'" + sheet1 + L"'";
|
||||
}
|
||||
}
|
||||
|
||||
table_name_ = sheet1;
|
||||
|
||||
if (convert_with_TableName)
|
||||
{
|
||||
return (sheet1.empty() ? L"" : (sheet1 + L"!")) + ref1 + (ref2.empty() ? L"" : (L":" + ref2) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return ref1 + (ref2.empty() ? L"" : (L":" + ref2) );
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
std::wstring odf2oox_converter::Impl::replace_named_ref_formater1(boost::wsmatch const & what)
|
||||
{
|
||||
boost::wregex complexRef(L"\\${0,1}([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)(?::\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)){0,1}");
|
||||
|
||||
boost::wregex complexRef(L"(?:\'([^\']*)\'#){0,1}\\${0,1}([^\\.]+?){0,1}\\.(\\${0,1}[\\w^0-9]+\\${0,1}\\d+)(?::\\.(\\${0,1}[\\w^0-9]+\\${0,1}\\d+)){0,1}");
|
||||
// 'external'# $ Sheet2 . A1 : ( $ Sheet2)? . B5
|
||||
std::wstring expr = what[1].str();
|
||||
const std::wstring res = boost::regex_replace(
|
||||
expr,
|
||||
@ -233,26 +362,34 @@ namespace formulasconvert {
|
||||
// [$'Sheet2 A'.$B2] -> 'Sheet2 A'!$B2
|
||||
void odf2oox_converter::Impl::replace_cells_range(std::wstring& expr, bool withTableName)
|
||||
{
|
||||
XmlUtils::replace_all( expr, L"#REF !", L"#REF!");
|
||||
XmlUtils::replace_all( expr, L"#REF!#REF!", L"#REF!");
|
||||
XmlUtils::replace_all( expr, L"$#REF!$#REF!", L"#REF!");
|
||||
|
||||
convert_with_TableName = withTableName;
|
||||
|
||||
boost::wregex complexRef(L"\\[(?:\$)?([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)(?::(\\${0,1}[^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)){0,1}\\]");
|
||||
/*
|
||||
[ $ Sheet2 . A1 : ( $ Sheet2)? . B5 ]
|
||||
*/
|
||||
//boost::wregex complexRef(L"\\[(?:\'([^\']*)\'#){0,1}\\[{0,1}(?:\\$){0,1}([^\\.]+?){0,1}\\.(\\${0,1}[\\w^0-9]*\\${0,1}\\d*)(?::(\\${0,1}[^\\.]+?){0,1}\\.(\\${0,1}[\\w^0-9]*\\${0,1}\\d*)){0,1}\\]{0,1}");
|
||||
boost::wregex complexRef(L"(?:(?:(?:(?:\\[\'([^\']*)\'#)|(?:\'([^\']*)\'#\\[)))|(?:\\[))\
|
||||
(?:\\$){0,1}([^\\.]+?){0,1}\\.(\\${0,1}[\\w^0-9]*\\${0,1}\\d*)(?::(\\${0,1}[^\\.]+?){0,1}\\.(\\${0,1}[\\w^0-9]*\\${0,1}\\d*)){0,1}\\]");
|
||||
// [ 'external'# [ $ Sheet2 . A1 : ( $ Sheet2)? . B5 ]
|
||||
|
||||
const std::wstring res = boost::regex_replace(
|
||||
expr,
|
||||
expr = boost::regex_replace(
|
||||
expr,
|
||||
complexRef,
|
||||
&replace_named_ref_formater,
|
||||
boost::match_default | boost::format_all);
|
||||
expr = res;
|
||||
}
|
||||
void odf2oox_converter::Impl::replace_named_ref(std::wstring & expr, bool withTableName)
|
||||
{
|
||||
XmlUtils::replace_all( expr, L"#REF !", L"#REF!");
|
||||
XmlUtils::replace_all( expr, L"#REF!#REF!", L"#REF!");
|
||||
XmlUtils::replace_all( expr, L"$#REF!$#REF!", L"#REF!");
|
||||
|
||||
convert_with_TableName = withTableName;
|
||||
|
||||
//boost::wregex complexRef(L"\\${0,1}([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)(?::\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)){0,1}");
|
||||
boost::wregex complexRef(L"\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)(?::\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)){0,1}");
|
||||
boost::wregex complexRef(L"\\[{0,1}(?:\'([^\']*)\'#){0,1}\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[\\w^0-9]*\\${0,1}\\d*)(?::\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[\\w^0-9]*\\${0,1}\\d*)){0,1}\\]{0,1}");
|
||||
// 'external'# $ Sheet2 . A1 : ( $ Sheet2)? . B5
|
||||
|
||||
const std::wstring res = boost::regex_replace(
|
||||
expr,
|
||||
@ -281,29 +418,7 @@ namespace formulasconvert {
|
||||
}
|
||||
|
||||
|
||||
std::wstring replace_semicolons_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
return L",";
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
else
|
||||
return L"";
|
||||
}
|
||||
std::wstring replace_tilda_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
return L";";
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
else
|
||||
return L"";
|
||||
}
|
||||
// TODO
|
||||
|
||||
// заменить точки с запятой во всех вхождениях кроме находящихся в кавычках --*и в фигурных скобках*--
|
||||
void odf2oox_converter::Impl::replace_semicolons(std::wstring& expr)
|
||||
{
|
||||
@ -327,123 +442,6 @@ namespace formulasconvert {
|
||||
|
||||
expr = res;
|
||||
}
|
||||
std::wstring replace_vertical_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
{
|
||||
std::wstring inner = what[1].str();
|
||||
XmlUtils::replace_all( inner, L"|", L";");
|
||||
return L"{" + inner + L"}";
|
||||
}
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
|
||||
return L"";
|
||||
}
|
||||
|
||||
std::wstring replace_point_space(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
{
|
||||
std::wstring inner = what[1].str();
|
||||
XmlUtils::replace_all( inner, L" ", L"PROBEL");
|
||||
return inner;
|
||||
}
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
|
||||
return L"";
|
||||
}
|
||||
std::wstring convert_scobci(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
{
|
||||
std::wstring inner = what[1].str();
|
||||
XmlUtils::replace_all( inner, L".", L"ТОСHKA");
|
||||
XmlUtils::replace_all( inner, L"(", L"SCOBCAIN");
|
||||
XmlUtils::replace_all( inner, L")", L"SCOBCAOUT");
|
||||
|
||||
XmlUtils::replace_all( inner, L"[", L"KVADRATIN");
|
||||
XmlUtils::replace_all( inner, L"]", L"KVADRATOUT");
|
||||
|
||||
XmlUtils::replace_all( inner, L" ", L"PROBEL");
|
||||
XmlUtils::replace_all( inner, L"'", L"APOSTROF");
|
||||
return inner;
|
||||
}
|
||||
else if (what[2].matched)
|
||||
{
|
||||
std::wstring inner = what[2].str();
|
||||
XmlUtils::replace_all( inner, L".", L"ТОСHKA");
|
||||
|
||||
XmlUtils::replace_all( inner, L"(", L"SCOBCAIN");
|
||||
XmlUtils::replace_all( inner, L")", L"SCOBCAOUT");
|
||||
|
||||
XmlUtils::replace_all( inner, L"[", L"KVADRATIN");
|
||||
XmlUtils::replace_all( inner, L"]", L"KVADRATOUT");
|
||||
|
||||
XmlUtils::replace_all( inner, L" ", L"PROBEL");
|
||||
XmlUtils::replace_all( inner, L"\"", L"KAVYCHKA");
|
||||
return inner;
|
||||
}
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
|
||||
return L"";
|
||||
}
|
||||
std::wstring replace_space_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
{
|
||||
std::wstring inner = what[1].str();
|
||||
XmlUtils::replace_all( inner, L" ", L",");
|
||||
return inner;
|
||||
}
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
|
||||
return L"";
|
||||
}
|
||||
|
||||
|
||||
//std::wstring forbidden_formulas[] =
|
||||
//{
|
||||
// L"NULLFORMULA"
|
||||
// //L"BETADIST",
|
||||
// //L"CEILING",
|
||||
// //L"FLOOR",
|
||||
// //L"RANK",
|
||||
// //L"ROUND",
|
||||
// //L"ROUNDDOWN",
|
||||
// //L"ROUNDUP",
|
||||
// //L"SUBTOTAL",
|
||||
// //L"FORMULA",
|
||||
// //L"ISREF"
|
||||
//};
|
||||
|
||||
std::wstring is_forbidden(const std::wstring & formula)
|
||||
{
|
||||
std::wstring result = formula;
|
||||
std::map<std::wstring, std::wstring> forbidden_formulas;
|
||||
|
||||
forbidden_formulas.insert(std::make_pair(L"FORMULA", L"_xlfn.FORMULATEXT"));
|
||||
|
||||
for (std::map<std::wstring, std::wstring>::iterator it = forbidden_formulas.begin(); it != forbidden_formulas.end(); ++it)
|
||||
{
|
||||
if (boost::algorithm::contains(formula, it->first))
|
||||
{
|
||||
|
||||
XmlUtils::replace_all(result, it->first, it->second);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// заменить вертикальную черту во всех вхождениях в фигурных скобках, но не внутри строк
|
||||
void odf2oox_converter::Impl::replace_vertical(std::wstring& expr)
|
||||
{
|
||||
@ -468,17 +466,11 @@ namespace formulasconvert {
|
||||
std::wstring odf2oox_converter::Impl::convert(const std::wstring& expr)
|
||||
{
|
||||
std::wstring workstr = is_forbidden(expr);
|
||||
//boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");// Better_Donut.ods- cell(c27)
|
||||
//std::wstring workstr = boost::regex_replace(
|
||||
// expr,
|
||||
// complexRef,
|
||||
// &replace_point_space,
|
||||
// boost::match_default | boost::format_all);
|
||||
|
||||
bool isFormula = check_formula(workstr);
|
||||
|
||||
boost::regex_replace(
|
||||
workstr,
|
||||
//экранирование
|
||||
workstr = boost::regex_replace(workstr,
|
||||
boost::wregex(L"('.*?')|(\".*?\")"),
|
||||
&convert_scobci, boost::match_default | boost::format_all);
|
||||
|
||||
@ -492,9 +484,9 @@ namespace formulasconvert {
|
||||
XmlUtils::replace_all( workstr, L"FDIST(", L"_xlfn.F.DIST(");
|
||||
// ROUNDUP( - тут в oox 2 параметра - разрядность нужно - ,0) - EV Requirements v2.2.3.ods
|
||||
|
||||
int res_find=0;
|
||||
if ((res_find = workstr.find(L"CONCATINATE")) > 0)
|
||||
if (std::wstring::npos != workstr.find(L"CONCATINATE"))
|
||||
{
|
||||
bool l = true;
|
||||
//могут быть частично заданы диапазоны
|
||||
//todooo
|
||||
}
|
||||
@ -509,39 +501,23 @@ namespace formulasconvert {
|
||||
|
||||
|
||||
//-----------------------------------------------------------
|
||||
XmlUtils::replace_all( workstr, L"PROBEL" , L" ");
|
||||
XmlUtils::replace_all( workstr, L"APOSTROF" , L"'");
|
||||
XmlUtils::replace_all( workstr, L"ТОСHKA" , L".");
|
||||
|
||||
XmlUtils::replace_all( workstr, L"SCOBCAIN" , L"(");
|
||||
XmlUtils::replace_all( workstr, L"SCOBCAOUT" , L")");
|
||||
|
||||
XmlUtils::replace_all( workstr, L"KVADRATIN" , L"[");
|
||||
XmlUtils::replace_all( workstr, L"KVADRATOUT", L"]");
|
||||
|
||||
XmlUtils::replace_all( workstr, L"PROBEL" , L" ");
|
||||
XmlUtils::replace_all( workstr, L"KAVYCHKA" , L"\"");
|
||||
replace_tmp_back(workstr);
|
||||
|
||||
return workstr;
|
||||
}
|
||||
|
||||
void odf2oox_converter::Impl::split_distance_by(const std::wstring& expr, const std::wstring& by, std::vector<std::wstring>& out)
|
||||
{
|
||||
std::wstring workstr = expr;
|
||||
boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");// поиск того что в апострофах и замена там
|
||||
|
||||
workstr = boost::regex_replace(
|
||||
std::wstring workstr = boost::regex_replace(
|
||||
expr,
|
||||
complexRef,
|
||||
&replace_point_space,
|
||||
boost::match_default | boost::format_all);
|
||||
boost::wregex(L"('.*?')|(\".*?\")"),
|
||||
&convert_scobci, boost::match_default | boost::format_all);
|
||||
|
||||
boost::algorithm::split(out, workstr, boost::algorithm::is_any_of(by), boost::algorithm::token_compress_on);
|
||||
|
||||
for (size_t i = 0; i < out.size(); i++)
|
||||
{
|
||||
XmlUtils::replace_all( out[i], L"PROBEL", L" ");
|
||||
XmlUtils::replace_all( out[i], L"TOCHKA", L".");
|
||||
replace_tmp_back(out[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -551,15 +527,10 @@ namespace formulasconvert {
|
||||
|
||||
std::wstring odf2oox_converter::Impl::convert_chart_distance(const std::wstring& expr)
|
||||
{
|
||||
std::wstring workstr = is_forbidden(expr);
|
||||
|
||||
boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");// поиск того что в апострофах и замена там
|
||||
|
||||
workstr = boost::regex_replace(
|
||||
expr,
|
||||
complexRef,
|
||||
&replace_point_space,
|
||||
boost::match_default | boost::format_all);
|
||||
std::wstring workstr = boost::regex_replace(
|
||||
is_forbidden(expr),
|
||||
boost::wregex(L"('.*?')|(\".*?\")"),
|
||||
&convert_scobci, boost::match_default | boost::format_all);
|
||||
|
||||
//распарсить по диапазонам - одф-пробел, ик-эль-запятая
|
||||
|
||||
@ -591,10 +562,10 @@ namespace formulasconvert {
|
||||
cells_out.append(cells[j]);
|
||||
cells_out.append(L":");
|
||||
}
|
||||
int res1 = sheet.find(L"-");
|
||||
int res2 = sheet.find(L"'");
|
||||
size_t res1 = sheet.find(L"-");
|
||||
size_t res2 = sheet.find(L"'");
|
||||
|
||||
if (res1 >= 0 && !(res2 == 0))
|
||||
if (res1 != std::wstring::npos && res2 != std::wstring::npos && !(res2 == 0))
|
||||
{
|
||||
sheet = L"'" + sheet + L"'";
|
||||
}
|
||||
@ -608,12 +579,78 @@ namespace formulasconvert {
|
||||
result.append(distance_out[i]);
|
||||
result.append(L",");
|
||||
}
|
||||
XmlUtils::replace_all( result, L"PROBEL" , L" ");
|
||||
XmlUtils::replace_all( result, L"TOCHKA", L".");
|
||||
replace_tmp_back( result );
|
||||
|
||||
return result.substr(0, result.size() - 1);// минус последняя лишняя запятая
|
||||
}
|
||||
odf2oox_converter::odf2oox_converter(): impl_(new odf2oox_converter::Impl)
|
||||
std::wstring odf2oox_converter::Impl::convert_named_ref(const std::wstring& expr, bool withTableName, std::wstring separator)
|
||||
{
|
||||
boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");// поиск того что в апострофах и замена там
|
||||
|
||||
std::wstring workstr = expr;
|
||||
|
||||
workstr = boost::regex_replace(
|
||||
workstr,
|
||||
boost::wregex(L"('.*?')|(\".*?\")"),
|
||||
&convert_scobci, boost::match_default | boost::format_all);
|
||||
|
||||
replace_named_ref(workstr, withTableName);
|
||||
|
||||
if (separator != L" ")
|
||||
{
|
||||
XmlUtils::replace_all( workstr, L" ", separator);
|
||||
}
|
||||
|
||||
replace_tmp_back( workstr );
|
||||
|
||||
if (table_name_.empty() == false)
|
||||
{
|
||||
replace_tmp_back( table_name_ );
|
||||
}
|
||||
return workstr;
|
||||
}
|
||||
std::wstring odf2oox_converter::Impl::convert_named_expr(const std::wstring& expr, bool withTableName)
|
||||
{
|
||||
std::wstring workstr = expr;
|
||||
|
||||
bool isFormula = check_formula(workstr);
|
||||
|
||||
if (isFormula)
|
||||
{
|
||||
workstr = convert(expr);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
workstr = boost::regex_replace(
|
||||
workstr,
|
||||
boost::wregex(L"('.*?')|(\".*?\")"),
|
||||
&convert_scobci, boost::match_default | boost::format_all);
|
||||
|
||||
|
||||
replace_cells_range(workstr, withTableName);
|
||||
replace_semicolons(workstr);
|
||||
replace_vertical(workstr);
|
||||
|
||||
size_t res_find = 0;
|
||||
if ((res_find = workstr.find(L"CONCATINATE")) != std::wstring::npos)
|
||||
{
|
||||
//могут быть частично заданы диапазоны
|
||||
//todooo
|
||||
|
||||
}
|
||||
replace_tmp_back(workstr);
|
||||
|
||||
if (table_name_.empty() == false)
|
||||
{
|
||||
replace_tmp_back(table_name_);
|
||||
}
|
||||
}
|
||||
return workstr;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
odf2oox_converter::odf2oox_converter() : impl_(new odf2oox_converter::Impl())
|
||||
{
|
||||
}
|
||||
|
||||
@ -640,82 +677,11 @@ namespace formulasconvert {
|
||||
}
|
||||
std::wstring odf2oox_converter::convert_named_ref(const std::wstring& expr, bool withTableName, std::wstring separator)
|
||||
{
|
||||
boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");// поиск того что в апострофах и замена там
|
||||
|
||||
std::wstring workstr = boost::regex_replace(
|
||||
expr,
|
||||
complexRef,
|
||||
&replace_point_space,
|
||||
boost::match_default | boost::format_all);
|
||||
|
||||
XmlUtils::replace_all( workstr, L"'", L"APOSTROF");
|
||||
//XmlUtils::replace_all( workstr, L"", L"APOSTROF");
|
||||
|
||||
impl_->replace_named_ref(workstr, withTableName);
|
||||
|
||||
if (separator != L" ")
|
||||
{
|
||||
XmlUtils::replace_all( workstr, L" " , separator);
|
||||
}
|
||||
|
||||
XmlUtils::replace_all( workstr, L"PROBEL" , L" ");
|
||||
XmlUtils::replace_all( workstr, L"APOSTROF" , L"'");
|
||||
XmlUtils::replace_all( workstr, L"TOCHKA" , L".");
|
||||
|
||||
if (impl_->table_name_.empty() == false)
|
||||
{
|
||||
XmlUtils::replace_all( impl_->table_name_, L"PROBEL" , L" ");
|
||||
XmlUtils::replace_all( impl_->table_name_, L"APOSTROF" , L"'");
|
||||
XmlUtils::replace_all( impl_->table_name_, L"TOCHKA" , L".");
|
||||
}
|
||||
return workstr;
|
||||
return impl_->convert_named_ref(expr, withTableName, separator);
|
||||
}
|
||||
std::wstring odf2oox_converter::convert_named_expr(const std::wstring& expr, bool withTableName)
|
||||
{
|
||||
std::wstring workstr = expr;
|
||||
|
||||
bool isFormula = impl_->check_formula(workstr);
|
||||
|
||||
if (isFormula)
|
||||
{
|
||||
workstr = impl_->convert(expr);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");// поиск того что в апострофах и замена там
|
||||
|
||||
workstr = boost::regex_replace(
|
||||
workstr,
|
||||
complexRef,
|
||||
&replace_point_space,
|
||||
boost::match_default | boost::format_all);
|
||||
|
||||
XmlUtils::replace_all( workstr, L"'", L"APOSTROF");
|
||||
|
||||
impl_->replace_cells_range(workstr, withTableName);
|
||||
impl_->replace_semicolons(workstr);
|
||||
impl_->replace_vertical(workstr);
|
||||
|
||||
int res_find=0;
|
||||
if ((res_find = workstr.find(L"CONCATINATE")) > 0)
|
||||
{
|
||||
//могут быть частично заданы диапазоны
|
||||
//todooo
|
||||
|
||||
}
|
||||
XmlUtils::replace_all( workstr, L"PROBEL" , L" ");
|
||||
XmlUtils::replace_all( workstr, L"APOSTROF" , L"'");
|
||||
XmlUtils::replace_all( workstr, L"TOCHKA" , L".");
|
||||
|
||||
if (impl_->table_name_.empty() == false)
|
||||
{
|
||||
XmlUtils::replace_all( impl_->table_name_, L"PROBEL" , L" ");
|
||||
XmlUtils::replace_all( impl_->table_name_, L"APOSTROF" , L"'");
|
||||
XmlUtils::replace_all( impl_->table_name_, L"TOCHKA" , L".");
|
||||
}
|
||||
}
|
||||
return workstr;
|
||||
return impl_->convert_named_expr(expr, withTableName);
|
||||
}
|
||||
|
||||
std::wstring odf2oox_converter::convert_ref(std::wstring const & expr)
|
||||
@ -728,8 +694,8 @@ namespace formulasconvert {
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
int pos = expr.find(L"%20");
|
||||
if (pos <0)break;
|
||||
size_t pos = expr.find(L"%20");
|
||||
if (pos == std::wstring::npos)break;
|
||||
|
||||
expr.replace(pos,3,L" ");
|
||||
}
|
||||
|
||||
@ -39,6 +39,22 @@
|
||||
namespace cpdoccore {
|
||||
namespace formulasconvert {
|
||||
|
||||
static std::wstring forbidden_formulas1[] =
|
||||
{
|
||||
L"NULLFORMULA()"
|
||||
/*
|
||||
L"BETADIST",
|
||||
L"CEILING",
|
||||
L"FLOOR",
|
||||
L"RANK",
|
||||
L"ROUND",
|
||||
L"ROUNDDOWN",
|
||||
L"ROUNDUP",
|
||||
L"SUBTOTAL",
|
||||
L"FORMULA",
|
||||
L"ISREF"*/
|
||||
};
|
||||
|
||||
class oox2odf_converter::Impl
|
||||
{
|
||||
public:
|
||||
@ -48,7 +64,7 @@ public:
|
||||
std::wstring convert_conditional_formula(const std::wstring& expr);
|
||||
|
||||
std::wstring convert_chart_distance(const std::wstring& expr);
|
||||
static void replace_cells_range(std::wstring& expr);
|
||||
static void replace_cells_range(std::wstring& expr, bool bSelect = true);
|
||||
|
||||
static void replace_semicolons(std::wstring& expr);
|
||||
static void replace_vertical(std::wstring& expr);
|
||||
@ -59,7 +75,104 @@ public:
|
||||
static std::wstring replace_arguments(boost::wsmatch const & what);
|
||||
static std::wstring convert_scobci(boost::wsmatch const & what);
|
||||
|
||||
void replace_named_ref(std::wstring & expr);
|
||||
static std::wstring replace_tilda_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
return L";";
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
//else if (what[4].matched)
|
||||
// return what[4].str();
|
||||
else
|
||||
return L"";
|
||||
}
|
||||
static std::wstring replace_semicolons_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
return L";";
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
//else if (what[4].matched)
|
||||
// return what[4].str();
|
||||
else
|
||||
return L"";
|
||||
}
|
||||
static std::wstring replace_vertical_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
{
|
||||
std::wstring inner = what[1].str();
|
||||
XmlUtils::replace_all( inner, L";", L"|");
|
||||
return L"{" + inner + L"}";
|
||||
}
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
|
||||
return L"";
|
||||
}
|
||||
static std::wstring replace_space_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
{
|
||||
std::wstring inner = what[1].str();
|
||||
XmlUtils::replace_all( inner, L",", L" ");
|
||||
return inner;
|
||||
}
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
|
||||
return L"";
|
||||
}
|
||||
static void oox_replace_tmp_back(std::wstring &expr)
|
||||
{
|
||||
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");
|
||||
|
||||
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)
|
||||
{
|
||||
for (size_t i = 0; i < 1; i++)
|
||||
{
|
||||
if (boost::algorithm::contains(formula, forbidden_formulas1[i]))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void replace_named_ref(std::wstring & expr);
|
||||
void replace_named_formula(std::wstring & expr);
|
||||
|
||||
static bool isFindBaseCell_;
|
||||
@ -70,8 +183,11 @@ public:
|
||||
bool oox2odf_converter::Impl::isFindBaseCell_ = false;
|
||||
std::wstring oox2odf_converter::Impl::table_name_ = L"";
|
||||
|
||||
void oox2odf_converter::Impl::replace_cells_range(std::wstring& expr)
|
||||
void oox2odf_converter::Impl::replace_cells_range(std::wstring& expr, bool bSelect)
|
||||
{
|
||||
if ((0 == expr.find(L"KAVYCHKA")) && (expr.length() - 8 == expr.rfind(L"KAVYCHKA") ))
|
||||
return;
|
||||
|
||||
boost::wregex re(L"([:$!])+");
|
||||
|
||||
boost::wsmatch result;
|
||||
@ -79,7 +195,7 @@ void oox2odf_converter::Impl::replace_cells_range(std::wstring& expr)
|
||||
|
||||
if (b)
|
||||
{
|
||||
boost::wregex re1(L"(\\$?\\w+\\!)?([a-zA-Z$]*\\d*)\\:?([a-zA-Z$]*\\d*)?");
|
||||
boost::wregex re1(L"(\\$?[^\']+\\!)?([\\w^0-9$]*\\d*)\\:?([\\w^0-9$]*\\d*)?");
|
||||
// $ Sheet2 ! $ A1 : $ B5
|
||||
// $ Sheet2 ! $ A : $ A
|
||||
// $ Sheet2 ! $ 1 : $ 1
|
||||
@ -88,7 +204,7 @@ void oox2odf_converter::Impl::replace_cells_range(std::wstring& expr)
|
||||
std::wstring res = boost::regex_replace(
|
||||
workstr,
|
||||
re1,
|
||||
&replace_cells_range_formater1,
|
||||
bSelect ? &replace_cells_range_formater1 : &replace_cells_range_formater2,
|
||||
boost::match_default | boost::format_all);
|
||||
|
||||
expr = res;
|
||||
@ -111,8 +227,12 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater1(boost::wsmat
|
||||
|
||||
std::wstring c1 = what[2].str();
|
||||
std::wstring c2 = what[3].str();
|
||||
|
||||
if (!c1.empty() || !c2.empty() || !sheet.empty())
|
||||
|
||||
if ((0 == c1.find(L"KAVYCHKA")) && (c1.length() - 8 == c1.rfind(L"KAVYCHKA") ))
|
||||
{
|
||||
return c1;
|
||||
}
|
||||
else if (!c1.empty() || !c2.empty() || !sheet.empty())
|
||||
{
|
||||
XmlUtils::replace_all( sheet, L"!", L"");
|
||||
|
||||
@ -122,9 +242,8 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater1(boost::wsmat
|
||||
}
|
||||
if (!sheet.empty() && (std::wstring::npos != c1.find(L"$"))) sheet = L"$" + sheet;
|
||||
|
||||
s = std::wstring(L"[") + sheet + L"." +
|
||||
c1 +
|
||||
(c2.empty() ? L"" : (L":" + sheet + L"." + c2) ) + std::wstring(L"]");
|
||||
|
||||
s = L"[" + sheet + L"." + c1 + (c2.empty() ? L"" : (L":" + sheet + L"." + c2)) + std::wstring(L"]");
|
||||
}
|
||||
return s;
|
||||
}
|
||||
@ -144,18 +263,43 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater2(boost::wsmat
|
||||
{
|
||||
const size_t sz = what.size();
|
||||
|
||||
if (sz > 2)
|
||||
if (sz > 3)
|
||||
{
|
||||
std::wstring s;
|
||||
std::wstring sheet = what[1].matched ? what[1].str() : L"";
|
||||
|
||||
std::wstring c1 = what[2].str();
|
||||
std::wstring c2 = what[3].str();
|
||||
|
||||
if ((0 == c1.find(L"KAVYCHKA")) && (c1.length() - 8 == c1.rfind(L"KAVYCHKA") ))
|
||||
{
|
||||
return c1;
|
||||
}
|
||||
else if (!c1.empty() || !c2.empty() || !sheet.empty())
|
||||
{
|
||||
XmlUtils::replace_all( sheet, L"!", L"");
|
||||
|
||||
if (isFindBaseCell_ && table_name_.empty() && !sheet.empty())
|
||||
{
|
||||
table_name_ = sheet + L".$A$1";
|
||||
}
|
||||
if (!sheet.empty() && (std::wstring::npos != c1.find(L"$"))) sheet = L"$" + sheet;
|
||||
|
||||
|
||||
s = sheet + L"." + c1 + (c2.empty() ? L"" : (L":" + sheet + L"." + c2)) + std::wstring(L"");
|
||||
}
|
||||
return s;
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::wstring c1 = what[1].str();
|
||||
const std::wstring c2 = what[2].str();
|
||||
|
||||
const std::wstring s = std::wstring(L"[.") + c1 + (c2.empty() ? L"" : (L":." + c2) ) + std::wstring(L"]");
|
||||
const std::wstring s = std::wstring(L".") + c1 + (c2.empty() ? L"" : (L":." + c2) );
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
return L"";
|
||||
|
||||
return L"";
|
||||
}
|
||||
|
||||
void oox2odf_converter::Impl::replace_named_formula(std::wstring & expr)
|
||||
@ -167,7 +311,6 @@ void oox2odf_converter::Impl::replace_named_formula(std::wstring & expr)
|
||||
isFindBaseCell_ = false;
|
||||
}
|
||||
|
||||
// Лист1!$A$1 -> $Лист1.$A$1
|
||||
void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr)
|
||||
{
|
||||
table_name_.clear();
|
||||
@ -178,27 +321,22 @@ void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr)
|
||||
replace_vertical(workstr);
|
||||
replace_semicolons(workstr);
|
||||
|
||||
std::wstring res1 = boost::regex_replace(
|
||||
workstr,
|
||||
boost::wregex(L"('.*?')|(\".*?\")"),
|
||||
&oox2odf_converter::Impl::convert_scobci, boost::match_default | boost::format_all);
|
||||
|
||||
std::vector<std::wstring> distance;
|
||||
|
||||
boost::algorithm::split(distance,workstr, boost::algorithm::is_any_of(L";"), boost::algorithm::token_compress_on);
|
||||
boost::algorithm::split(distance, res1, boost::algorithm::is_any_of(L";"), boost::algorithm::token_compress_on);
|
||||
|
||||
for (size_t i = 0; i < distance.size(); i++)
|
||||
{
|
||||
std::wstring &d = distance[i];
|
||||
|
||||
XmlUtils::replace_all( d, L"(", L"SCOBCAIN");
|
||||
XmlUtils::replace_all( d, L")", L"SCOBCAOUT");
|
||||
XmlUtils::replace_all( d, L" ", L"PROBEL");
|
||||
XmlUtils::replace_all( d, L"'", L"APOSTROF");
|
||||
XmlUtils::replace_all( d, L"\"", L"KAVYCHKA");
|
||||
|
||||
replace_cells_range(d);
|
||||
replace_cells_range(d, false);
|
||||
|
||||
XmlUtils::replace_all( d, L"SCOBCAIN", L"(");
|
||||
XmlUtils::replace_all( d, L"SCOBCAOUT", L")");
|
||||
XmlUtils::replace_all( d, L"PROBEL", L" ");
|
||||
XmlUtils::replace_all( d, L"APOSTROF", L"'");
|
||||
XmlUtils::replace_all( d, L"KAVYCHKA", L"\"");
|
||||
oox_replace_tmp_back(d);
|
||||
|
||||
out = out + d + std::wstring(L";");
|
||||
}
|
||||
@ -209,47 +347,11 @@ void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr)
|
||||
|
||||
if (table_name_.empty() == false)
|
||||
{
|
||||
XmlUtils::replace_all( table_name_, L"SCOBCAIN", L"(");
|
||||
XmlUtils::replace_all( table_name_, L"SCOBCAOUT", L")");
|
||||
XmlUtils::replace_all( table_name_, L"PROBEL", L" ");
|
||||
XmlUtils::replace_all( table_name_, L"APOSTROF", L"'");
|
||||
XmlUtils::replace_all( table_name_, L"KAVYCHKA", L"\"");
|
||||
oox_replace_tmp_back(table_name_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
std::wstring replace_tilda_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
return L";";
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
//else if (what[4].matched)
|
||||
// return what[4].str();
|
||||
else
|
||||
return L"";
|
||||
}
|
||||
|
||||
|
||||
std::wstring replace_semicolons_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
return L";";
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
//else if (what[4].matched)
|
||||
// return what[4].str();
|
||||
else
|
||||
return L"";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TODO
|
||||
// заменить запятые на точки с запятой во всех вхождениях кроме находящихся в кавычках --*и в фигурных скобках*--
|
||||
@ -264,67 +366,8 @@ void oox2odf_converter::Impl::replace_semicolons(std::wstring& expr)
|
||||
boost::match_default | boost::format_all);
|
||||
expr = res;
|
||||
}
|
||||
namespace
|
||||
{
|
||||
|
||||
std::wstring replace_vertical_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
{
|
||||
std::wstring inner = what[1].str();
|
||||
XmlUtils::replace_all( inner, L";", L"|");
|
||||
return L"{" + inner + L"}";
|
||||
}
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
|
||||
return L"";
|
||||
}
|
||||
std::wstring replace_space_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
{
|
||||
std::wstring inner = what[1].str();
|
||||
XmlUtils::replace_all( inner, L",", L" ");
|
||||
return inner;
|
||||
}
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
|
||||
return L"";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
std::wstring forbidden_formulas1[] =
|
||||
{
|
||||
L"NULLFORMULA()"
|
||||
/*
|
||||
L"BETADIST",
|
||||
L"CEILING",
|
||||
L"FLOOR",
|
||||
L"RANK",
|
||||
L"ROUND",
|
||||
L"ROUNDDOWN",
|
||||
L"ROUNDUP",
|
||||
L"SUBTOTAL",
|
||||
L"FORMULA",
|
||||
L"ISREF"*/
|
||||
};
|
||||
|
||||
bool is_forbidden1(const std::wstring & formula)
|
||||
{
|
||||
for (size_t i = 0; i < 1; i++)
|
||||
{
|
||||
if (boost::algorithm::contains(formula, forbidden_formulas1[i]))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//void oox2odf_converter::Impl::split_(std::wstring& expr)
|
||||
//{
|
||||
// const std::wstring res = boost::regex_split(
|
||||
@ -355,47 +398,18 @@ void oox2odf_converter::Impl::replace_space(std::wstring& expr)
|
||||
expr = res;
|
||||
}
|
||||
|
||||
std::wstring replace_(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
{
|
||||
std::wstring inner = what[1].str();
|
||||
XmlUtils::replace_all( inner, L",", L" ");
|
||||
return inner;
|
||||
}
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
|
||||
return L"";
|
||||
}
|
||||
std::wstring oox2odf_converter::Impl::convert_scobci(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
{
|
||||
std::wstring inner = what[1].str();
|
||||
XmlUtils::replace_all( inner, L"(", L"SCOBCAIN");
|
||||
XmlUtils::replace_all( inner, L")", L"SCOBCAOUT");
|
||||
|
||||
XmlUtils::replace_all( inner, L"[", L"KVADRATIN");
|
||||
XmlUtils::replace_all( inner, L"]", L"KVADRATOUT");
|
||||
|
||||
XmlUtils::replace_all( inner, L" ", L"PROBEL");
|
||||
XmlUtils::replace_all( inner, L"'", L"APOSTROF");
|
||||
oox_replace_tmp(inner);
|
||||
return inner;
|
||||
}
|
||||
else if (what[2].matched)
|
||||
{
|
||||
std::wstring inner = what[2].str();
|
||||
XmlUtils::replace_all( inner, L"(", L"SCOBCAIN");
|
||||
XmlUtils::replace_all( inner, L")", L"SCOBCAOUT");
|
||||
|
||||
XmlUtils::replace_all( inner, L"[", L"KVADRATIN");
|
||||
XmlUtils::replace_all( inner, L"]", L"KVADRATOUT");
|
||||
|
||||
XmlUtils::replace_all( inner, L" ", L"PROBEL");
|
||||
XmlUtils::replace_all( inner, L"\"", L"KAVYCHKA");
|
||||
oox_replace_tmp(inner);
|
||||
return inner;
|
||||
}
|
||||
else if (what[3].matched)
|
||||
@ -408,7 +422,7 @@ std::wstring oox2odf_converter::Impl::replace_arguments(boost::wsmatch const &
|
||||
{
|
||||
std::wstring out;
|
||||
|
||||
int sz = what.size();
|
||||
size_t sz = what.size();
|
||||
|
||||
if (what[1].matched)
|
||||
{
|
||||
@ -444,13 +458,13 @@ std::wstring oox2odf_converter::Impl::convert(const std::wstring& expr)
|
||||
if (is_forbidden1(expr))
|
||||
return L"NULLFORMULA";
|
||||
|
||||
std::wstring workstr = expr;
|
||||
std::wstring workstr = expr;
|
||||
replace_cells_range(workstr);
|
||||
replace_vertical(workstr);
|
||||
replace_semicolons(workstr);
|
||||
return workstr;
|
||||
}
|
||||
// of:=(Formula) -> (Formula)
|
||||
// (Formula) -> of:=(Formula)
|
||||
std::wstring oox2odf_converter::Impl::convert_formula(const std::wstring & expr)
|
||||
{
|
||||
std::wstring workstr = expr;
|
||||
@ -462,9 +476,13 @@ std::wstring oox2odf_converter::Impl::convert_formula(const std::wstring & expr)
|
||||
|
||||
std::wstring res = boost::regex_replace(
|
||||
res1,
|
||||
boost::wregex(L"(?!([a-zA-Z]+\\d*\\())(([a-zA-Z]+\\!)?\\$?[a-zA-Z]*\\$?\\d*(\\:\\$?[a-zA-Z]*\\$?\\d*){0,1})"),
|
||||
boost::wregex(L"(?!([\\w^0-9]+\\d*\\())(([\\w^0-9]+\\!)?\\$?[\\w^0-9]*\\$?\\d*(\\:\\$?[\\w^0-9]*\\$?\\d*){0,1})"),
|
||||
&oox2odf_converter::Impl::replace_arguments, boost::match_default | boost::format_all);
|
||||
|
||||
//SUBTOTAL(109,Expense31[Amount])
|
||||
XmlUtils::replace_all( res, L"[", L"KVADRATIN");
|
||||
XmlUtils::replace_all( res, L"]", L"KVADRATOUT");
|
||||
|
||||
if (res1 == res)
|
||||
{
|
||||
XmlUtils::replace_all( res1, L"KAVYCHKA", L"\""); //IMCONJUGATE_emb.xlsx
|
||||
@ -476,16 +494,7 @@ std::wstring oox2odf_converter::Impl::convert_formula(const std::wstring & expr)
|
||||
boost::match_default | boost::format_all);
|
||||
}
|
||||
|
||||
XmlUtils::replace_all( res, L"SCOBCAIN", L"(");
|
||||
XmlUtils::replace_all( res, L"SCOBCAOUT", L")");
|
||||
|
||||
XmlUtils::replace_all( res, L"KVADRATIN", L"[");
|
||||
XmlUtils::replace_all( res, L"KVADRATOUT", L"]");
|
||||
|
||||
|
||||
XmlUtils::replace_all( res, L"APOSTROF", L"'");
|
||||
|
||||
XmlUtils::replace_all( res, L"KAVYCHKA", L"\"");
|
||||
oox_replace_tmp_back(res);
|
||||
|
||||
replace_vertical(res);
|
||||
replace_semicolons(res);
|
||||
@ -494,17 +503,7 @@ std::wstring oox2odf_converter::Impl::convert_formula(const std::wstring & expr)
|
||||
|
||||
if (table_name_.empty() == false)
|
||||
{
|
||||
XmlUtils::replace_all( table_name_, L"SCOBCAIN", L"(");
|
||||
XmlUtils::replace_all( table_name_, L"SCOBCAOUT", L")");
|
||||
|
||||
XmlUtils::replace_all( table_name_, L"KVADRATIN", L"[");
|
||||
XmlUtils::replace_all( table_name_, L"KVADRATOUT", L"]");
|
||||
|
||||
|
||||
XmlUtils::replace_all( table_name_, L"APOSTROF", L"'");
|
||||
|
||||
XmlUtils::replace_all( table_name_, L"KAVYCHKA", L"\"");
|
||||
XmlUtils::replace_all( table_name_, L"PROBEL", L" ");
|
||||
oox_replace_tmp_back(table_name_);
|
||||
}
|
||||
|
||||
return std::wstring(L"of:=") + res;
|
||||
@ -533,12 +532,7 @@ std::wstring oox2odf_converter::Impl::convert_conditional_formula(const std::wst
|
||||
|
||||
}
|
||||
|
||||
XmlUtils::replace_all( res, L"SCOBCAIN", L"(");
|
||||
XmlUtils::replace_all( res, L"SCOBCAOUT", L")");
|
||||
|
||||
XmlUtils::replace_all( res, L"APOSTROF", L"'");
|
||||
|
||||
XmlUtils::replace_all( res, L"KAVYCHKA", L"\"");
|
||||
oox_replace_tmp_back( res);
|
||||
|
||||
replace_vertical(res);
|
||||
replace_semicolons(res);
|
||||
@ -568,7 +562,7 @@ std::wstring oox2odf_converter::Impl::convert_chart_distance(const std::wstring&
|
||||
|
||||
boost::algorithm::split(distance_inp,expr, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
|
||||
|
||||
for (int i = 0; i < distance_inp.size(); i++)
|
||||
for (size_t i = 0; i < distance_inp.size(); i++)
|
||||
{
|
||||
std::wstring sheet;
|
||||
std::vector<std::wstring> range;
|
||||
@ -576,7 +570,7 @@ std::wstring oox2odf_converter::Impl::convert_chart_distance(const std::wstring&
|
||||
|
||||
boost::algorithm::split(range, distance_inp[i], boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
|
||||
|
||||
for (int j = 0 ; j < range.size(); j++)
|
||||
for (size_t j = 0 ; j < range.size(); j++)
|
||||
{
|
||||
int pos = range[j].find('!');
|
||||
if (0 <= pos)
|
||||
@ -588,7 +582,7 @@ std::wstring oox2odf_converter::Impl::convert_chart_distance(const std::wstring&
|
||||
|
||||
}
|
||||
std::wstring cells_out;
|
||||
for (int c = 0; c < cells.size(); c++)
|
||||
for (size_t c = 0; c < cells.size(); c++)
|
||||
{
|
||||
if (!sheet.empty())
|
||||
cells_out += sheet + L".";
|
||||
@ -607,7 +601,7 @@ std::wstring oox2odf_converter::Impl::convert_chart_distance(const std::wstring&
|
||||
}
|
||||
std::wstring result;
|
||||
|
||||
for (int i = 0 ; i < distance_out.size(); i++)
|
||||
for (size_t i = 0 ; i < distance_out.size(); i++)
|
||||
{
|
||||
result += distance_out[i];
|
||||
result += L" ";
|
||||
@ -654,8 +648,6 @@ std::wstring oox2odf_converter::get_table_name()
|
||||
{
|
||||
return impl_->table_name_;
|
||||
}
|
||||
|
||||
|
||||
std::wstring oox2odf_converter::convert_ref(std::wstring const & expr)
|
||||
{
|
||||
std::wstring workstr = expr;
|
||||
@ -743,7 +735,7 @@ int oox2odf_converter::get_count_value_points(std::wstring expr)
|
||||
XmlUtils::replace_all( expr, L")", L"");
|
||||
boost::algorithm::split(splitted, expr, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
|
||||
|
||||
for (long i=0; i < splitted.size(); i++)
|
||||
for (size_t i=0; i < splitted.size(); i++)
|
||||
{
|
||||
int res = splitted[i].find(L"!");
|
||||
if (res > 0) splitted[i] = splitted[i].substr(res+1, splitted[i].size()-res);
|
||||
|
||||
@ -332,6 +332,7 @@ enum ElementType
|
||||
typeTableTableRowGroup,
|
||||
typeTableTableRowNoGroup,
|
||||
typeTableTableSource,
|
||||
typeTableTableProtection,
|
||||
|
||||
typeTableDataPilotTables,
|
||||
typeTableDataPilotTable,
|
||||
@ -454,6 +455,7 @@ enum ElementType
|
||||
typeDrawPolyline,
|
||||
typeDrawRegularPolyline,
|
||||
typeDrawPath,
|
||||
typeDrawContourPath,
|
||||
typeDrawCircle,
|
||||
typeDrawg,
|
||||
typeDrawPageThumbnail,
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
#include <boost/variant.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include "../../../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
#include "../../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
|
||||
namespace cpdoccore
|
||||
{
|
||||
|
||||
@ -42,7 +42,7 @@ std::string ansi_to_utf8(const std::string & _AnsiString)
|
||||
|
||||
std::wstring utf8_to_utf16(const std::string & _Utf8String)
|
||||
{
|
||||
return NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)_Utf8String.c_str(), _Utf8String.length());
|
||||
return NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)_Utf8String.c_str(), (LONG)_Utf8String.length());
|
||||
}
|
||||
|
||||
std::string utf16_to_utf8(const std::wstring & _Utf16String)
|
||||
|
||||
@ -155,12 +155,9 @@ docx_conversion_context::docx_conversion_context(odf_reader::odf_document * OdfD
|
||||
odf_document_ (OdfDocument)
|
||||
{
|
||||
streams_man_ = streams_man::create(temp_stream_);
|
||||
applicationFonts_ = NSFonts::NSApplication::Create();
|
||||
}
|
||||
docx_conversion_context::~docx_conversion_context()
|
||||
{
|
||||
if (applicationFonts_)
|
||||
delete applicationFonts_;
|
||||
}
|
||||
void docx_conversion_context::set_output_document(package::docx_document * document)
|
||||
{
|
||||
@ -168,8 +165,7 @@ void docx_conversion_context::set_output_document(package::docx_document * docum
|
||||
}
|
||||
void docx_conversion_context::set_font_directory(std::wstring pathFonts)
|
||||
{
|
||||
if (applicationFonts_)
|
||||
applicationFonts_->InitializeFromFolder(pathFonts);
|
||||
mediaitems_.set_font_directory(pathFonts);
|
||||
}
|
||||
std::wstring styles_map::get(const std::wstring & Name, odf_types::style_family::type Type)
|
||||
{
|
||||
@ -686,7 +682,7 @@ void docx_conversion_context::end_document()
|
||||
|
||||
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_, applicationFonts_);
|
||||
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_);
|
||||
|
||||
|
||||
@ -47,8 +47,6 @@
|
||||
#include "hyperlinks.h"
|
||||
#include "mediaitems.h"
|
||||
|
||||
#include "../../../DesktopEditor/graphics/pro/Fonts.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
|
||||
namespace odf_types
|
||||
@ -796,11 +794,10 @@ public:
|
||||
bool next_dump_page_properties_;
|
||||
bool next_dump_section_;
|
||||
|
||||
odf_reader::odf_document * root()
|
||||
odf_reader::odf_document *root()
|
||||
{
|
||||
return odf_document_;
|
||||
}
|
||||
|
||||
void start_document ();
|
||||
void end_document ();
|
||||
|
||||
@ -1000,7 +997,6 @@ private:
|
||||
|
||||
package::docx_document * output_document_;
|
||||
odf_reader::odf_document * odf_document_;
|
||||
NSFonts::IApplicationFonts * applicationFonts_;
|
||||
|
||||
std::vector<odf_reader::_property> settings_properties_;
|
||||
|
||||
|
||||
@ -147,11 +147,11 @@ void word_files::update_rels(docx_conversion_context & Context)
|
||||
Context.dump_notes (rels_files_.get_rel_file()->get_rels());
|
||||
}
|
||||
|
||||
void word_files::set_media(mediaitems & _Mediaitems, NSFonts::IApplicationFonts *pAppFonts)
|
||||
void word_files::set_media(mediaitems & _Mediaitems)
|
||||
{
|
||||
if (_Mediaitems.count_image + _Mediaitems.count_media > 0)
|
||||
{
|
||||
media_ = element_ptr( new media(_Mediaitems, pAppFonts) );
|
||||
media_ = element_ptr( new media(_Mediaitems, _Mediaitems.applicationFonts()) );
|
||||
}
|
||||
if (_Mediaitems.count_object > 0)
|
||||
{
|
||||
|
||||
@ -40,8 +40,6 @@
|
||||
#include "docx_content_type.h"
|
||||
#include "oox_package.h"
|
||||
|
||||
#include "../../../DesktopEditor/graphics/pro/Fonts.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
@ -139,7 +137,7 @@ public:
|
||||
void set_numbering (element_ptr Element);
|
||||
void set_settings (element_ptr Element);
|
||||
bool has_numbering ();
|
||||
void set_media (mediaitems & _Mediaitems, NSFonts::IApplicationFonts *pAppFonts);
|
||||
void set_media (mediaitems & mediaitems_);
|
||||
void set_headers_footers(headers_footers & HeadersFooters);
|
||||
void set_notes (notes_context & notesContext);
|
||||
void set_comments (comments_context & commentsContext);
|
||||
|
||||
@ -98,7 +98,7 @@ double docx_table_state::get_current_cell_width()
|
||||
{
|
||||
//return columns_width_[current_table_column_];
|
||||
double res = 0;
|
||||
for (int i = 0; i < columns_spanned_num_ + 1; i++)
|
||||
for (unsigned int i = 0; i < columns_spanned_num_ + 1; i++)
|
||||
{
|
||||
res += columns_width_[current_table_column_ + i];
|
||||
}
|
||||
|
||||
@ -73,7 +73,8 @@ struct drawing_object_description
|
||||
_oox_fill fill_;
|
||||
|
||||
bool in_group_;
|
||||
|
||||
bool lined_;
|
||||
bool connector_;
|
||||
int shape_type_; //default - frame
|
||||
|
||||
std::vector<drawing_object_description> child_objects_;
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
#include <float.h>
|
||||
|
||||
#include "../../DesktopEditor/graphics/pro/Fonts.h"
|
||||
#include "../../../DesktopEditor/graphics/pro/Fonts.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace utils {
|
||||
|
||||
@ -41,6 +41,7 @@
|
||||
|
||||
#include "../../DesktopEditor/common/Directory.h"
|
||||
#include "../../DesktopEditor/raster/ImageFileFormatChecker.h"
|
||||
#include "../../DesktopEditor/graphics/pro/Fonts.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
@ -74,7 +75,32 @@ mediaitems::item::item( std::wstring const & _href,
|
||||
count_add = 1;
|
||||
count_used = 0;
|
||||
}
|
||||
mediaitems::mediaitems(const std::wstring & odfPacket) : odf_packet_(odfPacket)
|
||||
{
|
||||
count_charts = 0;
|
||||
count_shape = 0;
|
||||
count_image = 0;
|
||||
count_tables = 0;
|
||||
count_media = 0;
|
||||
count_object = 0;
|
||||
count_audio = 0;
|
||||
count_video = 0;
|
||||
count_slide = 0;
|
||||
count_activeX = 0;
|
||||
count_control = 0;
|
||||
|
||||
applicationFonts_ = NSFonts::NSApplication::Create();
|
||||
}
|
||||
mediaitems::~mediaitems()
|
||||
{
|
||||
if (applicationFonts_)
|
||||
delete applicationFonts_;
|
||||
}
|
||||
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;
|
||||
|
||||
@ -33,7 +33,12 @@
|
||||
|
||||
#include "oox_rels.h"
|
||||
|
||||
#include "../../../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
#include "../../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
|
||||
namespace NSFonts
|
||||
{
|
||||
class IApplicationFonts;
|
||||
}
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
@ -41,20 +46,8 @@ namespace oox {
|
||||
class mediaitems
|
||||
{
|
||||
public:
|
||||
mediaitems(const std::wstring & odfPacket) : odf_packet_(odfPacket)
|
||||
{
|
||||
count_charts = 0;
|
||||
count_shape = 0;
|
||||
count_image = 0;
|
||||
count_tables = 0;
|
||||
count_media = 0;
|
||||
count_object = 0;
|
||||
count_audio = 0;
|
||||
count_video = 0;
|
||||
count_slide = 0;
|
||||
count_activeX = 0;
|
||||
count_control = 0;
|
||||
}
|
||||
mediaitems(const std::wstring & odfPacket);
|
||||
virtual ~mediaitems();
|
||||
|
||||
struct item
|
||||
{
|
||||
@ -87,6 +80,9 @@ public:
|
||||
size_t count_activeX;
|
||||
size_t count_control;
|
||||
|
||||
void set_font_directory(std::wstring pathFonts);
|
||||
NSFonts::IApplicationFonts *applicationFonts() {return applicationFonts_;}
|
||||
|
||||
std::wstring add_or_find(const std::wstring & href, RelsType type, bool & isInternal);//возможны ссылки на один и тот же объект
|
||||
std::wstring add_or_find(const std::wstring & href, RelsType type, bool & isInternal, std::wstring & ref);
|
||||
|
||||
@ -117,9 +113,9 @@ public:
|
||||
}
|
||||
static RelsType detectMediaType(const std::wstring & fileName)
|
||||
{
|
||||
int pos = fileName.rfind(L".");
|
||||
size_t pos = fileName.rfind(L".");
|
||||
|
||||
std::wstring sExt = (pos >=0 ? fileName.substr(pos + 1) : L"");
|
||||
std::wstring sExt = (pos != std::wstring::npos ? fileName.substr(pos + 1) : L"");
|
||||
|
||||
if (sExt.empty()) return typeMedia;
|
||||
|
||||
@ -147,6 +143,7 @@ private:
|
||||
items_array items_;
|
||||
std::wstring odf_packet_;
|
||||
|
||||
NSFonts::IApplicationFonts *applicationFonts_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -108,6 +108,11 @@ static const std::wstring _ooxShapeType[]=
|
||||
L"custGeom",//uses sub-sub type,
|
||||
L"polygon",
|
||||
L"roundRect",
|
||||
L"bentConnector3",
|
||||
L"curvedConnector3",
|
||||
L"",//3-D shape
|
||||
L"",
|
||||
L"polyline"
|
||||
};
|
||||
|
||||
|
||||
@ -243,16 +248,20 @@ void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_pro
|
||||
{
|
||||
names.push_back(L"adj1");
|
||||
}
|
||||
else if (std::wstring::npos != shapeGeomPreset.find(L"decagon"))
|
||||
{
|
||||
names.push_back(L"vf");
|
||||
}
|
||||
else if (std::wstring::npos != shapeGeomPreset.find(L"heptagon") ||
|
||||
std::wstring::npos != shapeGeomPreset.find(L"pentagon"))
|
||||
std::wstring::npos != shapeGeomPreset.find(L"decagon"))
|
||||
{
|
||||
names.push_back(L"hf");
|
||||
names.push_back(L"vf");
|
||||
values.clear();
|
||||
}
|
||||
//else if (std::wstring::npos != shapeGeomPreset.find(L"decagon"))
|
||||
//{
|
||||
// names.push_back(L"vf");
|
||||
//}
|
||||
//else if (std::wstring::npos != shapeGeomPreset.find(L"pentagon"))
|
||||
//{
|
||||
// names.push_back(L"hf");
|
||||
// names.push_back(L"vf");
|
||||
//}
|
||||
else if (std::wstring::npos != shapeGeomPreset.find(L"hexagon"))
|
||||
{
|
||||
names.push_back(L"adj");
|
||||
@ -418,7 +427,7 @@ void _oox_drawing::serialize_shape(std::wostream & strm)
|
||||
shapeGeomPreset = L"rect";
|
||||
}
|
||||
}
|
||||
else if (sub_type < 10 && sub_type >= 0)
|
||||
else if (sub_type <= 14 && sub_type >= 0)
|
||||
{
|
||||
shapeGeomPreset = _ooxShapeType[sub_type]; //odf -> oox
|
||||
}
|
||||
@ -428,7 +437,7 @@ void _oox_drawing::serialize_shape(std::wostream & strm)
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
if (sub_type == 6 || sub_type == 8)
|
||||
if (sub_type == 6 || sub_type == 8 || sub_type == 14)
|
||||
{
|
||||
CP_XML_NODE(L"a:custGeom")
|
||||
{
|
||||
@ -487,7 +496,7 @@ void _oox_drawing::serialize_shape(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bWordArt)
|
||||
if (bWordArt || lined)
|
||||
{
|
||||
_oox_fill no_fill;
|
||||
oox_serialize_fill(strm, no_fill);
|
||||
|
||||
@ -83,13 +83,15 @@ namespace oox {
|
||||
class _oox_drawing
|
||||
{
|
||||
public:
|
||||
_oox_drawing() : type(typeUnknown), id(0), x(0), y(0), cx(0), cy(0), sub_type(0), inGroup(false), name(L"object"), extExternal(false)
|
||||
_oox_drawing() : type(typeUnknown), id(0), x(0), y(0), cx(0), cy(0), sub_type(0), inGroup(false), lined(false), connector(false), name(L"object"), extExternal(false)
|
||||
{
|
||||
}
|
||||
RelsType type;
|
||||
|
||||
bool inGroup;
|
||||
size_t id;
|
||||
bool lined;
|
||||
bool connector;
|
||||
|
||||
std::wstring name;
|
||||
int sub_type; //odf
|
||||
|
||||
@ -37,9 +37,9 @@
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
oox_bitmap_fill::oox_bitmap_fill() : name_space(L"a"), bStretch(false), bCrop(false), bTile(false), isInternal(true)
|
||||
oox_bitmap_fill::oox_bitmap_fill() : name_space(L"a"), bStretch(false), bCrop(false), bTile(false), isInternal(true), bGrayscale(false)
|
||||
{
|
||||
memset(cropRect,0,sizeof(double)*4);
|
||||
memset(cropRect, 0, sizeof(double)*4);
|
||||
}
|
||||
|
||||
oox_bitmap_fill_ptr oox_bitmap_fill::create(){return boost::make_shared<oox_bitmap_fill>();}
|
||||
@ -189,7 +189,19 @@ void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val, cons
|
||||
{
|
||||
CP_XML_ATTR2(ns_att + L"amt", (int)(*val.opacity * 1000));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (val.bitmap->bGrayscale)
|
||||
{
|
||||
CP_XML_NODE(ns + L":grayscl");
|
||||
}
|
||||
if (val.bitmap->luminance || val.bitmap->contrast)
|
||||
{
|
||||
CP_XML_NODE(ns + L":lum")
|
||||
{
|
||||
if (val.bitmap->luminance) CP_XML_ATTR2(L"bright", (int)(*val.bitmap->luminance * 1000));
|
||||
if (val.bitmap->contrast) CP_XML_ATTR2(L"contrast", (int)(*val.bitmap->contrast * 1000));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (val.bitmap->bCrop)
|
||||
{
|
||||
@ -292,7 +304,7 @@ void oox_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val, co
|
||||
{
|
||||
CP_XML_NODE(ns + L":gsLst")
|
||||
{
|
||||
for (int i = 0; i < val.gradient->colors.size(); i++)
|
||||
for (size_t i = 0; i < val.gradient->colors.size(); i++)
|
||||
{
|
||||
oox_gradient_fill::_color_position & col = val.gradient->colors[i];
|
||||
CP_XML_NODE(ns + L":gs")
|
||||
|
||||
@ -75,6 +75,10 @@ namespace oox {
|
||||
|
||||
_CP_OPT(int) dpi;
|
||||
_CP_OPT(bool) rotate;
|
||||
|
||||
bool bGrayscale;
|
||||
_CP_OPT(double) luminance;
|
||||
_CP_OPT(double) contrast;
|
||||
};
|
||||
/////////////////////////////////////////////////////////
|
||||
class oox_hatch_fill;
|
||||
|
||||
@ -79,14 +79,15 @@ static std::wstring get_mime_type(const std::wstring & extension)
|
||||
else if (L"wav" == extension) return L"audio/wav";
|
||||
else if (L"mp3" == extension) return L"audio/mpeg";
|
||||
else if (L"wma" == extension) return L"audio/x-ms-wma";
|
||||
else if (L"m4a" == extension) return L"audio/unknown";
|
||||
else if (L"m4a" == extension) return L"audio/m4a";
|
||||
|
||||
else if (L"avi" == extension) return L"video/x-msvideo";
|
||||
else if (L"wmv" == extension) return L"video/x-ms-wmv";
|
||||
else if (L"mov" == extension) return L"video/unknown";
|
||||
else if (L"mp4" == extension) return L"video/unknown";
|
||||
else if (L"m4v" == extension) return L"video/unknown";
|
||||
else if (L"mkv" == extension) return L"video/unknown";
|
||||
else if (L"mov" == extension) return L"video/mov";
|
||||
else if (L"mp4" == extension) return L"video/mp4";
|
||||
else if (L"m4v" == extension) return L"video/m4v";
|
||||
else if (L"mkv" == extension) return L"video/mkv";
|
||||
else if (L"webm" == extension) return L"video/webm";
|
||||
|
||||
else if (L"bin" == extension) return L"application/vnd.openxmlformats-officedocument.oleObject";
|
||||
else if (L"xlsx" == extension) return L"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
||||
|
||||
@ -39,7 +39,7 @@ namespace oox {
|
||||
|
||||
void oox_chart::set_cache_only (bool val)
|
||||
{
|
||||
for (int i = 0 ; i < series_.size(); i++)
|
||||
for (size_t i = 0 ; i < series_.size(); i++)
|
||||
{
|
||||
series_[i]->set_cache_only(val);
|
||||
}
|
||||
|
||||
@ -45,8 +45,6 @@
|
||||
|
||||
#include "pptx_default_serializes.h"
|
||||
|
||||
#include "../../DesktopEditor/graphics/pro/Fonts.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
|
||||
namespace odf_reader
|
||||
@ -72,13 +70,10 @@ pptx_conversion_context::pptx_conversion_context( odf_reader::odf_document * odf
|
||||
,last_idx_placeHolder (1)
|
||||
,last_uniq_big_id (1)
|
||||
{
|
||||
applicationFonts_ = NSFonts::NSApplication::Create();
|
||||
}
|
||||
|
||||
pptx_conversion_context::~pptx_conversion_context()
|
||||
{
|
||||
if (applicationFonts_)
|
||||
delete applicationFonts_;
|
||||
}
|
||||
|
||||
void pptx_conversion_context::set_output_document(package::pptx_document * document)
|
||||
@ -88,8 +83,7 @@ void pptx_conversion_context::set_output_document(package::pptx_document * docum
|
||||
|
||||
void pptx_conversion_context::set_font_directory(std::wstring pathFonts)
|
||||
{
|
||||
if (applicationFonts_ )
|
||||
applicationFonts_->InitializeFromFolder(pathFonts);
|
||||
pptx_slide_context_.get_mediaitems().set_font_directory(pathFonts);
|
||||
}
|
||||
|
||||
void pptx_conversion_context::process_layouts()
|
||||
@ -333,7 +327,7 @@ void pptx_conversion_context::end_document()
|
||||
output_document_->get_ppt_files().set_presentation (presentation_);
|
||||
output_document_->get_ppt_files().set_comments (comments);
|
||||
output_document_->get_ppt_files().set_authors_comments (authors_comments_);
|
||||
output_document_->get_ppt_files().set_media (get_mediaitems(), applicationFonts_);
|
||||
output_document_->get_ppt_files().set_media (get_mediaitems());
|
||||
|
||||
output_document_->get_content_types_file().set_media(get_mediaitems());
|
||||
}
|
||||
|
||||
@ -157,7 +157,6 @@ private:
|
||||
|
||||
package::pptx_document * output_document_;
|
||||
odf_reader::odf_document * odf_document_;
|
||||
NSFonts::IApplicationFonts * applicationFonts_;
|
||||
|
||||
pptx_slide_context pptx_slide_context_;
|
||||
pptx_text_context pptx_text_context_;
|
||||
|
||||
@ -212,7 +212,7 @@ void pptx_serialize_shape(std::wostream & strm, _pptx_drawing & val)
|
||||
}
|
||||
CP_XML_NODE(L"p:cNvSpPr")//non visual properies (собственно тока 1 там)
|
||||
{
|
||||
if (val.sub_type==1 || val.sub_type==2)CP_XML_ATTR(L"txBox", 1);
|
||||
if (val.sub_type == 1 || val.sub_type == 2)CP_XML_ATTR(L"txBox", 1);
|
||||
CP_XML_NODE(L"a:spLocks")
|
||||
{
|
||||
CP_XML_ATTR(L"noGrp", 1);
|
||||
@ -254,7 +254,65 @@ void pptx_serialize_shape(std::wostream & strm, _pptx_drawing & val)
|
||||
}
|
||||
} // CP_XML_WRITER
|
||||
}
|
||||
void pptx_serialize_connector(std::wostream & strm, _pptx_drawing & val)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"p:cxnSp")
|
||||
{
|
||||
CP_XML_NODE(L"p:nvCxnSpPr")
|
||||
{
|
||||
CP_XML_NODE(L"p:cNvPr")
|
||||
{
|
||||
CP_XML_ATTR(L"id", val.id);//числовое значение val.rId
|
||||
CP_XML_ATTR(L"name", val.name);
|
||||
|
||||
oox_serialize_action(CP_XML_STREAM(), val.action);
|
||||
}
|
||||
CP_XML_NODE(L"p:cNvCxnSpPr")//non visual properies (собственно тока 1 там)
|
||||
{
|
||||
if (val.sub_type == 1 || val.sub_type == 2)CP_XML_ATTR(L"txBox", 1);
|
||||
CP_XML_NODE(L"a:spLocks")
|
||||
{
|
||||
CP_XML_ATTR(L"noGrp", 1);
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"p:nvPr")
|
||||
{
|
||||
if (val.place_holder_type_.length()>0)
|
||||
{
|
||||
CP_XML_NODE(L"p:ph")
|
||||
{
|
||||
CP_XML_ATTR(L"type",val.place_holder_type_);
|
||||
if (val.place_holder_idx_ > 0) CP_XML_ATTR(L"idx", val.place_holder_idx_);
|
||||
|
||||
if (val.place_holder_type_ == L"dt") { CP_XML_ATTR(L"sz", L"half"); }
|
||||
if (val.place_holder_type_ == L"ftr") { CP_XML_ATTR(L"sz", L"quarter"); }
|
||||
if (val.place_holder_type_ == L"sldNum"){ CP_XML_ATTR(L"sz", L"quarter"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"p:spPr")
|
||||
{
|
||||
_CP_OPT(bool) bNoRect;
|
||||
odf_reader::GetProperty(val.additional,L"no_rect",bNoRect);
|
||||
|
||||
if (!bNoRect)
|
||||
{
|
||||
if (val.cx != 0 || val.cy != 0) //layout
|
||||
{
|
||||
val.serialize_xfrm(CP_XML_STREAM(), L"a", true);
|
||||
}
|
||||
val.serialize_shape(CP_XML_STREAM());
|
||||
|
||||
oox_serialize_ln(CP_XML_STREAM(), val.additional);
|
||||
}
|
||||
}
|
||||
pptx_serialize_text(CP_XML_STREAM(), val);
|
||||
}
|
||||
} // CP_XML_WRITER
|
||||
}
|
||||
void pptx_serialize_chart(std::wostream & strm, _pptx_drawing & val)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
@ -381,7 +439,10 @@ void _pptx_drawing::serialize(std::wostream & strm)
|
||||
{
|
||||
if (type == typeShape)
|
||||
{
|
||||
pptx_serialize_shape(strm, *this);
|
||||
//if (connector) only for ms prst connectors, but not custom!!
|
||||
// pptx_serialize_connector(strm, *this);
|
||||
//else
|
||||
pptx_serialize_shape(strm, *this);
|
||||
}
|
||||
else if (type == typeImage)
|
||||
{
|
||||
|
||||
@ -509,11 +509,11 @@ void ppt_files::add_notesMaster(slide_content_ptr slide)
|
||||
{
|
||||
notesMaster_files_.add_slide(slide);
|
||||
}
|
||||
void ppt_files::set_media(mediaitems & _Mediaitems, NSFonts::IApplicationFonts *pAppFonts)
|
||||
void ppt_files::set_media(mediaitems & _Mediaitems)
|
||||
{
|
||||
if (_Mediaitems.count_image + _Mediaitems.count_media > 0)
|
||||
{
|
||||
media_ = element_ptr( new media(_Mediaitems, pAppFonts) );
|
||||
media_ = element_ptr( new media(_Mediaitems, _Mediaitems.applicationFonts()) );
|
||||
}
|
||||
if (_Mediaitems.count_object > 0)
|
||||
{
|
||||
|
||||
@ -217,7 +217,7 @@ public:
|
||||
void add_notes (slide_content_ptr sheet);
|
||||
void add_notesMaster(slide_content_ptr sheet);
|
||||
|
||||
void set_media(mediaitems & _Mediaitems, NSFonts::IApplicationFonts *pAppFonts);
|
||||
void set_media(mediaitems & _Mediaitems);
|
||||
void add_charts(chart_content_ptr chart);
|
||||
void add_theme (pptx_xml_theme_ptr theme);
|
||||
|
||||
|
||||
@ -147,11 +147,13 @@ void pptx_slide_context::Impl::process_drawings()
|
||||
{
|
||||
for (size_t i = 0; i < objects_.size(); i++)
|
||||
{
|
||||
_pptx_drawing drawing =_pptx_drawing();
|
||||
_pptx_drawing drawing = _pptx_drawing();
|
||||
|
||||
drawing.type = objects_[i].type_;
|
||||
drawing.name = objects_[i].name_;
|
||||
drawing.id = next_rId();
|
||||
drawing.type = objects_[i].type_;
|
||||
drawing.name = objects_[i].name_;
|
||||
drawing.id = next_rId();
|
||||
drawing.lined = objects_[i].lined_;
|
||||
drawing.connector = objects_[i].connector_;
|
||||
|
||||
process_common_properties(objects_[i], drawing);
|
||||
|
||||
@ -228,6 +230,8 @@ void pptx_slide_context::default_set()
|
||||
|
||||
impl_->object_description_.clipping_string_= L"";
|
||||
impl_->object_description_.svg_rect_ = boost::none;
|
||||
impl_->object_description_.connector_ = false;
|
||||
impl_->object_description_.lined_ = false;
|
||||
|
||||
impl_->object_description_.hlinks_.clear();
|
||||
impl_->object_description_.action_.clear();
|
||||
@ -288,7 +292,16 @@ void pptx_slide_context::set_translate(double x_pt, double y_pt)
|
||||
r.y += y_pt;
|
||||
}
|
||||
}
|
||||
|
||||
void pptx_slide_context::set_translate_rotate()
|
||||
{
|
||||
if (impl_->object_description_.svg_rect_)
|
||||
{
|
||||
_rect & r = impl_->object_description_.svg_rect_.get();
|
||||
|
||||
r.x -= r.cx / 2;
|
||||
r.y += r.cy / 2;
|
||||
}
|
||||
}
|
||||
void pptx_slide_context::set_scale(double cx_pt, double cy_pt)
|
||||
{
|
||||
if (impl_->object_description_.svg_rect_)
|
||||
@ -321,12 +334,18 @@ void pptx_slide_context::set_clipping(const std::wstring & str)
|
||||
{
|
||||
impl_->object_description_.clipping_string_= str;
|
||||
}
|
||||
|
||||
void pptx_slide_context::set_fill(_oox_fill & fill)
|
||||
{
|
||||
impl_->object_description_.fill_= fill;
|
||||
}
|
||||
|
||||
void pptx_slide_context::set_is_line_shape(bool val)
|
||||
{
|
||||
impl_->object_description_.lined_ = val;
|
||||
}
|
||||
void pptx_slide_context::set_is_connector_shape(bool val)
|
||||
{
|
||||
impl_->object_description_.connector_ = val;
|
||||
}
|
||||
std::wstring pptx_slide_context::add_hyperlink(std::wstring const & href)
|
||||
{
|
||||
++hlinks_size_;
|
||||
@ -472,8 +491,8 @@ void pptx_slide_context::set_media_param(std::wstring name, std::wstring value)
|
||||
|
||||
void pptx_slide_context::set_image(const std::wstring & path)
|
||||
{
|
||||
int pos_replaicement = path.find(L"ObjectReplacements");
|
||||
if (pos_replaicement >= 0)
|
||||
size_t pos_replaicement = path.find(L"ObjectReplacements");
|
||||
if (pos_replaicement != std::wstring::npos)
|
||||
{
|
||||
if (path.length() - (pos_replaicement + 18) < 2)
|
||||
return; //object without image
|
||||
@ -486,7 +505,7 @@ void pptx_slide_context::set_image(const std::wstring & path)
|
||||
}
|
||||
else if (impl_->use_image_replacement_)
|
||||
{
|
||||
impl_->object_description_.fill_.type = 2;
|
||||
impl_->object_description_.fill_.type = 2;
|
||||
impl_->object_description_.fill_.bitmap = oox::oox_bitmap_fill::create();
|
||||
impl_->object_description_.fill_.bitmap->xlink_href_ = path;
|
||||
impl_->object_description_.fill_.bitmap->bStretch = true;
|
||||
@ -538,8 +557,14 @@ void pptx_slide_context::Impl::process_image(drawing_object_description& obj, _p
|
||||
drawing.fill.bitmap = oox_bitmap_fill::create();
|
||||
drawing.fill.type = 2;
|
||||
|
||||
_CP_OPT(std::wstring) sTextContent;
|
||||
_CP_OPT(std::wstring) sTextContent, sColorMode;
|
||||
_CP_OPT(double) dLuminance, dContrast;
|
||||
|
||||
GetProperty(obj.additional_, L"text-content", sTextContent);
|
||||
GetProperty(obj.additional_, L"color-mode", sColorMode);
|
||||
GetProperty(obj.additional_, L"luminance", drawing.fill.bitmap->luminance);
|
||||
GetProperty(obj.additional_, L"contrast", drawing.fill.bitmap->contrast);
|
||||
|
||||
if (sTextContent)//в ms office на картинке нельзя сделать надпись - меняем тип на рект с заливкой картинкой
|
||||
{
|
||||
drawing.type = typeShape;
|
||||
@ -547,8 +572,11 @@ 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, NULL);
|
||||
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"))
|
||||
drawing.fill.bitmap->luminance = true;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
std::wstring ref;/// это ссылка на выходной внешний объект
|
||||
@ -626,25 +654,29 @@ void pptx_slide_context::Impl::process_shape(drawing_object_description & obj, _
|
||||
}
|
||||
void pptx_slide_context::Impl::process_object(drawing_object_description& obj, _pptx_drawing & drawing)
|
||||
{
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
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.objectProgId = obj.descriptor_;
|
||||
|
||||
add_drawing(drawing, isMediaInternal, drawing.objectId, ref, drawing.type);
|
||||
|
||||
if (drawing.fill.bitmap)
|
||||
if (!drawing.fill.bitmap)
|
||||
{
|
||||
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
|
||||
drawing.fill.bitmap = oox::oox_bitmap_fill::create();
|
||||
drawing.fill.bitmap->xlink_href_ = L"zero.png";
|
||||
|
||||
add_additional_rels(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);
|
||||
_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);
|
||||
add_additional_rels(isMediaInternal_image, drawing.fill.bitmap->rId, ref_image, typeImage);
|
||||
|
||||
add_drawing(drawing, isMediaInternal, drawing.objectId, ref, drawing.type);
|
||||
}
|
||||
void pptx_slide_context::Impl::process_media(drawing_object_description& obj, _pptx_drawing & drawing)
|
||||
{
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
std::wstring ref, ref_image;
|
||||
bool isMediaInternal = true, isMediaInternal_image = true;
|
||||
|
||||
drawing.type = mediaitems::detectMediaType(obj.xlink_href_); //reset from Media to Audio, Video, ... QuickTime? AudioCD? ...
|
||||
|
||||
@ -652,15 +684,18 @@ void pptx_slide_context::Impl::process_media(drawing_object_description& obj, _p
|
||||
drawing.extId = L"ext" + drawing.objectId;
|
||||
drawing.extExternal = !isMediaInternal;
|
||||
|
||||
if (!drawing.fill.bitmap)
|
||||
{
|
||||
drawing.fill.bitmap = oox::oox_bitmap_fill::create();
|
||||
drawing.fill.bitmap->xlink_href_ = L"zero.png";
|
||||
|
||||
_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);
|
||||
add_additional_rels(isMediaInternal_image, drawing.fill.bitmap->rId, ref_image, typeImage);
|
||||
|
||||
add_drawing(drawing, false, drawing.objectId, L"NULL", drawing.type);
|
||||
add_additional_rels( isMediaInternal, drawing.extId, ref, typeMedia);
|
||||
|
||||
if (drawing.fill.bitmap)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
void pptx_slide_context::Impl::process_common_properties(drawing_object_description & pic, _pptx_drawing & drawing)
|
||||
{
|
||||
|
||||
@ -61,6 +61,7 @@ public:
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
void set_rect (double width_pt, double height_pt, double x_pt, double y_pt);
|
||||
|
||||
void set_translate_rotate();
|
||||
void set_translate (double x_pt, double y_pt);
|
||||
void set_scale (double cx_pt, double cy_pt);
|
||||
void set_rotate (double angle);
|
||||
@ -72,6 +73,9 @@ public:
|
||||
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_placeHolder_type (std::wstring typeHolder);
|
||||
void set_placeHolder_idx (int idx);
|
||||
|
||||
|
||||
@ -99,7 +99,6 @@ private:
|
||||
|
||||
odf_reader::odf_read_context & odf_context_ ;
|
||||
std::wstring hyperlink_hId;
|
||||
|
||||
|
||||
bool in_span;
|
||||
bool in_paragraph;
|
||||
@ -275,7 +274,7 @@ void pptx_text_context::Impl::ApplyTextProperties(std::wstring style_name, std::
|
||||
|
||||
void pptx_text_context::Impl::ApplyListProperties(odf_reader::paragraph_format_properties & propertiesOut, int Level)
|
||||
{
|
||||
if (Level <0)return;
|
||||
if (Level < 0)return;
|
||||
if (list_style_stack_.empty())return;
|
||||
|
||||
odf_reader::style_list_level_properties *list_properties= NULL;
|
||||
@ -362,7 +361,7 @@ void pptx_text_context::Impl::write_pPr(std::wostream & strm)
|
||||
{
|
||||
get_styles_context().start();
|
||||
|
||||
int level = list_style_stack_.size()-1;
|
||||
int level = list_style_stack_.size() - 1;
|
||||
|
||||
odf_reader::paragraph_format_properties paragraph_properties_;
|
||||
|
||||
@ -643,7 +642,7 @@ void pptx_text_context::Impl::start_list_item(bool restart)
|
||||
|
||||
void pptx_text_context::Impl::start_list(const std::wstring & StyleName, bool Continue)
|
||||
{
|
||||
if (paragraphs_cout_ > 0 && in_paragraph)
|
||||
if (paragraphs_cout_ > 0 && ( in_paragraph || list_style_stack_.empty()))
|
||||
{
|
||||
dump_paragraph();
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ public:
|
||||
|
||||
CP_XML_NODE(L"authors")
|
||||
{
|
||||
for (int i = 0 ; i < author_list_.size(); i++)
|
||||
for (size_t i = 0 ; i < author_list_.size(); i++)
|
||||
{
|
||||
const std::wstring & a = author_list_[i];
|
||||
CP_XML_NODE(L"author")
|
||||
@ -74,7 +74,7 @@ public:
|
||||
|
||||
CP_XML_NODE(L"commentList")
|
||||
{
|
||||
for (int i = 0 ; i < xlsx_comment_.size(); i++)
|
||||
for (size_t i = 0 ; i < xlsx_comment_.size(); i++)
|
||||
{
|
||||
const _xlsx_comment & c = xlsx_comment_[i];
|
||||
|
||||
@ -107,7 +107,7 @@ public:
|
||||
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 (int i = 0; i < xlsx_comment_.size(); i++)
|
||||
for (size_t i = 0; i < xlsx_comment_.size(); i++)
|
||||
{
|
||||
const _xlsx_comment & c = xlsx_comment_[i];
|
||||
|
||||
@ -222,7 +222,7 @@ public:
|
||||
void add(_xlsx_comment & c)
|
||||
{
|
||||
bool find = false;
|
||||
for (long i = 0; i < author_list_.size(); i++)
|
||||
for (size_t i = 0; i < author_list_.size(); i++)
|
||||
{
|
||||
if (c.author_ == author_list_[i])
|
||||
{
|
||||
|
||||
@ -36,8 +36,10 @@
|
||||
#include <vector>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <xml/simple_xml_writer.h>
|
||||
#include "../../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
|
||||
#include "../formulasconvert/formulasconvert.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
@ -148,7 +150,10 @@ public:
|
||||
//CP_XML_ATTR(L"aboveAverage" , 0);
|
||||
if (c.rules[j].type == 1)
|
||||
{
|
||||
CP_XML_ATTR(L"type", *c.rules[j].formula_type);
|
||||
if (c.rules[j].formula_type)
|
||||
CP_XML_ATTR(L"type", *c.rules[j].formula_type);
|
||||
else
|
||||
CP_XML_ATTR(L"type", L"cellIs");
|
||||
if ((c.rules[j].formula) && (!c.rules[j].formula->empty()))
|
||||
{
|
||||
CP_XML_NODE(L"formula")
|
||||
@ -177,13 +182,11 @@ public:
|
||||
{
|
||||
c.rules[j].cfvo[k].serialize(CP_XML_STREAM());
|
||||
}
|
||||
if (c.rules[j].color.size() > 0)
|
||||
|
||||
CP_XML_NODE(L"color")
|
||||
{
|
||||
CP_XML_NODE(L"color")
|
||||
{
|
||||
CP_XML_ATTR(L"rgb", c.rules[j].color[0]);
|
||||
}
|
||||
}
|
||||
CP_XML_ATTR(L"rgb", !c.rules[j].color.empty() ? c.rules[j].color[0] : L"FF000000");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (c.rules[j].type == 3)
|
||||
@ -245,7 +248,7 @@ void xlsx_conditionalFormatting_context::add(std::wstring ref)
|
||||
formulasconvert::odf2oox_converter converter;
|
||||
impl_->conditionalFormattings_.push_back(conditionalFormatting());
|
||||
|
||||
impl_->conditionalFormattings_.back().ref = converter.convert_named_ref(ref, false, L";");
|
||||
impl_->conditionalFormattings_.back().ref = converter.convert_named_ref(ref, false, L" ");
|
||||
}
|
||||
|
||||
void xlsx_conditionalFormatting_context::add_rule(int type)
|
||||
@ -260,7 +263,21 @@ void xlsx_conditionalFormatting_context::set_formula(std::wstring f)
|
||||
int pos = -1;
|
||||
std::wstring val;
|
||||
|
||||
if ( 0 <= (pos = f.find(L"formula-is(")))
|
||||
if ( f == L"unique")
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"uniqueValues";
|
||||
impl_->conditionalFormattings_.back().rules.back().formula = L"0";
|
||||
}
|
||||
else if ( f == L"duplicate")
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"duplicateValues";
|
||||
impl_->conditionalFormattings_.back().rules.back().formula = L"0";
|
||||
}
|
||||
else if ( f == L"above-average")
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"aboveAverage";
|
||||
}
|
||||
else if ( 0 <= (pos = f.find(L"formula-is(")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"expression";
|
||||
val = f.substr(11, f.size() - 12);
|
||||
@ -292,6 +309,45 @@ void xlsx_conditionalFormatting_context::set_formula(std::wstring f)
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"duplicateValues";
|
||||
}
|
||||
else if (0 <= (pos = f.find(L"contains-text")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"containsText";
|
||||
|
||||
std::wstring text = f.substr(14, f.length() - 15);
|
||||
|
||||
if (std::wstring::npos != text.find(L"IF(") ||
|
||||
std::wstring::npos != text.find(L"AND(") ||
|
||||
std::wstring::npos != text.find(L"NOT(") ||
|
||||
std::wstring::npos != text.find(L"ISERROR(") ||
|
||||
std::wstring::npos != text.find(L"SEARCH("))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().text = L"";
|
||||
impl_->conditionalFormattings_.back().rules.back().formula = converter.convert(text);
|
||||
}
|
||||
else if (std::wstring::npos != text.find(L"LEN(TRIM(") &&
|
||||
std::wstring::npos != text.find(L"=0"))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().text = L"";
|
||||
impl_->conditionalFormattings_.back().rules.back().formula = L"0";
|
||||
}
|
||||
else
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().operator_ = L"containsText";
|
||||
if ( 0 == text.find(L"\"") && text.length() - 1 == text.rfind(L"\""))
|
||||
{
|
||||
text = text.substr(1, text.length() - 2);
|
||||
}
|
||||
std::wstring ref = impl_->conditionalFormattings_.back().ref;
|
||||
|
||||
size_t pos;
|
||||
if ((pos = ref.find(L":")) != std::wstring::npos)
|
||||
{
|
||||
ref = ref.substr(0, pos);
|
||||
}
|
||||
impl_->conditionalFormattings_.back().rules.back().text = text;
|
||||
impl_->conditionalFormattings_.back().rules.back().formula = L"NOT(ISERROR(SEARCH(\"" + text + L"\"," + ref + L")))";
|
||||
}
|
||||
}
|
||||
else if (0 <= (pos = f.find(L"top")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"top10";
|
||||
@ -302,14 +358,10 @@ void xlsx_conditionalFormatting_context::set_formula(std::wstring f)
|
||||
if (0 <= (pos = f.find(L"(")))
|
||||
{
|
||||
val = f.substr(pos + 1, f.length() - pos - 2);
|
||||
impl_->conditionalFormattings_.back().rules.back().rank = boost::lexical_cast<int>(val);
|
||||
if (!val.empty())
|
||||
impl_->conditionalFormattings_.back().rules.back().rank = boost::lexical_cast<int>(val);
|
||||
}
|
||||
}
|
||||
else if (0 <= (pos = f.find(L"contains-text")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"containsText";
|
||||
impl_->conditionalFormattings_.back().rules.back().text = f.substr(15, f.length() - 17);
|
||||
}
|
||||
else
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"cellIs";
|
||||
@ -361,6 +413,8 @@ void xlsx_conditionalFormatting_context::set_formula(std::wstring f)
|
||||
impl_->conditionalFormattings_.back().rules.back().operator_ = L"between";
|
||||
val = f.substr(8, f.length() - 9);
|
||||
|
||||
XmlUtils::replace_all(val, L"(", L"");
|
||||
XmlUtils::replace_all(val, L")", L"");
|
||||
if (0 <= (pos = val.find(L",")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula2 = converter.convert_named_expr( val.substr(pos + 1) );
|
||||
@ -398,7 +452,11 @@ void xlsx_conditionalFormatting_context::add_sfv(int type, std::wstring value)
|
||||
|
||||
impl_->conditionalFormattings_.back().rules.back().formula.reset();
|
||||
}
|
||||
else if (!value.empty()) cfvo.val = value;
|
||||
else
|
||||
{
|
||||
if (!value.empty()) cfvo.val = value;
|
||||
else cfvo.val = L"0";
|
||||
}
|
||||
|
||||
impl_->conditionalFormattings_.back().rules.back().cfvo.push_back(cfvo);
|
||||
}
|
||||
|
||||
@ -45,13 +45,6 @@ class xlsx_defined_names::Impl
|
||||
public:
|
||||
void add(std::wstring const & name, std::wstring const & ref, bool formula, int tableId)
|
||||
{
|
||||
int is_file_link = 0;
|
||||
|
||||
if (!formula)
|
||||
{
|
||||
if ((is_file_link = ref.find(L"\\")) >=0) return;
|
||||
if ((is_file_link = ref.find(L"/")) >=0) return;
|
||||
}
|
||||
formulasconvert::odf2oox_converter converter;
|
||||
std::wstring oox_ref;
|
||||
|
||||
@ -72,34 +65,31 @@ public:
|
||||
|
||||
void xlsx_serialize(std::wostream & _Wostream)
|
||||
{
|
||||
if (content_.size() > 0)
|
||||
if (content_.empty()) return;
|
||||
|
||||
CP_XML_WRITER(_Wostream)
|
||||
{
|
||||
CP_XML_WRITER(_Wostream)
|
||||
CP_XML_NODE(L"definedNames")
|
||||
{
|
||||
CP_XML_NODE(L"definedNames")
|
||||
for (size_t i = 0 ; i < content_.size(); i++)
|
||||
{
|
||||
for (int i = 0 ; i < content_.size(); i++)
|
||||
CP_XML_NODE(L"definedName")
|
||||
{
|
||||
CP_XML_NODE(L"definedName")
|
||||
{
|
||||
CP_XML_ATTR(L"name", content_[i].name);
|
||||
|
||||
if (content_[i].tableId >= 0)
|
||||
{
|
||||
CP_XML_ATTR(L"localSheetId", content_[i].tableId);
|
||||
}
|
||||
|
||||
int pos;
|
||||
if ( (pos = content_[i].ref.find(L"#REF!")) >= 0 )
|
||||
{
|
||||
CP_XML_ATTR(L"comment", content_[i].ref);
|
||||
CP_XML_CONTENT(L"#REF!");
|
||||
}
|
||||
else
|
||||
CP_XML_CONTENT(content_[i].ref);
|
||||
CP_XML_ATTR(L"name", content_[i].name);
|
||||
|
||||
if (content_[i].tableId >= 0)
|
||||
{
|
||||
CP_XML_ATTR(L"localSheetId", content_[i].tableId);
|
||||
}
|
||||
|
||||
if ( content_[i].ref.find(L"#REF!") != std::wstring::npos )
|
||||
{
|
||||
CP_XML_ATTR(L"comment", content_[i].ref);
|
||||
CP_XML_CONTENT(L"#REF!");
|
||||
}
|
||||
else
|
||||
CP_XML_CONTENT(content_[i].ref);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,7 +46,6 @@ namespace oox {
|
||||
xlsx_defined_names();
|
||||
~xlsx_defined_names();
|
||||
|
||||
public:
|
||||
void add(std::wstring const & name, std::wstring const & ref, bool formula, int tableId);
|
||||
void xlsx_serialize(std::wostream & _Wostream);
|
||||
|
||||
|
||||
@ -162,7 +162,7 @@ void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing & val)
|
||||
}
|
||||
CP_XML_NODE(L"xdr:cNvSpPr")//non visual properies (собственно тока 1 там)
|
||||
{
|
||||
if (val.sub_type==1)CP_XML_ATTR(L"txBox", 1);
|
||||
if (val.sub_type == 1)CP_XML_ATTR(L"txBox", 1);
|
||||
}
|
||||
} // xdr:nv_Pr
|
||||
CP_XML_NODE(L"xdr:spPr")
|
||||
@ -171,11 +171,7 @@ void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing & val)
|
||||
|
||||
val.serialize_shape(CP_XML_STREAM());
|
||||
|
||||
bool draw_always = false;
|
||||
if (val.sub_type == 5 || val.sub_type == 6)//line собственно ) - если ее нет - в свойствах будет
|
||||
draw_always = true;
|
||||
|
||||
oox_serialize_ln(CP_XML_STREAM(),val.additional, draw_always);
|
||||
oox_serialize_ln(CP_XML_STREAM(),val.additional, val.lined);
|
||||
} // xdr:spPr
|
||||
|
||||
xlsx_serialize_text(CP_XML_STREAM(), val);
|
||||
|
||||
@ -53,8 +53,7 @@ namespace oox {
|
||||
class xlsx_drawing_context_handle::Impl
|
||||
{
|
||||
public:
|
||||
Impl(mediaitems & items)
|
||||
: items_(items), next_rId_(1), next_drawing_id_(1)
|
||||
Impl(mediaitems & items) : items_(items), next_rId_(1), next_drawing_id_(1)
|
||||
{
|
||||
}
|
||||
|
||||
@ -162,6 +161,8 @@ void xlsx_drawing_context::clear()
|
||||
{
|
||||
impl_->object_description_.type_ = typeUnknown;
|
||||
impl_->object_description_.in_group_ = false;
|
||||
impl_->object_description_.lined_ = false;
|
||||
impl_->object_description_.connector_ = false;
|
||||
impl_->object_description_.xlink_href_ = L"";
|
||||
impl_->object_description_.name_ = L"";
|
||||
impl_->object_description_.anchor_ = L"";
|
||||
@ -202,20 +203,25 @@ void xlsx_drawing_context::end_group()
|
||||
{
|
||||
if (impl_->groups_.size() < 1) return;
|
||||
|
||||
_rect & group_rect = impl_->groups_.back()->svg_rect_.get();
|
||||
|
||||
group_rect.cy -= group_rect.y;
|
||||
group_rect.cx -= group_rect.x;
|
||||
|
||||
for (size_t i = 0; i < impl_->groups_.back()->child_objects_.size(); i++)
|
||||
if (impl_->groups_.back()->svg_rect_)
|
||||
{
|
||||
_rect & r = impl_->groups_.back()->child_objects_[i].svg_rect_.get();
|
||||
|
||||
r.y -= group_rect.y;
|
||||
r.x -= group_rect.x;
|
||||
_rect & group_rect = impl_->groups_.back()->svg_rect_.get();
|
||||
|
||||
group_rect.cy -= group_rect.y;
|
||||
group_rect.cx -= group_rect.x;
|
||||
|
||||
for (size_t i = 0; i < impl_->groups_.back()->child_objects_.size(); i++)
|
||||
{
|
||||
if (!impl_->groups_.back()->child_objects_[i].svg_rect_) continue;
|
||||
|
||||
_rect & r = impl_->groups_.back()->child_objects_[i].svg_rect_.get();
|
||||
|
||||
r.y -= group_rect.y;
|
||||
r.x -= group_rect.x;
|
||||
}
|
||||
}
|
||||
|
||||
if (impl_->groups_.back()->in_group_)
|
||||
if (impl_->groups_.back()->in_group_ && impl_->groups_.back()->svg_rect_)
|
||||
{
|
||||
_rect & objct_rect = impl_->groups_.back()->svg_rect_.get();
|
||||
|
||||
@ -251,7 +257,8 @@ void xlsx_drawing_context::start_drawing(std::wstring const & name)
|
||||
|
||||
void xlsx_drawing_context::end_drawing()
|
||||
{
|
||||
if (impl_->object_description_.in_group_)
|
||||
if (impl_->object_description_.in_group_ &&
|
||||
impl_->object_description_.svg_rect_)
|
||||
{
|
||||
_rect & objct_rect = impl_->object_description_.svg_rect_.get();
|
||||
_rect & group_rect = impl_->groups_.back()->svg_rect_.get();
|
||||
@ -533,8 +540,12 @@ void xlsx_drawing_context::process_image(drawing_object_description & obj, _xlsx
|
||||
drawing.fill.bitmap = oox_bitmap_fill::create();
|
||||
drawing.fill.type = 2;
|
||||
}
|
||||
_CP_OPT(std::wstring) sTextContent;
|
||||
GetProperty(obj.additional_,L"text-content",sTextContent);
|
||||
_CP_OPT(std::wstring) sTextContent, sColorMode;
|
||||
|
||||
GetProperty(obj.additional_, L"text-content", sTextContent);
|
||||
GetProperty(obj.additional_, L"color-mode", sColorMode);
|
||||
GetProperty(obj.additional_, L"luminance", drawing.fill.bitmap->luminance);
|
||||
GetProperty(obj.additional_, L"contrast", drawing.fill.bitmap->contrast);
|
||||
|
||||
if (sTextContent)//в ms office на картинке нельзя сделать надпись - меняем тип на рект с заливкой картинкой
|
||||
{
|
||||
@ -543,9 +554,12 @@ 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, NULL/*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"))
|
||||
drawing.fill.bitmap->bGrayscale = true;
|
||||
|
||||
std::wstring ref;/// это ссылка на выходной внешний объект
|
||||
bool isMediaInternal = false;
|
||||
|
||||
@ -662,11 +676,13 @@ void xlsx_drawing_context::process_group_objects(std::vector<drawing_object_desc
|
||||
|
||||
_xlsx_drawing drawing =_xlsx_drawing();
|
||||
|
||||
drawing.type = obj.type_;
|
||||
drawing.name = obj.name_;
|
||||
drawing.fill = obj.fill_;
|
||||
drawing.inGroup = obj.in_group_;
|
||||
drawing.id = impl_->next_rId();
|
||||
drawing.type = obj.type_;
|
||||
drawing.name = obj.name_;
|
||||
drawing.fill = obj.fill_;
|
||||
drawing.inGroup = obj.in_group_;
|
||||
drawing.id = impl_->next_rId();
|
||||
drawing.lined = obj.lined_;
|
||||
drawing.connector = obj.connector_;
|
||||
|
||||
drawing.sub_type = obj.shape_type_;
|
||||
|
||||
@ -730,6 +746,14 @@ void xlsx_drawing_context::set_link(std::wstring link, RelsType typeRels)
|
||||
void xlsx_drawing_context::end_action()
|
||||
{
|
||||
}
|
||||
void xlsx_drawing_context::set_is_line_shape(bool val)
|
||||
{
|
||||
impl_->object_description_.lined_ = val;
|
||||
}
|
||||
void xlsx_drawing_context::set_is_connector_shape(bool val)
|
||||
{
|
||||
impl_->object_description_.connector_ = val;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -110,6 +110,9 @@ public:
|
||||
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);
|
||||
|
||||
std::vector<odf_reader::_property> & get_properties();
|
||||
|
||||
std::wstring add_hyperlink(std::wstring const & ref);
|
||||
|
||||
@ -104,7 +104,7 @@ public:
|
||||
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 (int i = 0 ; i < xlsx_drawings_.size(); i++)
|
||||
for (size_t i = 0 ; i < xlsx_drawings_.size(); i++)
|
||||
{
|
||||
xlsx_drawings_[i].serialize(CP_XML_STREAM());
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ void xlsx_dxfs::serialize(std::wostream & _Wostream) const
|
||||
{
|
||||
CP_XML_ATTR(L"count", impl_->dxf_array.size());
|
||||
|
||||
for (int i = 0; i < impl_->dxf_array.size(); i++)
|
||||
for (size_t i = 0; i < impl_->dxf_array.size(); i++)
|
||||
{
|
||||
CP_XML_NODE(L"dxf")
|
||||
{
|
||||
|
||||
@ -65,7 +65,7 @@ public:
|
||||
{
|
||||
CP_XML_ATTR(L"count", merges_.size());
|
||||
|
||||
for (int i = 0 ; i < merges_.size(); i++)
|
||||
for (size_t i = 0 ; i < merges_.size(); i++)
|
||||
{
|
||||
merge & m = merges_[i];
|
||||
|
||||
|
||||
@ -41,8 +41,9 @@ namespace oox {
|
||||
class xlsx_xml_worksheet::Impl
|
||||
{
|
||||
public:
|
||||
Impl(std::wstring const & name) : name_(name){}
|
||||
Impl(std::wstring const & name, bool hidden) : name_(name), hidden_(hidden) {}
|
||||
std::wstring name_;
|
||||
bool hidden_;
|
||||
|
||||
std::wstringstream cols_;
|
||||
std::wstringstream sheetFormat_;
|
||||
@ -52,6 +53,7 @@ public:
|
||||
std::wstringstream hyperlinks_;
|
||||
std::wstringstream comments_;
|
||||
std::wstringstream sort_;
|
||||
std::wstringstream tableParts_;
|
||||
std::wstringstream autofilter_;
|
||||
std::wstringstream conditionalFormatting_;
|
||||
std::wstringstream picture_background_;
|
||||
@ -59,6 +61,7 @@ public:
|
||||
std::wstringstream ole_objects_;
|
||||
std::wstringstream page_props_;
|
||||
std::wstringstream controls_;
|
||||
std::wstringstream protection_;
|
||||
|
||||
rels sheet_rels_;
|
||||
|
||||
@ -76,14 +79,18 @@ std::wstring xlsx_xml_worksheet::name() const
|
||||
{
|
||||
return impl_->name_;
|
||||
}
|
||||
|
||||
xlsx_xml_worksheet_ptr xlsx_xml_worksheet::create(std::wstring const & name)
|
||||
bool xlsx_xml_worksheet::hidden() const
|
||||
{
|
||||
return boost::make_shared<xlsx_xml_worksheet>(name);
|
||||
return impl_->hidden_;
|
||||
}
|
||||
|
||||
xlsx_xml_worksheet::xlsx_xml_worksheet(std::wstring const & name)
|
||||
: impl_(new xlsx_xml_worksheet::Impl(name))
|
||||
xlsx_xml_worksheet_ptr xlsx_xml_worksheet::create(std::wstring const & name, bool hidden)
|
||||
{
|
||||
return boost::make_shared<xlsx_xml_worksheet>(name, hidden);
|
||||
}
|
||||
|
||||
xlsx_xml_worksheet::xlsx_xml_worksheet(std::wstring const & name, bool hidden)
|
||||
: impl_(new xlsx_xml_worksheet::Impl(name, hidden))
|
||||
{
|
||||
}
|
||||
|
||||
@ -99,16 +106,18 @@ std::wostream & xlsx_xml_worksheet::sheetFormat()
|
||||
{
|
||||
return impl_->sheetFormat_;
|
||||
}
|
||||
|
||||
std::wostream & xlsx_xml_worksheet::sheetData()
|
||||
{
|
||||
return impl_->sheetData_;
|
||||
}
|
||||
|
||||
std::wostream & xlsx_xml_worksheet::mergeCells()
|
||||
{
|
||||
return impl_->mergeCells_;
|
||||
}
|
||||
std::wostream & xlsx_xml_worksheet::tableParts()
|
||||
{
|
||||
return impl_->tableParts_;
|
||||
}
|
||||
std::wostream & xlsx_xml_worksheet::conditionalFormatting()
|
||||
{
|
||||
return impl_->conditionalFormatting_;
|
||||
@ -153,6 +162,10 @@ std::wostream & xlsx_xml_worksheet::dataValidations()
|
||||
{
|
||||
return impl_->dataValidations_;
|
||||
}
|
||||
std::wostream & xlsx_xml_worksheet::protection()
|
||||
{
|
||||
return impl_->protection_;
|
||||
}
|
||||
//---------------------------------------------------------------------------------------
|
||||
rels & xlsx_xml_worksheet::sheet_rels()
|
||||
{
|
||||
@ -181,6 +194,10 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
{
|
||||
CP_XML_STREAM() << impl_->sheetData_.str();
|
||||
}
|
||||
if (!impl_->protection_.str().empty())
|
||||
{
|
||||
CP_XML_STREAM() << impl_->protection_.str();
|
||||
}
|
||||
//оказывается порядок нахождения элементов важен !!! (для office 2010)
|
||||
//объединенные ячейки раньше чем гиперлинки !!!
|
||||
|
||||
@ -200,7 +217,6 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
CP_XML_STREAM() << impl_->hyperlinks_.str();
|
||||
}
|
||||
}
|
||||
|
||||
if (!impl_->page_props_.str().empty())
|
||||
{
|
||||
CP_XML_STREAM() << impl_->page_props_.str();
|
||||
@ -229,6 +245,13 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
CP_XML_STREAM() << impl_->controls_.str();
|
||||
}
|
||||
}
|
||||
if (!impl_->tableParts_.str().empty())
|
||||
{
|
||||
CP_XML_NODE(L"tableParts")
|
||||
{
|
||||
CP_XML_STREAM() << impl_->tableParts_.str();
|
||||
}
|
||||
}
|
||||
CP_XML_STREAM() << impl_->picture_background_.str();
|
||||
|
||||
//CP_XML_NODE(L"headerFooter){}
|
||||
|
||||
@ -47,10 +47,11 @@ typedef _CP_PTR(xlsx_xml_worksheet) xlsx_xml_worksheet_ptr;
|
||||
class xlsx_xml_worksheet: noncopyable
|
||||
{
|
||||
public:
|
||||
xlsx_xml_worksheet(std::wstring const & name);
|
||||
xlsx_xml_worksheet(std::wstring const & name, bool hidden);
|
||||
~xlsx_xml_worksheet();
|
||||
|
||||
std::wstring name() const;
|
||||
bool hidden() const;
|
||||
|
||||
std::wostream & cols();
|
||||
std::wostream & sheetFormat();
|
||||
@ -60,6 +61,7 @@ public:
|
||||
std::wostream & drawing();
|
||||
std::wostream & comments();
|
||||
std::wostream & autofilter();
|
||||
std::wostream & tableParts();
|
||||
std::wostream & conditionalFormatting();
|
||||
std::wostream & picture_background();
|
||||
std::wostream & dataValidations();
|
||||
@ -67,6 +69,7 @@ public:
|
||||
std::wostream & ole_objects();
|
||||
std::wostream & page_properties();
|
||||
std::wostream & controls();
|
||||
std::wostream & protection();
|
||||
|
||||
rels & sheet_rels(); //hyperlink, background image, external, media ...
|
||||
|
||||
@ -80,7 +83,7 @@ public:
|
||||
std::pair<std::wstring, std::wstring> get_vml_drawing_link() const;
|
||||
std::pair<std::wstring, std::wstring> get_comments_link() const;
|
||||
|
||||
static xlsx_xml_worksheet_ptr create(std::wstring const & name);
|
||||
static xlsx_xml_worksheet_ptr create(std::wstring const & name, bool hidden);
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
|
||||
@ -88,7 +88,6 @@ void xlsx_document::write(const std::wstring & RootPath)
|
||||
pivot_cache_content::pivot_cache_content() : definitions_rels_file_(rels_file::create(L""))
|
||||
{
|
||||
}
|
||||
|
||||
_CP_PTR(pivot_cache_content) pivot_cache_content::create()
|
||||
{
|
||||
return boost::make_shared<pivot_cache_content>();
|
||||
@ -97,17 +96,23 @@ _CP_PTR(pivot_cache_content) pivot_cache_content::create()
|
||||
pivot_table_content::pivot_table_content() : rels_file_(rels_file::create(L""))
|
||||
{
|
||||
}
|
||||
|
||||
_CP_PTR(pivot_table_content) pivot_table_content::create()
|
||||
{
|
||||
return boost::make_shared<pivot_table_content>();
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------
|
||||
external_links_content::external_links_content() : rels_file_(rels_file::create(L""))
|
||||
{
|
||||
}
|
||||
_CP_PTR(external_links_content) external_links_content::create()
|
||||
{
|
||||
return boost::make_shared<external_links_content>();
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------
|
||||
sheet_content::sheet_content() : rels_(rels_file::create(L""))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
_CP_PTR(sheet_content) sheet_content::create()
|
||||
{
|
||||
return boost::make_shared<sheet_content>();
|
||||
@ -198,8 +203,11 @@ void xl_files::write(const std::wstring & RootPath)
|
||||
control_props_files_.set_main_document( this->get_main_document() );
|
||||
control_props_files_.write(path);
|
||||
}
|
||||
int index = 1;
|
||||
if (true)
|
||||
{
|
||||
external_links_files_.set_rels(&rels_files_);
|
||||
external_links_files_.set_main_document(get_main_document());
|
||||
external_links_files_.write(path);
|
||||
}
|
||||
{
|
||||
//workbook_->hyperlinks->write(path);
|
||||
rels_files_.add( relationship( L"hId1", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument", L"xl/workbook.xml" ) );
|
||||
@ -217,7 +225,6 @@ void xl_files::write(const std::wstring & RootPath)
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
contentTypes->add_override(L"/xl/connections.xml", L"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml");
|
||||
}
|
||||
|
||||
if (styles_)
|
||||
{
|
||||
styles_->write(path);
|
||||
@ -245,6 +252,11 @@ void xl_files::write(const std::wstring & RootPath)
|
||||
charts_files_.set_main_document(get_main_document());
|
||||
charts_files_.write(path);
|
||||
}
|
||||
{
|
||||
table_part_files_.set_main_document(get_main_document());
|
||||
table_part_files_.write(path);
|
||||
}
|
||||
|
||||
if (drawings_)
|
||||
{
|
||||
drawings_->set_main_document(get_main_document());
|
||||
@ -286,11 +298,11 @@ void xl_files::add_sheet(sheet_content_ptr sheet)
|
||||
sheets_files_.add_sheet(sheet);
|
||||
}
|
||||
|
||||
void xl_files::set_media(mediaitems & _Mediaitems, NSFonts::IApplicationFonts *pAppFonts)
|
||||
void xl_files::set_media(mediaitems & _Mediaitems)
|
||||
{
|
||||
if (_Mediaitems.count_image + _Mediaitems.count_media > 0)
|
||||
{
|
||||
media_ = element_ptr( new media(_Mediaitems, pAppFonts) );
|
||||
media_ = element_ptr( new media(_Mediaitems, _Mediaitems.applicationFonts()) );
|
||||
}
|
||||
|
||||
if (_Mediaitems.count_object > 0)
|
||||
@ -322,6 +334,10 @@ void xl_files::add_pivot_table(pivot_table_content_ptr pivot_table)
|
||||
{
|
||||
pivot_table_files_.add_pivot_table(pivot_table);
|
||||
}
|
||||
void xl_files::add_table_part(const std::wstring &content)
|
||||
{
|
||||
table_part_files_.add_table_part(content);
|
||||
}
|
||||
void xl_files::add_jsaProject(const std::string &content)
|
||||
{
|
||||
jsaProject_ = package::simple_element::create(L"jsaProject.bin", content);
|
||||
@ -330,6 +346,10 @@ void xl_files::add_control_props (simple_element_ptr element)
|
||||
{
|
||||
control_props_files_.add_control_props(element);
|
||||
}
|
||||
void xl_files::add_external_links(external_links_content_ptr content)
|
||||
{
|
||||
external_links_files_.add_external_links(content);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
void xl_pivot_cache_files::add_pivot_cache(pivot_cache_content_ptr pivot_cache)
|
||||
{
|
||||
@ -418,20 +438,80 @@ void xl_pivot_table_files::write(const std::wstring & RootPath)
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
void xl_external_links_files::add_external_links(external_links_content_ptr content)
|
||||
{
|
||||
external_links_.push_back(content);
|
||||
}
|
||||
void xl_external_links_files::write(const std::wstring & RootPath)
|
||||
{
|
||||
if (external_links_.empty()) return;
|
||||
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"externalLinks";
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
for (size_t i = 0; i < external_links_.size(); i++)
|
||||
{
|
||||
const std::wstring fileName = std::wstring(L"externalLink") + std::to_wstring(i + 1) + L".xml";
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml";
|
||||
contentTypes->add_override(std::wstring(L"/xl/externalLinks/") + fileName, kWSConType);
|
||||
|
||||
package::simple_element(fileName, external_links_[i]->content_.str()).write(path);
|
||||
|
||||
{
|
||||
rels_files relFiles;
|
||||
external_links_[i]->rels_file_->set_file_name(fileName + L".rels");
|
||||
|
||||
relFiles.add_rel_file(external_links_[i]->rels_file_);
|
||||
relFiles.write(path);
|
||||
}
|
||||
if (rels_)
|
||||
{
|
||||
static const std::wstring kWSRel = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink";
|
||||
const std::wstring fileRef = std::wstring(L"externalLinks/") + fileName;
|
||||
rels_->add(external_links_[i]->rId_, kWSRel, fileRef);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
void xl_table_part_files::add_table_part(const std::wstring & table_part)
|
||||
{
|
||||
table_parts_.push_back(table_part);
|
||||
}
|
||||
void xl_table_part_files::write(const std::wstring & RootPath)
|
||||
{
|
||||
if (table_parts_.empty()) return;
|
||||
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"tables";
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
for (size_t i = 0; i < table_parts_.size(); i++)
|
||||
{
|
||||
const std::wstring fileName = std::wstring(L"table") + std::to_wstring(i + 1) + L".xml";
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml";
|
||||
contentTypes->add_override(std::wstring(L"/xl/tables/") + fileName, kWSConType);
|
||||
|
||||
package::simple_element(fileName, table_parts_[i]).write(path);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
void xl_charts_files::add_chart(chart_content_ptr chart)
|
||||
{
|
||||
charts_.push_back(chart);
|
||||
}
|
||||
void xl_charts_files::write(const std::wstring & RootPath)
|
||||
{
|
||||
if (charts_.empty()) return;
|
||||
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"charts";
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
size_t count = 0;
|
||||
|
||||
for (size_t i = 0; i < charts_.size(); i++)
|
||||
{
|
||||
count++;
|
||||
const std::wstring fileName = std::wstring(L"chart") + std::to_wstring(i + 1) + L".xml";
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
|
||||
|
||||
@ -72,6 +72,7 @@ typedef _CP_PTR(sheet_content) sheet_content_ptr;
|
||||
//------------------------------------------------------------------------
|
||||
class pivot_cache_content;
|
||||
typedef _CP_PTR(pivot_cache_content) pivot_cache_content_ptr;
|
||||
|
||||
class pivot_cache_content : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
@ -94,6 +95,7 @@ private:
|
||||
//------------------------------------------------------------------------
|
||||
class pivot_table_content;
|
||||
typedef _CP_PTR(pivot_table_content) pivot_table_content_ptr;
|
||||
|
||||
class pivot_table_content : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
@ -111,6 +113,28 @@ private:
|
||||
rels_file_ptr rels_file_;
|
||||
};
|
||||
//------------------------------------------------------------------------
|
||||
class external_links_content;
|
||||
typedef _CP_PTR(external_links_content) external_links_content_ptr;
|
||||
|
||||
class external_links_content : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
external_links_content();
|
||||
static external_links_content_ptr create();
|
||||
|
||||
std::wstring & rId() { return rId_;}
|
||||
std::wostream & content() { return content_; }
|
||||
rels & get_rels() { return rels_file_->get_rels(); }
|
||||
|
||||
std::wstring str() { return content_.str(); }
|
||||
|
||||
friend class xl_external_links_files;
|
||||
private:
|
||||
std::wstringstream content_;
|
||||
rels_file_ptr rels_file_;
|
||||
std::wstring rId_;
|
||||
};
|
||||
//------------------------------------------------------------------------
|
||||
class sheets_files : public element
|
||||
{
|
||||
public:
|
||||
@ -131,7 +155,17 @@ public:
|
||||
|
||||
};
|
||||
|
||||
class xl_table_part_files : public element
|
||||
{
|
||||
public:
|
||||
xl_table_part_files(){}
|
||||
|
||||
void add_table_part(const std::wstring & table_part);
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
std::vector<std::wstring> table_parts_;
|
||||
|
||||
};
|
||||
class xl_charts_files : public element
|
||||
{
|
||||
public:
|
||||
@ -143,7 +177,22 @@ public:
|
||||
std::vector<chart_content_ptr> charts_;
|
||||
|
||||
};
|
||||
|
||||
class xl_external_links_files : public element
|
||||
{
|
||||
public:
|
||||
xl_external_links_files(){}
|
||||
|
||||
void add_external_links(external_links_content_ptr content);
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
void set_rels(rels_files * rels)
|
||||
{
|
||||
rels_ = rels;
|
||||
}
|
||||
private:
|
||||
std::vector<external_links_content_ptr> external_links_;
|
||||
rels_files * rels_;
|
||||
};
|
||||
class xl_pivot_table_files : public element
|
||||
{
|
||||
public:
|
||||
@ -235,7 +284,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, NSFonts::IApplicationFonts *pAppFonts);
|
||||
void set_media (mediaitems & _Mediaitems);
|
||||
void set_drawings (element_ptr Element);
|
||||
void set_vml_drawings (element_ptr Element);
|
||||
void set_comments (element_ptr Element);
|
||||
@ -244,6 +293,8 @@ public:
|
||||
void add_pivot_table (pivot_table_content_ptr table);
|
||||
void add_jsaProject (const std::string &content);
|
||||
void add_control_props (simple_element_ptr Element);
|
||||
void add_table_part (const std::wstring &content);
|
||||
void add_external_links (external_links_content_ptr content);
|
||||
|
||||
private:
|
||||
rels_files rels_files_;
|
||||
@ -252,7 +303,9 @@ private:
|
||||
xl_pivot_cache_files pivot_cache_files_;
|
||||
xl_pivot_table_files pivot_table_files_;
|
||||
xl_control_props_files control_props_files_;
|
||||
|
||||
xl_table_part_files table_part_files_;
|
||||
xl_external_links_files external_links_files_;
|
||||
|
||||
element_ptr theme_;
|
||||
element_ptr workbook_;
|
||||
|
||||
@ -277,7 +330,7 @@ public:
|
||||
|
||||
virtual content_types_file & get_content_types_file() { return content_type_file_; }
|
||||
xl_files & get_xl_files() { return xl_files_; }
|
||||
|
||||
rels_files & get_rels_files() { return rels_files_; }
|
||||
private:
|
||||
xlsx_content_types_file content_type_file_;
|
||||
xl_files xl_files_;
|
||||
|
||||
@ -302,12 +302,24 @@ void xlsx_pivots_context::Impl::calc_headers()
|
||||
|
||||
std::map<size_t, size_t>::iterator pFind;
|
||||
|
||||
//current_.bAxisCol = false;
|
||||
//current_.bAxisRow = false;
|
||||
|
||||
size_t min_col = 0xffffff, min_row = 0xffffff;
|
||||
size_t prev_col, prev_row;
|
||||
for (size_t i = 0; i < current_.headers.size(); i++)//("F18","F19","F23","G21","H21")
|
||||
{
|
||||
size_t row = 0, col = 0;
|
||||
oox::getCellAddressInv(current_.headers[i], col, row);
|
||||
|
||||
//if (i > 0)
|
||||
//{
|
||||
// if (col != prev_col)current_.bAxisCol = true;
|
||||
// if (row != prev_row)current_.bAxisRow = true;
|
||||
//}
|
||||
prev_col = col;
|
||||
prev_row = row;
|
||||
|
||||
if (col < min_col) min_col = col;
|
||||
if (row < min_row) min_row = row;
|
||||
|
||||
@ -540,7 +552,7 @@ void xlsx_pivots_context::Impl::sort_fields()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (count_items_row < current_.fields[i].caches.size())
|
||||
if (count_items_row < (int)current_.fields[i].caches.size())
|
||||
bAddRepeateRow = true;
|
||||
}
|
||||
}
|
||||
@ -578,11 +590,17 @@ void xlsx_pivots_context::Impl::sort_fields()
|
||||
i--;
|
||||
}
|
||||
}
|
||||
if ((bAddRepeateCol || (count_items_col == 0 && current_.bAxisCol))/* && bShowEmptyCol*/) ///* || (bEmptyColCache && current_.grand_total < 0)*/?? Financial Execution (template).ods
|
||||
bool data_col_repeate = false;
|
||||
if ((bAddRepeateRow || (count_items_row == 0 && current_.bAxisRow)) && (current_.grand_total == 1 || current_.grand_total == 3 || current_.data_on_row))/* && bShowEmptyRow*/
|
||||
{
|
||||
current_.row_fields.push_back(-2);
|
||||
data_col_repeate = true;
|
||||
}
|
||||
|
||||
if (!data_col_repeate && (bAddRepeateCol || (count_items_col == 0 && current_.bAxisCol)) && (current_.grand_total == 1 || current_.grand_total == 2 || current_.data_fields.size() > 1 ))/* && bShowEmptyCol*/ ///* || (bEmptyColCache && current_.grand_total < 0)*/?? Financial Execution (template).ods
|
||||
current_.col_fields.push_back(-2);
|
||||
|
||||
if ((bAddRepeateRow || (count_items_row == 0 && current_.bAxisRow))/* && bShowEmptyRow*/)
|
||||
current_.row_fields.push_back(-2);
|
||||
|
||||
}
|
||||
void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
|
||||
{
|
||||
@ -772,7 +790,7 @@ void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
|
||||
{
|
||||
int fld = 0, ind_fld = current_.fields[ind_field_dirty].references_field < 0 ? ind_field_dirty :
|
||||
current_.fields[ind_field_dirty].references_field;
|
||||
for (size_t k = 0; k < ind_fld; k++)
|
||||
for (int k = 0; k < ind_fld; k++)
|
||||
{
|
||||
if (current_.fields[k].type != 7 ) fld++;
|
||||
}
|
||||
@ -815,7 +833,7 @@ void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
|
||||
}
|
||||
std::wstring name;
|
||||
|
||||
if (ind_field_dirty >= 0 && ind_field_dirty < current_.fields.size())
|
||||
if (ind_field_dirty >= 0 && ind_field_dirty < (int)current_.fields.size())
|
||||
{
|
||||
switch(current_.fields[ind_field_dirty].function)
|
||||
{
|
||||
@ -1470,7 +1488,7 @@ void xlsx_pivots_context::add_field_cache(int index, std::wstring value, bool sh
|
||||
if (index < 0)
|
||||
index = impl_->current_.fields.back().caches.size();
|
||||
|
||||
while (index > impl_->current_.fields.back().caches.size())
|
||||
while (index > (int)impl_->current_.fields.back().caches.size())
|
||||
{
|
||||
Impl::_field_value f(L"", L"m", true);
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ public:
|
||||
{
|
||||
double length_pt =0;
|
||||
|
||||
for (int i = 0; i < region_.size(); i++)
|
||||
for (size_t i = 0; i < region_.size(); i++)
|
||||
{
|
||||
region & r = region_[i];
|
||||
if (cell <= r.start_cell + r.count)
|
||||
@ -102,7 +102,7 @@ public:
|
||||
if (pos < 0)//cs102.ods
|
||||
{
|
||||
int c_skip = 0, i = 0;
|
||||
for (i = 0; i < region_.size(); i++)
|
||||
for (i = 0; i < (int)region_.size(); i++)
|
||||
{
|
||||
if (region_[i].count + c_skip > offset)
|
||||
break;
|
||||
@ -119,7 +119,7 @@ public:
|
||||
|
||||
}
|
||||
|
||||
for (int i = 0; i < region_.size(); i++)
|
||||
for (size_t i = 0; i < region_.size(); i++)
|
||||
{
|
||||
region & r = region_[i];
|
||||
if (r.start_cell + r.count <= offset)
|
||||
@ -172,7 +172,7 @@ public:
|
||||
}
|
||||
std::pair<int, double> search(double pos)
|
||||
{
|
||||
for (int i = 0; i < region_.size(); i++)
|
||||
for (size_t i = 0; i < region_.size(); i++)
|
||||
{
|
||||
region & r = region_[i];
|
||||
|
||||
|
||||
@ -44,6 +44,7 @@
|
||||
|
||||
#include "../formulasconvert/formulasconvert.h"
|
||||
|
||||
#include "../../../OfficeCryptReader/source/CryptTransform.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
@ -81,8 +82,8 @@ void xlsx_data_range::serialize_sort (std::wostream & _Wostream)
|
||||
std::wstring ref1, ref2;
|
||||
size_t col_1, row_1, col_2, row_2;
|
||||
|
||||
int pos = ref.find(L":");
|
||||
if (pos >= 0)
|
||||
size_t pos = ref.find(L":");
|
||||
if (pos != std::wstring::npos)
|
||||
{
|
||||
ref1 = ref.substr(0, pos );
|
||||
ref2 = ref.substr(pos + 1);
|
||||
@ -134,10 +135,28 @@ xlsx_table_state::xlsx_table_state(xlsx_conversion_context * Context, std::wstri
|
||||
xlsx_comments_context_ (Context->get_comments_context_handle()),
|
||||
table_column_last_width_(0.0),
|
||||
in_cell(false),
|
||||
bEndTable(false)
|
||||
|
||||
bEndTable(false),
|
||||
bRTL(false),
|
||||
bHidden(false)
|
||||
{
|
||||
memset(&group_row_,0,sizeof(_group_row));
|
||||
odf_reader::style_table_properties * table_prop = NULL;
|
||||
odf_reader::style_instance * tableStyle = context_->root()->odf_context().styleContainer().style_by_name(table_style_, odf_types::style_family::Table, false);
|
||||
|
||||
if ((tableStyle) && (tableStyle->content()))
|
||||
table_prop = tableStyle->content()->get_style_table_properties();
|
||||
|
||||
if (table_prop)
|
||||
{
|
||||
if (table_prop->content().common_writing_mode_attlist_.style_writing_mode_)
|
||||
{
|
||||
if (table_prop->content().common_writing_mode_attlist_.style_writing_mode_->get_type() == odf_types::writing_mode::RlTb)
|
||||
bRTL = true;
|
||||
}
|
||||
if ((table_prop->content().table_display_) && (false == table_prop->content().table_display_))
|
||||
{
|
||||
bHidden = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void xlsx_table_state::start_column(unsigned int repeated, const std::wstring & defaultCellStyleName)
|
||||
@ -149,6 +168,31 @@ void xlsx_table_state::start_column(unsigned int repeated, const std::wstring &
|
||||
columns_.push_back(repeated);
|
||||
}
|
||||
|
||||
void xlsx_table_state::set_rtl(bool val)
|
||||
{
|
||||
bRTL = val;
|
||||
}
|
||||
|
||||
void xlsx_table_state::set_protection(bool val, const std::wstring &key, const std::wstring &algorithm)
|
||||
{
|
||||
bProtected = val;
|
||||
protect_key = key;
|
||||
|
||||
size_t pos = algorithm.find(L"#");
|
||||
if (pos != std::wstring::npos)
|
||||
{
|
||||
protect_key_algorithm = algorithm.substr(pos + 1);
|
||||
}
|
||||
|
||||
//test
|
||||
//CRYPT::odfWriteProtect protect;
|
||||
//protect.SetProtectKey(DecodeBase64(protect_key));
|
||||
//protect.SetPassword(L"123");
|
||||
|
||||
//bool res = protect.Verify();
|
||||
|
||||
}
|
||||
|
||||
unsigned int xlsx_table_state::columns_count() const
|
||||
{
|
||||
return columns_count_;
|
||||
@ -195,7 +239,7 @@ std::wstring xlsx_table_state::default_row_cell_style() const
|
||||
|
||||
std::wstring xlsx_table_state::default_column_cell_style() const
|
||||
{
|
||||
if (current_table_column_ + 1 < column_default_cell_style_name_.size())
|
||||
if (current_table_column_ + 1 < (int)column_default_cell_style_name_.size())
|
||||
return column_default_cell_style_name_.at(current_table_column_ + 1);
|
||||
else
|
||||
{
|
||||
@ -224,10 +268,10 @@ void xlsx_table_state::start_cell(size_t columnsSpanned, size_t rowsSpanned)
|
||||
xlsx_merge_cells_.add_merge(current_table_column_, current_table_row_, columnsSpanned, rowsSpanned);
|
||||
}
|
||||
|
||||
if ( current_columns_spaned() > 0 )
|
||||
{
|
||||
_CP_LOG << L"[warning] current columns spanned > 0\n";
|
||||
}
|
||||
//if ( current_columns_spaned() > 0 )
|
||||
//{
|
||||
// _CP_LOG << L"[warning] current columns spanned > 0\n";
|
||||
//}
|
||||
|
||||
columns_spanned_num_ = static_cast<int>(columnsSpanned);
|
||||
|
||||
@ -241,16 +285,16 @@ void xlsx_table_state::start_cell(size_t columnsSpanned, size_t rowsSpanned)
|
||||
rows_spanned_.push_back(xlsx_row_spanned());
|
||||
}
|
||||
|
||||
if (rows_spanned_.size() <= current_table_column_)
|
||||
if ((int)rows_spanned_.size() <= current_table_column_)
|
||||
{
|
||||
_CP_LOG << L"[warning] set_rows_spanned error\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rows_spanned_[current_table_column_].num() > 0)
|
||||
{
|
||||
_CP_LOG << L"[warning] current rows spanned > 0\n";
|
||||
}
|
||||
//if (rows_spanned_[current_table_column_].num() > 0)
|
||||
//{
|
||||
// _CP_LOG << L"[warning] current rows spanned > 0\n";
|
||||
//}
|
||||
rows_spanned_[current_table_column_].num(static_cast<unsigned int>(rowsSpanned));
|
||||
rows_spanned_[current_table_column_].column_spanned(static_cast<unsigned int>(columnsSpanned));
|
||||
for (size_t i = 0; i <= columns_spanned_num_; ++i)
|
||||
@ -373,6 +417,21 @@ void xlsx_table_state::serialize_background (std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_table_state::serialize_protection (std::wostream & strm)
|
||||
{
|
||||
if (!bProtected) return;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"sheetProtection")
|
||||
{
|
||||
CP_XML_ATTR(L"sheet", 1);
|
||||
CP_XML_ATTR(L"objects", 1);
|
||||
CP_XML_ATTR(L"scenarios", 1);
|
||||
//convert protection odf->ooxml impossible without password !!!
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_table_state::serialize_table_format (std::wostream & strm)
|
||||
{
|
||||
odf_reader::odf_read_context & odfContext = context_->root()->odf_context();
|
||||
@ -421,6 +480,9 @@ void xlsx_table_state::serialize_table_format (std::wostream & strm)
|
||||
{
|
||||
CP_XML_ATTR(L"workbookViewId", 0);
|
||||
|
||||
if (bRTL)
|
||||
CP_XML_ATTR(L"rightToLeft", 1);
|
||||
|
||||
std::wstring s_col, s_row;
|
||||
for (int i = 0; i < odfContext.Settings().get_table_view_count(0, tableName_); i++)
|
||||
{
|
||||
@ -458,7 +520,6 @@ void xlsx_table_state::serialize_table_format (std::wostream & strm)
|
||||
}
|
||||
}
|
||||
// -showRowColHeaders
|
||||
// -rightToLeft
|
||||
}
|
||||
|
||||
double default_height = (2 * context_->getMaxDigitSize().second * 72. / 96. * 100.) /100.;//in point size.
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include "xlsx_row_spanned.h"
|
||||
#include "xlsx_merge_cells.h"
|
||||
@ -53,27 +54,68 @@ typedef _CP_PTR(xlsx_table_state) xlsx_table_state_ptr;
|
||||
class xlsx_data_range;
|
||||
typedef _CP_PTR(xlsx_data_range) xlsx_data_range_ptr;
|
||||
|
||||
|
||||
class xlsx_data_range
|
||||
{
|
||||
public:
|
||||
xlsx_data_range() : byRow(true), filter(false), withHeader(false), cell_start(0,0), cell_end(0,0) {}
|
||||
xlsx_data_range() : byRow(true), filter(false), bTablePart(true), withHeader(false), cell_start(0,0), cell_end(0,0) {}
|
||||
|
||||
std::wstring table_name;
|
||||
std::wstring name;
|
||||
|
||||
std::wstring ref;
|
||||
|
||||
std::pair<int, int> cell_start;
|
||||
std::pair<int, int> cell_end;
|
||||
|
||||
bool bTablePart;
|
||||
bool byRow;
|
||||
bool filter;
|
||||
bool withHeader;
|
||||
|
||||
std::vector<std::pair<int, bool>> bySort; //field + order
|
||||
std::vector<std::pair<size_t, bool>> bySort; //field + order
|
||||
|
||||
void serialize_sort (std::wostream & _Wostream);
|
||||
void serialize_autofilter (std::wostream & _Wostream);
|
||||
|
||||
std::vector<std::wstring> header_values;
|
||||
|
||||
void set_header(size_t row, size_t col1, size_t col2)
|
||||
{
|
||||
row_header = row;
|
||||
start_column_header = col1;
|
||||
end_column_header = col2;
|
||||
|
||||
for (size_t i = start_column_header; i <= end_column_header; i++)
|
||||
header_values.push_back(L"");
|
||||
}
|
||||
void set_header_value(size_t col, size_t row, const std::wstring& value)
|
||||
{
|
||||
while (col - start_column_header + 1 >= header_values.size())
|
||||
header_values.push_back(L"");
|
||||
|
||||
std::map<std::wstring, int>::iterator pFind = map_unique_header_values.find(value);
|
||||
if (pFind == map_unique_header_values.end())
|
||||
{
|
||||
map_unique_header_values.insert(std::make_pair(value, 1));
|
||||
header_values[col - start_column_header] = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
pFind->second++;
|
||||
header_values[col - start_column_header] = value + std::to_wstring(pFind->second);
|
||||
}
|
||||
}
|
||||
bool in_header(size_t col, size_t row)
|
||||
{
|
||||
return (row_header == row && (col >= start_column_header && col <= end_column_header));
|
||||
}
|
||||
|
||||
private:
|
||||
size_t row_header;
|
||||
size_t start_column_header;
|
||||
size_t end_column_header;
|
||||
|
||||
std::map<std::wstring, int> map_unique_header_values;
|
||||
};
|
||||
|
||||
class xlsx_table_state
|
||||
@ -82,7 +124,10 @@ public:
|
||||
xlsx_table_state(xlsx_conversion_context * Context, std::wstring styleName, std::wstring tableName, int tableId);
|
||||
|
||||
std::wstring current_style() const { return table_style_; }
|
||||
|
||||
|
||||
void set_rtl(bool val);
|
||||
void set_protection(bool val, const std::wstring &key, const std::wstring &algorithm);
|
||||
|
||||
void start_column (unsigned int repeated, const std::wstring & defaultCellStyleName);
|
||||
void start_row (const std::wstring & StyleName, const std::wstring & defaultCellStyleName);
|
||||
|
||||
@ -138,28 +183,36 @@ public:
|
||||
void serialize_ole_objects (std::wostream & _Wostream);
|
||||
void serialize_page_properties (std::wostream & _Wostream);
|
||||
void serialize_background (std::wostream & _Wostream);
|
||||
void serialize_protection (std::wostream & _Wostream);
|
||||
|
||||
void dump_rels_hyperlinks (rels & Rels);
|
||||
void dump_rels_ole_objects (rels & Rels);
|
||||
|
||||
std::wstring get_table_name() const { return tableName_; }
|
||||
int get_table_id() const { return tableId_; }
|
||||
bool get_table_hidden() const { return bHidden; }
|
||||
|
||||
struct _group_row
|
||||
{
|
||||
bool enabled;
|
||||
int count;
|
||||
int level;
|
||||
bool collapsed;
|
||||
bool enabled = false;
|
||||
int count = 0;
|
||||
int level = 0;
|
||||
bool collapsed = false;
|
||||
}group_row_;
|
||||
|
||||
friend class xlsx_conversion_context;
|
||||
friend class xlsx_table_context;
|
||||
|
||||
private:
|
||||
bool bEndTable;
|
||||
xlsx_conversion_context * context_;
|
||||
|
||||
bool bProtected;
|
||||
std::wstring protect_key;
|
||||
std::wstring protect_key_algorithm;
|
||||
bool bRTL;
|
||||
bool bEndTable;
|
||||
bool bHidden;
|
||||
|
||||
std::wstring tableName_;
|
||||
int tableId_;
|
||||
std::wstring tableBackground_;
|
||||
|
||||
@ -60,23 +60,20 @@ xlsx_table_state_ptr xlsx_table_context::state()
|
||||
return xlsx_table_state_ptr();
|
||||
}
|
||||
|
||||
void xlsx_table_context::start_database_range(std::wstring tableName, std::wstring ref)
|
||||
bool xlsx_table_context::start_database_range(const std::wstring & name, const std::wstring & ref)
|
||||
{
|
||||
formulasconvert::odf2oox_converter convert;
|
||||
ref = convert.convert_named_ref(ref);
|
||||
std::wstring oox_ref = convert.convert_named_ref(ref);
|
||||
|
||||
std::wstring ref1, ref2;
|
||||
int pos = ref.find(L":");
|
||||
size_t pos = oox_ref.find(L":");
|
||||
|
||||
std::wstring xlsx_table_name;
|
||||
|
||||
if (pos >= 0)
|
||||
if (pos != std::wstring::npos)
|
||||
{
|
||||
xlsx_data_ranges_.push_back(xlsx_data_range_ptr(new xlsx_data_range()));
|
||||
xlsx_data_ranges_.back()->table_name = tableName;
|
||||
|
||||
ref1 = ref.substr(0, pos );
|
||||
ref2 = ref.substr(pos + 1);
|
||||
ref1 = oox_ref.substr(0, pos );
|
||||
ref2 = oox_ref.substr(pos + 1);
|
||||
|
||||
pos = ref1.find(L"!");
|
||||
if (pos > 0)
|
||||
@ -88,23 +85,33 @@ void xlsx_table_context::start_database_range(std::wstring tableName, std::wstri
|
||||
pos = ref2.find(L"!");
|
||||
if (pos > 0) ref2 = ref2.substr(pos + 1);
|
||||
|
||||
xlsx_data_ranges_.back()->ref = ref1 + L":" + ref2;
|
||||
|
||||
size_t col, row;
|
||||
size_t col1, col2, row1, row2;
|
||||
|
||||
getCellAddressInv(ref1, col, row);
|
||||
xlsx_data_ranges_.back()->cell_start = std::pair<int, int>(col,row);
|
||||
XmlUtils::replace_all( xlsx_table_name, L"'", L"");
|
||||
|
||||
getCellAddressInv(ref2, col, row);
|
||||
xlsx_data_ranges_.back()->cell_end = std::pair<int, int>(col,row);
|
||||
getCellAddressInv(ref1, col1, row1);
|
||||
getCellAddressInv(ref2, col2, row2);
|
||||
|
||||
xlsx_data_ranges_.push_back(xlsx_data_range_ptr(new xlsx_data_range()));
|
||||
|
||||
if (/*name.find(L"__Anonymous_Sheet_DB__") != std::wstring::npos ||*/ col1 == col2)
|
||||
{//check range in pivots
|
||||
xlsx_data_ranges_.back()->bTablePart = false;
|
||||
}
|
||||
xlsx_data_ranges_.back()->name = name;
|
||||
xlsx_data_ranges_.back()->table_name = xlsx_table_name;
|
||||
xlsx_data_ranges_.back()->ref = ref1 + L":" + ref2;
|
||||
xlsx_data_ranges_.back()->cell_start = std::pair<int, int>(col1, row1);
|
||||
xlsx_data_ranges_.back()->cell_end = std::pair<int, int>(col2, row2);
|
||||
|
||||
xlsx_data_ranges_.back()->set_header(row1, col1, col2);
|
||||
}
|
||||
|
||||
if (!xlsx_table_name.empty())
|
||||
{
|
||||
XmlUtils::replace_all( xlsx_table_name, L"'", L"");
|
||||
xlsx_data_ranges_map_.insert(std::pair<std::wstring, int> (xlsx_table_name, xlsx_data_ranges_.size() - 1));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
void xlsx_table_context::set_database_orientation (bool val)
|
||||
{
|
||||
@ -128,6 +135,63 @@ void xlsx_table_context::end_database_range()
|
||||
{
|
||||
}
|
||||
|
||||
void xlsx_table_context::set_database_range_value(int index, const std::wstring& value)
|
||||
{
|
||||
if (index < 0 || index > xlsx_data_ranges_.size()) return;
|
||||
|
||||
size_t col = state()->current_column();
|
||||
size_t row = state()->current_row();
|
||||
|
||||
xlsx_data_ranges_[index]->set_header_value(col, row, value);
|
||||
}
|
||||
void xlsx_table_context::check_database_range_intersection(const std::wstring& table_name, const std::wstring& ref)
|
||||
{
|
||||
std::wstring ref1, ref2;
|
||||
size_t col_1, row_1, col_2, row_2;
|
||||
|
||||
size_t pos = ref.find(L":");
|
||||
if (pos != std::wstring::npos)
|
||||
{
|
||||
ref1 = ref.substr(0, pos );
|
||||
ref2 = ref.substr(pos + 1);
|
||||
}
|
||||
getCellAddressInv(ref1, col_1, row_1);
|
||||
getCellAddressInv(ref2, col_2, row_2);
|
||||
|
||||
for (size_t i = 0; i < xlsx_data_ranges_.size(); i++)
|
||||
{
|
||||
if (xlsx_data_ranges_[i]->table_name != table_name) continue;
|
||||
|
||||
//if ( xlsx_data_ranges_[i]->cell_start.second < row_2 || xlsx_data_ranges_[i]->cell_end.second > row_1
|
||||
// || xlsx_data_ranges_[i]->cell_end.first < col_1 || xlsx_data_ranges_[i]->cell_start.first > col_2 )
|
||||
|
||||
if (((col_1 <= xlsx_data_ranges_[i]->cell_start.first && xlsx_data_ranges_[i]->cell_start.first <= col_2) ||
|
||||
(xlsx_data_ranges_[i]->cell_start.first <= col_1 && col_1 <= xlsx_data_ranges_[i]->cell_end.first))
|
||||
&&
|
||||
(( row_1 <= xlsx_data_ranges_[i]->cell_start.second && xlsx_data_ranges_[i]->cell_start.second <= row_2) ||
|
||||
(xlsx_data_ranges_[i]->cell_start.second <= row_1 && row_1 <= xlsx_data_ranges_[i]->cell_end.second )))
|
||||
{
|
||||
xlsx_data_ranges_[i]->bTablePart = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
int xlsx_table_context::in_database_range()
|
||||
{
|
||||
int col = state()->current_column();
|
||||
int row = state()->current_row();
|
||||
|
||||
for (size_t i = 0; i < xlsx_data_ranges_.size(); i++)
|
||||
{
|
||||
if (xlsx_data_ranges_[i]->table_name != state()->get_table_name()) continue;
|
||||
|
||||
if (/*(xlsx_data_ranges_values_[i]->withHeader || xlsx_data_ranges_values_[i]->filter)&& */
|
||||
xlsx_data_ranges_[i]->in_header(col, row))
|
||||
{
|
||||
return (int)i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
void xlsx_table_context::add_database_sort(int field_number, int order)
|
||||
{
|
||||
xlsx_data_ranges_.back()->bySort.push_back(std::pair<int, bool>(field_number, order == 1 ? false : true ));
|
||||
@ -140,17 +204,19 @@ xlsx_text_context_(textContext)
|
||||
{
|
||||
}
|
||||
|
||||
void xlsx_table_context::start_table(std::wstring tableName, std::wstring tableStyleName, int id)
|
||||
void xlsx_table_context::start_table(const std::wstring & tableName, const std::wstring & tableStyleName, int id)
|
||||
{
|
||||
xlsx_table_state_ptr state = boost::make_shared<xlsx_table_state>(xlsx_conversion_context_, tableStyleName, tableName, id);
|
||||
xlsx_table_states_.push_back( state);
|
||||
}
|
||||
|
||||
void xlsx_table_context::set_protection(bool val, const std::wstring &key, const std::wstring &algorithm)
|
||||
{
|
||||
xlsx_table_states_.back()->set_protection(val, key, algorithm);
|
||||
}
|
||||
void xlsx_table_context::end_table()
|
||||
{
|
||||
//xlsx_table_states_.pop_back();
|
||||
}
|
||||
|
||||
}
|
||||
void xlsx_table_context::start_cell(const std::wstring & formula, size_t columnsSpanned, size_t rowsSpanned)
|
||||
{
|
||||
state()->start_cell(columnsSpanned, rowsSpanned);
|
||||
@ -255,9 +321,90 @@ void xlsx_table_context::serialize_sort(std::wostream & _Wostream)
|
||||
|
||||
for (std::multimap<std::wstring, int>::iterator it = range.first; it != range.second; ++it)
|
||||
{
|
||||
if (xlsx_data_ranges_[it->second]->bTablePart) continue;
|
||||
|
||||
xlsx_data_ranges_[it->second]->serialize_sort(_Wostream);
|
||||
}
|
||||
}
|
||||
void xlsx_table_context::serialize_tableParts(std::wostream & _Wostream, rels & Rels)
|
||||
{
|
||||
if (xlsx_data_ranges_.empty()) return;
|
||||
|
||||
std::pair<std::multimap<std::wstring, int>::iterator, std::multimap<std::wstring, int>::iterator> range;
|
||||
|
||||
range = xlsx_data_ranges_map_.equal_range(state()->get_table_name());
|
||||
|
||||
for (std::multimap<std::wstring, int>::iterator it = range.first; it != range.second; ++it)
|
||||
{
|
||||
if (false == xlsx_data_ranges_[it->second]->bTablePart) continue;
|
||||
|
||||
size_t id = xlsx_conversion_context_->get_table_parts_size() + 1;
|
||||
|
||||
std::wstring rId = L"tprtId" + std::to_wstring(id);
|
||||
std::wstring ref = L"../tables/table" + std::to_wstring(id) + L".xml";
|
||||
|
||||
CP_XML_WRITER(_Wostream)
|
||||
{
|
||||
CP_XML_NODE(L"tablePart")
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", rId);
|
||||
}
|
||||
}
|
||||
Rels.add( relationship(rId, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/table", ref));
|
||||
|
||||
std::wstringstream strm;
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"table")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||
|
||||
CP_XML_ATTR(L"id", id);
|
||||
CP_XML_ATTR(L"name", xlsx_data_ranges_[it->second]->name);
|
||||
CP_XML_ATTR(L"displayName", xlsx_data_ranges_[it->second]->name);
|
||||
CP_XML_ATTR(L"ref", xlsx_data_ranges_[it->second]->ref);
|
||||
|
||||
if (xlsx_data_ranges_[it->second]->withHeader == false &&
|
||||
xlsx_data_ranges_[it->second]->filter == false)
|
||||
CP_XML_ATTR(L"headerRowCount", 0);
|
||||
|
||||
//CP_XML_ATTR(L"totalsRowCount", 0);
|
||||
CP_XML_ATTR(L"totalsRowShown", 0);
|
||||
|
||||
xlsx_data_ranges_[it->second]->serialize_autofilter(CP_XML_STREAM());
|
||||
xlsx_data_ranges_[it->second]->serialize_sort(CP_XML_STREAM());
|
||||
|
||||
CP_XML_NODE(L"tableColumns")
|
||||
{
|
||||
CP_XML_ATTR(L"count", xlsx_data_ranges_[it->second]->cell_end.first -
|
||||
xlsx_data_ranges_[it->second]->cell_start.first + 1);
|
||||
|
||||
for (int id = 0, i = xlsx_data_ranges_[it->second]->cell_start.first; i <= xlsx_data_ranges_[it->second]->cell_end.first; i++, id++)
|
||||
{
|
||||
CP_XML_NODE(L"tableColumn")
|
||||
{
|
||||
std::wstring column_name = xlsx_data_ranges_[it->second]->header_values[id];
|
||||
if (column_name.empty())
|
||||
{
|
||||
column_name = L"Column_" + std::to_wstring(id + 1);
|
||||
}
|
||||
CP_XML_ATTR(L"id", id + 1);
|
||||
CP_XML_ATTR(L"name", column_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"tableStyleInfo")
|
||||
{
|
||||
CP_XML_ATTR(L"showFirstColumn", 0);
|
||||
CP_XML_ATTR(L"showLastColumn", 0);
|
||||
CP_XML_ATTR(L"showRowStripes", 1);
|
||||
CP_XML_ATTR(L"showColumnStripes", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
xlsx_conversion_context_->add_table_part(strm.str());
|
||||
}
|
||||
}
|
||||
void xlsx_table_context::serialize_autofilter(std::wostream & _Wostream)
|
||||
{
|
||||
if (xlsx_data_ranges_.empty()) return;
|
||||
@ -273,6 +420,8 @@ void xlsx_table_context::serialize_autofilter(std::wostream & _Wostream)
|
||||
|
||||
for (std::multimap<std::wstring, int>::iterator it = range.first; it != range.second; ++it)
|
||||
{
|
||||
if (xlsx_data_ranges_[it->second]->bTablePart) continue;
|
||||
|
||||
if (xlsx_data_ranges_[it->second]->filter)
|
||||
{
|
||||
if (cell_start.first < 0 || xlsx_data_ranges_[it->second]->cell_start.first < cell_start.first )
|
||||
@ -298,12 +447,16 @@ void xlsx_table_context::serialize_autofilter(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_NODE(L"autoFilter")
|
||||
{
|
||||
//в автофильтре тока простые диапазоны .. для сложных нужно выделять tablePart - todooo
|
||||
//в автофильтре тока простые диапазоны .. для сложных - tablePart
|
||||
CP_XML_ATTR(L"ref", getCellAddress(cell_start.first, cell_start.second) + L":" + getCellAddress(cell_end.first, cell_end.second));
|
||||
//CP_XML_ATTR(L"ref", ref);
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_table_context::serialize_protection(std::wostream & _Wostream)
|
||||
{
|
||||
return state()->serialize_protection(_Wostream);
|
||||
}
|
||||
void xlsx_table_context::serialize_conditionalFormatting(std::wostream & _Wostream)
|
||||
{
|
||||
return state()->serialize_conditionalFormatting(_Wostream);
|
||||
|
||||
@ -48,7 +48,8 @@ class xlsx_table_context
|
||||
public:
|
||||
xlsx_table_context(xlsx_conversion_context * Context, xlsx_text_context & textCotnext);
|
||||
|
||||
void start_table(std::wstring tableName, std::wstring tableStyleName, int id);
|
||||
void start_table(const std::wstring &tableName, const std::wstring & tableStyleName, int id);
|
||||
void set_protection(bool val, const std::wstring &key, const std::wstring &algorithm);
|
||||
void end_table();
|
||||
|
||||
void start_cell(const std::wstring & formula,
|
||||
@ -82,6 +83,7 @@ public:
|
||||
|
||||
unsigned int columns_count();
|
||||
|
||||
void serialize_tableParts (std::wostream & _Wostream, rels & Rels);
|
||||
void serialize_sort (std::wostream & _Wostream);
|
||||
void serialize_autofilter (std::wostream & _Wostream);
|
||||
void serialize_merge_cells (std::wostream & _Wostream);
|
||||
@ -93,6 +95,7 @@ public:
|
||||
void serialize_page_properties (std::wostream & _Wostream);
|
||||
void serialize_background (std::wostream & _Wostream);
|
||||
void serialize_data_validation (std::wostream & _Wostream);
|
||||
void serialize_protection (std::wostream & _Wostream);
|
||||
|
||||
xlsx_table_metrics & get_table_metrics();
|
||||
|
||||
@ -111,23 +114,25 @@ public:
|
||||
void dump_rels_hyperlinks (rels & Rels);
|
||||
void dump_rels_ole_objects (rels & Rels);
|
||||
|
||||
void start_database_range(std::wstring table_name, std::wstring ref);
|
||||
bool start_database_range(const std::wstring &table_name, const std::wstring &ref);
|
||||
void set_database_orientation (bool val);
|
||||
void set_database_header (bool val);
|
||||
void set_database_filter (bool val);
|
||||
|
||||
void add_database_sort (int field_number, int order);
|
||||
void add_database_sort (int field_number, int order);
|
||||
void end_database_range();
|
||||
|
||||
|
||||
int in_database_range();
|
||||
void set_database_range_value(int index, const std::wstring& value);
|
||||
void check_database_range_intersection(const std::wstring& table_name, const std::wstring& ref);
|
||||
|
||||
private:
|
||||
xlsx_conversion_context *xlsx_conversion_context_;
|
||||
xlsx_text_context &xlsx_text_context_;
|
||||
|
||||
std::vector<xlsx_table_state_ptr> xlsx_table_states_;
|
||||
std::vector<xlsx_data_range_ptr> xlsx_data_ranges_;
|
||||
std::vector<xlsx_table_state_ptr> xlsx_table_states_;
|
||||
std::vector<xlsx_data_range_ptr> xlsx_data_ranges_;
|
||||
|
||||
std::multimap<std::wstring, int> xlsx_data_ranges_map_;
|
||||
std::multimap<std::wstring, int> xlsx_data_ranges_map_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -45,7 +45,6 @@
|
||||
#include "../odf/odfcontext.h"
|
||||
#include "../odf/calcs_styles.h"
|
||||
|
||||
#include "../../DesktopEditor/graphics/pro/Fonts.h"
|
||||
|
||||
|
||||
namespace cpdoccore {
|
||||
@ -71,14 +70,15 @@ xlsx_conversion_context::xlsx_conversion_context(odf_reader::odf_document * odfD
|
||||
math_context_ (odf_document_->odf_context().fontContainer(), true),
|
||||
xlsx_style_ (this),
|
||||
|
||||
maxDigitSize_ (std::pair<float,float>(-1.0, -1.0) ),
|
||||
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_)
|
||||
{
|
||||
applicationFonts_ = NSFonts::NSApplication::Create();
|
||||
}
|
||||
|
||||
std::unordered_map<std::wstring, int> xlsx_conversion_context::mapExternalLink_;
|
||||
|
||||
void xlsx_conversion_context::set_output_document (package::xlsx_document * document)
|
||||
{
|
||||
output_document_ = document;
|
||||
@ -86,15 +86,11 @@ void xlsx_conversion_context::set_output_document (package::xlsx_document * docu
|
||||
|
||||
xlsx_conversion_context::~xlsx_conversion_context()
|
||||
{
|
||||
if (applicationFonts_)
|
||||
delete applicationFonts_;
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::set_font_directory(std::wstring pathFonts)
|
||||
{
|
||||
if (applicationFonts_ == NULL) return;
|
||||
|
||||
applicationFonts_->InitializeFromFolder(pathFonts);
|
||||
mediaitems_.set_font_directory(pathFonts);
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::start_chart(std::wstring name)
|
||||
@ -182,7 +178,7 @@ void xlsx_conversion_context::end_document()
|
||||
{
|
||||
CP_XML_ATTR(L"name", sheet->name()); // office 2010 ! ограничение на длину имени !!!
|
||||
CP_XML_ATTR(L"sheetId", i + 1);
|
||||
CP_XML_ATTR(L"state", L"visible");
|
||||
CP_XML_ATTR(L"state", sheet->hidden() ? L"hidden" : L"visible");
|
||||
CP_XML_ATTR(L"r:id", id);
|
||||
}
|
||||
}
|
||||
@ -201,6 +197,10 @@ void xlsx_conversion_context::end_document()
|
||||
|
||||
output_document_->get_xl_files().add_charts(content);
|
||||
}
|
||||
for (size_t i = 0; i < table_parts_.size(); i++)
|
||||
{
|
||||
output_document_->get_xl_files().add_table_part(table_parts_[i]);
|
||||
}
|
||||
//workbook_content << L"<calcPr iterateCount=\"100\" refMode=\"A1\" iterate=\"false\" iterateDelta=\"0.0001\" />";
|
||||
|
||||
{
|
||||
@ -231,7 +231,41 @@ void xlsx_conversion_context::end_document()
|
||||
{
|
||||
CP_XML_STREAM() << workbook_content.str();
|
||||
}
|
||||
if (false == mapExternalLink_.empty())
|
||||
{
|
||||
CP_XML_NODE(L"externalReferences")
|
||||
{
|
||||
for (std::unordered_map<std::wstring, int>::iterator it = mapExternalLink_.begin();
|
||||
it != mapExternalLink_.end(); ++it)
|
||||
{
|
||||
package::external_links_content_ptr content = package::external_links_content::create();
|
||||
content->rId() = L"extRef" + std::to_wstring(it->second);
|
||||
{
|
||||
CP_XML_WRITER(content->content())
|
||||
{
|
||||
CP_XML_NODE(L"externalLink")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||
CP_XML_NODE(L"externalBook")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
CP_XML_ATTR(L"r:id", L"rId1");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
content->get_rels().add(relationship(L"rId1", mediaitems::get_rel_type(typeExternalLink), it->first, L"External"));
|
||||
|
||||
output_document_->get_xl_files().add_external_links(content);
|
||||
|
||||
CP_XML_NODE(L"externalReference")
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", content->rId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
get_xlsx_defined_names().xlsx_serialize(CP_XML_STREAM());
|
||||
|
||||
int pivot_cache_count = xlsx_pivots_context_.get_count();
|
||||
@ -287,7 +321,7 @@ void xlsx_conversion_context::end_document()
|
||||
output_document_->get_xl_files().set_workbook( package::simple_element::create(L"workbook.xml", strm_workbook.str()) );
|
||||
|
||||
output_document_->get_content_types_file().set_media(get_mediaitems());
|
||||
output_document_->get_xl_files().set_media(get_mediaitems(), applicationFonts_);
|
||||
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);
|
||||
@ -392,15 +426,12 @@ int xlsx_conversion_context::find_sheet_by_name(std::wstring tableName)
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
void xlsx_conversion_context::create_new_sheet(std::wstring const & name)
|
||||
{
|
||||
sheets_.push_back(xlsx_xml_worksheet::create(name));
|
||||
}
|
||||
|
||||
bool xlsx_conversion_context::start_table(std::wstring tableName, std::wstring tableStyleName)
|
||||
{
|
||||
create_new_sheet(tableName);
|
||||
get_table_context().start_table(tableName, tableStyleName, sheets_.size() - 1);
|
||||
|
||||
sheets_.push_back(xlsx_xml_worksheet::create(tableName, get_table_context().state()->get_table_hidden()));
|
||||
current_sheet().cols() << L"<cols>";
|
||||
return true;
|
||||
}
|
||||
@ -436,11 +467,13 @@ void xlsx_conversion_context::end_table()
|
||||
get_table_context().serialize_table_format (current_sheet().sheetFormat());
|
||||
get_table_context().serialize_page_properties (current_sheet().page_properties());
|
||||
get_table_context().serialize_conditionalFormatting (current_sheet().conditionalFormatting());
|
||||
get_table_context().serialize_tableParts (current_sheet().tableParts(), current_sheet().sheet_rels());
|
||||
get_table_context().serialize_autofilter (current_sheet().autofilter());
|
||||
get_table_context().serialize_sort (current_sheet().sort());
|
||||
get_table_context().serialize_merge_cells (current_sheet().mergeCells());
|
||||
get_table_context().serialize_data_validation (current_sheet().dataValidations());
|
||||
|
||||
get_table_context().serialize_protection (current_sheet().protection());
|
||||
|
||||
get_drawing_context().set_odf_packet_path (root()->get_folder());
|
||||
get_drawing_context().process_objects (get_table_metrics());
|
||||
|
||||
@ -502,6 +535,20 @@ void xlsx_conversion_context::end_table()
|
||||
}
|
||||
get_table_context().end_table();
|
||||
}
|
||||
//int xlsx_conversion_context::add_external_link(const std::wstring & external)
|
||||
//{
|
||||
// std::unordered_map<std::wstring, int>::iterator pFind = mapExternalLink_.find(external);
|
||||
// if ( pFind == mapExternalLink_.end())
|
||||
// {
|
||||
// int id = (int)mapExternalLink_.size() + 1;
|
||||
// mapExternalLink_.insert(std::make_pair(external, id));
|
||||
// return id;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return pFind->second;
|
||||
// }
|
||||
//}
|
||||
void xlsx_conversion_context::add_control_props(const std::wstring & rid, const std::wstring & target, const std::wstring & props)
|
||||
{
|
||||
if (rid.empty()) return;
|
||||
@ -647,26 +694,43 @@ std::pair<float,float> xlsx_conversion_context::getMaxDigitSize()
|
||||
|
||||
odf_reader::odf_read_context & odfContext = root()->odf_context();
|
||||
|
||||
instances.push_back(odfContext.styleContainer().style_default_by_type(odf_types::style_family::TableCell));
|
||||
instances.push_back(odfContext.styleContainer().style_by_name(L"Default",odf_types::style_family::TableCell,false));
|
||||
|
||||
odf_reader::text_format_properties_content textFormatProperties = calc_text_properties_content(instances);
|
||||
|
||||
if (textFormatProperties.style_font_name_)
|
||||
font_name = textFormatProperties.style_font_name_.get();
|
||||
else if (textFormatProperties.style_font_name_complex_)
|
||||
font_name = textFormatProperties.style_font_name_complex_.get();
|
||||
else if (textFormatProperties.style_font_name_asian_)
|
||||
font_name = textFormatProperties.style_font_name_asian_.get();
|
||||
odf_reader::style_instance *inst = odfContext.styleContainer().style_default_by_type(odf_types::style_family::TableCell);
|
||||
if (inst) instances.push_back(inst);
|
||||
|
||||
inst = odfContext.styleContainer().style_by_name(L"Default", odf_types::style_family::TableCell, false);
|
||||
if (inst) instances.push_back(inst);
|
||||
else
|
||||
font_name = L"Arial";
|
||||
{
|
||||
inst = odfContext.styleContainer().style_by_name(L"Normal", odf_types::style_family::TableCell, false);
|
||||
if (inst) instances.push_back(inst);
|
||||
}
|
||||
|
||||
odf_reader::text_format_properties_content textFormatProperties = calc_text_properties_content(instances);
|
||||
|
||||
if (textFormatProperties.fo_font_family_)
|
||||
font_name = textFormatProperties.fo_font_family_.get();
|
||||
else
|
||||
{
|
||||
std::wstring style_font_name;
|
||||
if (textFormatProperties.style_font_name_) style_font_name = textFormatProperties.style_font_name_.get();
|
||||
else if (textFormatProperties.style_font_name_complex_) style_font_name = textFormatProperties.style_font_name_complex_.get();
|
||||
else if (textFormatProperties.style_font_name_asian_) style_font_name = textFormatProperties.style_font_name_asian_.get();
|
||||
|
||||
odf_reader::fonts_container & fonts = odf_document_->odf_context().fontContainer();
|
||||
odf_reader::font_instance * font = fonts.font_by_style_name(style_font_name);
|
||||
if (font)
|
||||
{
|
||||
font_name = font->name();
|
||||
}
|
||||
}
|
||||
if (font_name.empty()) font_name = L"Arial";
|
||||
|
||||
if ((textFormatProperties.fo_font_size_) && (textFormatProperties.fo_font_size_->get_type() == odf_types::font_size::Length))
|
||||
font_size = (int)(0.5 + textFormatProperties.fo_font_size_->get_length().get_value_unit(odf_types::length::pt));
|
||||
else
|
||||
font_size =10;
|
||||
|
||||
maxDigitSize_ = utils::GetMaxDigitSizePixels(font_name.c_str(), font_size, 96., 0, applicationFonts_);
|
||||
maxDigitSize_ = utils::GetMaxDigitSizePixels(font_name.c_str(), font_size, 96., 0, mediaitems_.applicationFonts());
|
||||
}
|
||||
return maxDigitSize_;
|
||||
}
|
||||
|
||||
@ -34,6 +34,8 @@
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "oox_conversion_context.h"
|
||||
|
||||
@ -54,11 +56,6 @@
|
||||
|
||||
#include "mediaitems.h"
|
||||
|
||||
namespace NSFonts
|
||||
{
|
||||
class IApplicationFonts;
|
||||
}
|
||||
|
||||
namespace cpdoccore {
|
||||
|
||||
namespace odf_reader
|
||||
@ -160,6 +157,12 @@ public:
|
||||
void add_jsaProject (const std::string &content);
|
||||
|
||||
void add_control_props(const std::wstring & rid, const std::wstring & target, const std::wstring & props);
|
||||
|
||||
//int add_external_link(const std::wstring & external);
|
||||
|
||||
void add_table_part(const std::wstring & table) {table_parts_.push_back(table);}
|
||||
size_t get_table_parts_size() {return table_parts_.size();}
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
|
||||
odf_reader::odf_document * root()
|
||||
@ -192,9 +195,9 @@ public:
|
||||
|
||||
mediaitems & get_mediaitems() { return mediaitems_; }
|
||||
|
||||
static std::unordered_map<std::wstring, int> mapExternalLink_;
|
||||
std::map<std::wstring, int> mapUsedNames_;
|
||||
private:
|
||||
void create_new_sheet (std::wstring const & name);
|
||||
|
||||
void serialize_bookViews(std::wostream & strm);
|
||||
void serialize_calcPr (std::wostream & strm);
|
||||
|
||||
@ -202,19 +205,18 @@ private:
|
||||
const odf_reader::office_element *spreadsheet_;
|
||||
odf_reader::odf_document *odf_document_;
|
||||
|
||||
NSFonts::IApplicationFonts *applicationFonts_;
|
||||
|
||||
std::vector<xlsx_xml_worksheet_ptr> sheets_;
|
||||
std::vector<oox_chart_context_ptr> charts_;
|
||||
|
||||
std::vector<std::wstring> table_parts_;
|
||||
|
||||
std::wstringstream defaultOutput_;
|
||||
std::pair<float,float> maxDigitSize_;
|
||||
num_format_context num_format_context_;
|
||||
size_t default_style_;
|
||||
mediaitems mediaitems_;
|
||||
std::multimap<std::wstring, int> mapPivotsTableView_;
|
||||
|
||||
std::map<std::wstring, std::wstring>control_props_;
|
||||
|
||||
std::map<std::wstring, std::wstring> control_props_;
|
||||
|
||||
xlsx_style_manager xlsx_style_;
|
||||
xlsx_defined_names xlsx_defined_names_;
|
||||
@ -227,6 +229,8 @@ private:
|
||||
|
||||
math_context math_context_;
|
||||
forms_context forms_context_;
|
||||
|
||||
static std::wstring change_external(boost::wsmatch const & what);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -744,6 +744,9 @@ void process_build_object::visit(chart_title& val)
|
||||
if (val.attlist_.common_draw_position_attlist_.svg_x_)
|
||||
{
|
||||
t.pos_x = val.attlist_.common_draw_position_attlist_.svg_x_->get_value_unit(length::pt);
|
||||
}
|
||||
if (val.attlist_.common_draw_position_attlist_.svg_y_)
|
||||
{
|
||||
t.pos_y = val.attlist_.common_draw_position_attlist_.svg_y_->get_value_unit(length::pt);
|
||||
}
|
||||
t.bEnabled = true;
|
||||
@ -1054,7 +1057,7 @@ void process_build_object::visit(table_table_cell& val)
|
||||
if (cell_cash.empty())
|
||||
cell_cash = cell_val;
|
||||
|
||||
object_odf_context::_cell cell_= {object_odf_context_.current_table_column_, object_odf_context_.current_table_row_, cell_cash};
|
||||
object_odf_context::_cell cell_= {(size_t)object_odf_context_.current_table_column_, (size_t)object_odf_context_.current_table_row_, cell_cash};
|
||||
|
||||
object_odf_context_.cash_values.push_back(cell_);
|
||||
|
||||
|
||||
@ -101,8 +101,8 @@ class object_odf_context
|
||||
public:
|
||||
struct _cell
|
||||
{
|
||||
int col;
|
||||
int row;
|
||||
size_t col;
|
||||
size_t row;
|
||||
std::wstring val;
|
||||
};
|
||||
|
||||
|
||||
@ -106,6 +106,13 @@ void common_draw_fill_attlist::add_attributes( const xml::attributes_wc_ptr & At
|
||||
CP_APPLY_ATTR(L"draw:fill-image-width", draw_fill_image_width_);
|
||||
CP_APPLY_ATTR(L"draw:fill-image-height", draw_fill_image_height_);
|
||||
|
||||
CP_APPLY_ATTR(L"draw:color-mode", draw_color_mode_);
|
||||
CP_APPLY_ATTR(L"draw:contrast", draw_contrast_);
|
||||
CP_APPLY_ATTR(L"draw:luminance", draw_luminance_);
|
||||
CP_APPLY_ATTR(L"draw:gamma", draw_gamma_);
|
||||
CP_APPLY_ATTR(L"draw:red", draw_red_);
|
||||
CP_APPLY_ATTR(L"draw:green", draw_green_);
|
||||
CP_APPLY_ATTR(L"draw:blue", draw_blue_);
|
||||
}
|
||||
void common_draw_fill_attlist::serialize(CP_ATTR_NODE)
|
||||
{
|
||||
@ -130,6 +137,13 @@ void common_draw_fill_attlist::serialize(CP_ATTR_NODE)
|
||||
CP_XML_ATTR_OPT(L"draw:fill-image-width", draw_fill_image_width_);
|
||||
CP_XML_ATTR_OPT(L"draw:fill-image-height", draw_fill_image_height_);
|
||||
|
||||
CP_XML_ATTR_OPT(L"draw:color-mode", draw_color_mode_);
|
||||
CP_XML_ATTR_OPT(L"draw:contrast", draw_contrast_);
|
||||
CP_XML_ATTR_OPT(L"draw:luminance", draw_luminance_);
|
||||
CP_XML_ATTR_OPT(L"draw:gamma", draw_gamma_);
|
||||
CP_XML_ATTR_OPT(L"draw:red", draw_red_);
|
||||
CP_XML_ATTR_OPT(L"draw:green", draw_green_);
|
||||
CP_XML_ATTR_OPT(L"draw:blue", draw_blue_);
|
||||
}
|
||||
|
||||
void common_draw_fill_attlist::apply_from(const common_draw_fill_attlist & Other)
|
||||
@ -150,6 +164,14 @@ void common_draw_fill_attlist::apply_from(const common_draw_fill_attlist & Other
|
||||
|
||||
_CP_APPLY_PROP2(draw_fill_image_width_);
|
||||
_CP_APPLY_PROP2(draw_fill_image_height_);
|
||||
|
||||
_CP_APPLY_PROP2(draw_color_mode_);
|
||||
_CP_APPLY_PROP2(draw_contrast_);
|
||||
_CP_APPLY_PROP2(draw_luminance_);
|
||||
_CP_APPLY_PROP2(draw_gamma_);
|
||||
_CP_APPLY_PROP2(draw_red_);
|
||||
_CP_APPLY_PROP2(draw_green_);
|
||||
_CP_APPLY_PROP2(draw_blue_);
|
||||
}
|
||||
|
||||
void common_horizontal_margin_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
|
||||
@ -111,6 +111,14 @@ public:
|
||||
|
||||
_CP_OPT(length_or_percent) draw_fill_image_width_;
|
||||
_CP_OPT(length_or_percent) draw_fill_image_height_;
|
||||
|
||||
_CP_OPT(std::wstring) draw_color_mode_;
|
||||
_CP_OPT(odf_types::percent) draw_contrast_;
|
||||
_CP_OPT(odf_types::percent) draw_luminance_;
|
||||
_CP_OPT(odf_types::percent) draw_gamma_;
|
||||
_CP_OPT(odf_types::percent) draw_red_;
|
||||
_CP_OPT(odf_types::percent) draw_green_;
|
||||
_CP_OPT(odf_types::percent) draw_blue_;
|
||||
};
|
||||
|
||||
// common-horizontal-margin-attlist
|
||||
|
||||
@ -79,8 +79,8 @@ static const _shape_converter _OO_OOX_custom_shapes[]=
|
||||
{L"up-down-arrow-callout" ,L"upDownArrowCallout" ,0 ,0 ,0 },
|
||||
{L"quad-arrow-callout" ,L"quadArrowCallout" ,0 ,0 ,0 },
|
||||
{L"circular-arrow" ,L"circularArrow" ,0 ,0 ,0 },
|
||||
{L"can" ,L"lightningBolt" ,0 ,0 ,0 },
|
||||
{L"lightning" ,L"can" ,0 ,0 ,0 },
|
||||
{L"can" ,L"can" ,0 ,0 ,0 },
|
||||
{L"lightning" ,L"lightningBolt" ,0 ,0 ,0 },
|
||||
{L"heart" ,L"heart" ,0 ,0 ,0 },
|
||||
{L"sun" ,L"sun" ,1 ,46875 ,12500 },
|
||||
{L"moon" ,L"moon" ,0 ,0 ,0 },
|
||||
@ -139,13 +139,6 @@ static const _shape_converter _OO_OOX_custom_shapes[]=
|
||||
{L"mso-spt18" ,L"irregularSeal1" ,0 ,0 ,0 },
|
||||
{L"mso-spt19" ,L"rect" ,0 ,0 ,0 },
|
||||
{L"mso-spt24" ,L"textBox" ,0 ,0 ,0 },
|
||||
{L"mso-spt25" ,L"" ,0 ,0 ,0 },
|
||||
{L"mso-spt26" ,L"" ,0 ,0 ,0 },
|
||||
{L"mso-spt27" ,L"" ,0 ,0 ,0 },
|
||||
{L"mso-spt28" ,L"" ,0 ,0 ,0 },
|
||||
{L"mso-spt29" ,L"" ,0 ,0 ,0 },
|
||||
{L"mso-spt30" ,L"" ,0 ,0 ,0 },
|
||||
{L"mso-spt31" ,L"" ,0 ,0 ,0 },
|
||||
{L"mso-spt32" ,L"straightConnector1" ,0 ,0 ,0 },
|
||||
{L"mso-spt33" ,L"bentConnector2" ,0 ,0 ,0 },
|
||||
{L"mso-spt34" ,L"bentConnector3" ,0 ,0 ,0 },
|
||||
@ -181,10 +174,10 @@ static const _shape_converter _OO_OOX_custom_shapes[]=
|
||||
{L"mso-spt107" ,L"ellipseRibbon" ,0 ,0 ,0 },
|
||||
{L"mso-spt108" ,L"ellipseRibbon2" ,0 ,0 ,0 },
|
||||
{L"mso-spt129" ,L"flowChartMagneticDrum" ,0 ,0 ,0 },
|
||||
{L"mso-spt167" ,L"rect" ,0 ,0 ,0 },
|
||||
{L"mso-spt178" ,L"" ,0 ,0 ,0 },
|
||||
{L"mso-spt179" ,L"" ,0 ,0 ,0 },
|
||||
{L"mso-spt180" ,L"" ,0 ,0 ,0 },
|
||||
|
||||
{L"mso-spt178" ,L"callout1" ,0 ,0 ,0 },
|
||||
{L"mso-spt179" ,L"callout2" ,0 ,0 ,0 },
|
||||
{L"mso-spt180" ,L"callout3" ,0 ,0 ,0 },
|
||||
{L"mso-spt182" ,L"leftRightUpArrow" ,0 ,0 ,0 },
|
||||
{L"mso-spt188" ,L"flowChartPunchedTape",0 ,0 ,0 },
|
||||
{L"mso-spt189" ,L"actionButtonBlank" ,0 ,0 ,0 },
|
||||
@ -222,7 +215,6 @@ static const _shape_converter _OO_OOX_custom_shapes[]=
|
||||
{L"concave-star6" ,L"" ,0 ,0 ,0 },
|
||||
{L"signet" ,L"" ,0 ,0 ,0 },
|
||||
{L"doorplate" ,L"" ,0 ,0 ,0 },
|
||||
|
||||
{L"" ,L"round1Rect" ,0 ,0 ,0 },
|
||||
{L"" ,L"round2DiagRect" ,0 ,0 ,0 },
|
||||
{L"" ,L"snip2DiagRect" ,0 ,0 ,0 },
|
||||
@ -300,6 +292,13 @@ static const _shape_converter _OO_OOX_wordart[]=
|
||||
{L"fontwork-slant-up" ,L"textSlantUp" ,0 ,0 ,0 },
|
||||
{L"fontwork-slant-down" ,L"textSlantDown" ,0 ,0 ,0 },
|
||||
|
||||
{L"mso-spt25" ,L"textPlain" ,0 ,0 ,0 },//
|
||||
{L"mso-spt26" ,L"textPlain" ,0 ,0 ,0 },
|
||||
{L"mso-spt27" ,L"textCurveDown" ,0 ,0 ,0 },
|
||||
{L"mso-spt28" ,L"textWave1" ,0 ,0 ,0 },
|
||||
{L"mso-spt29" ,L"textRingInside" ,0 ,0 ,0 },
|
||||
{L"mso-spt30" ,L"textPlain" ,0 ,0 ,0 },
|
||||
{L"mso-spt31" ,L"textRingOutside" ,0 ,0 ,0 },
|
||||
{L"mso-spt142" ,L"textRingInside" ,0 ,0 ,0 },
|
||||
{L"mso-spt143" ,L"textRingOutside" ,0 ,0 ,0 },
|
||||
{L"mso-spt157" ,L"textWave2" ,0 ,0 ,0 },
|
||||
@ -311,7 +310,8 @@ static const _shape_converter _OO_OOX_wordart[]=
|
||||
{L"mso-spt163" ,L"textDeflateBottom" ,0 ,0 ,0 },
|
||||
{L"mso-spt164" ,L"textInflateTop" ,0 ,0 ,0 },
|
||||
{L"mso-spt165" ,L"textDeflateTop" ,0 ,0 ,0 },
|
||||
{L"mso-spt166" ,L"textDeflateInflateDeflate" ,0 ,0 ,0 },
|
||||
{L"mso-spt166" ,L"textDeflateInflate" ,0 ,0 ,0 },
|
||||
{L"mso-spt167" ,L"textDeflateInflateDeflate" ,0 ,0 ,0 },
|
||||
{L"mso-spt174" ,L"textCanUp" ,0 ,0 ,0 },
|
||||
{L"mso-spt175" ,L"textCanDown" ,0 ,0 ,0 },
|
||||
{L"mso-spt188" ,L"textDoubleWave1" ,0 ,0 ,0 },
|
||||
|
||||
@ -60,6 +60,10 @@ std::wostream & operator << (std::wostream & _Wostream, const marker_style & _Va
|
||||
|
||||
std::wstring marker_style::parse(const std::wstring & Str)
|
||||
{
|
||||
if (Str.empty())
|
||||
{
|
||||
return L"none";
|
||||
}
|
||||
std::wstring tmp = Str;
|
||||
boost::algorithm::to_lower(tmp);
|
||||
|
||||
|
||||
@ -86,7 +86,7 @@ math_variant::math_variant(const std::wstring & Value) : none_(true)
|
||||
std::vector< std::wstring > splitted;
|
||||
boost::algorithm::split(splitted, Value, boost::algorithm::is_any_of(L" \t"), boost::algorithm::token_compress_on);
|
||||
|
||||
for (int i = 0 ; i < splitted.size(); i++)
|
||||
for (size_t i = 0 ; i < splitted.size(); i++)
|
||||
{
|
||||
if (splitted[i] == L"bold")
|
||||
{
|
||||
|
||||
@ -58,13 +58,11 @@ namespace _image_file_
|
||||
{
|
||||
bool GetResolution(const wchar_t* fileName, int & Width, int &Height, NSFonts::IApplicationFonts* appFonts)
|
||||
{
|
||||
if (!appFonts) return false;
|
||||
|
||||
CBgraFrame image;
|
||||
MetaFile::IMetaFile* meta_file = MetaFile::Create(appFonts);
|
||||
|
||||
bool bRet = false;
|
||||
if ( meta_file->LoadFromFile(fileName))
|
||||
if ( appFonts && meta_file->LoadFromFile(fileName))
|
||||
{
|
||||
double dX = 0, dY = 0, dW = 0, dH = 0;
|
||||
meta_file->GetBounds(&dX, &dY, &dW, &dH);
|
||||
@ -83,6 +81,18 @@ namespace _image_file_
|
||||
RELEASEOBJECT(meta_file);
|
||||
return bRet;
|
||||
}
|
||||
|
||||
void GenerateZeroImage(const std::wstring & fileName)
|
||||
{
|
||||
NSFile::CFileBinary file;
|
||||
if (file.CreateFileW(fileName))
|
||||
{
|
||||
BYTE pData[149] = {0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x08, 0x03, 0x00, 0x00, 0x01, 0x5f, 0xcc, 0x04, 0x2d, 0x00, 0x00, 0x00, 0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xae, 0xce, 0x1c, 0xe9, 0x00, 0x00, 0x00, 0x04, 0x67, 0x41, 0x4d, 0x41, 0x00, 0x00, 0xb1, 0x8f, 0x0b, 0xfc, 0x61, 0x05, 0x00, 0x00, 0x00, 0x06, 0x50, 0x4c, 0x54, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa5, 0x67, 0xb9, 0xcf, 0x00, 0x00, 0x00, 0x02, 0x74, 0x52, 0x4e, 0x53, 0xff, 0x00, 0xe5, 0xb7, 0x30, 0x4a, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x12, 0x74, 0x00, 0x00, 0x12, 0x74, 0x01, 0xde, 0x66, 0x1f, 0x78, 0x00, 0x00, 0x00, 0x0a, 0x49, 0x44, 0x41, 0x54, 0x18, 0x57, 0x63, 0x60, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0xa3, 0xda, 0x3d, 0x94, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82};
|
||||
|
||||
file.WriteFile(pData, 149);
|
||||
file.CloseFile();
|
||||
}
|
||||
}
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
namespace cpdoccore {
|
||||
@ -101,11 +111,11 @@ int get_value_emu(double pt)
|
||||
{
|
||||
return static_cast<int>((pt* 360000 * 2.54) / 72);
|
||||
}
|
||||
bool parse_clipping(std::wstring strClipping,std::wstring fileName, double_4 & clip_rect, NSFonts::IApplicationFonts * appFonts)
|
||||
bool parse_clipping(std::wstring strClipping,std::wstring fileName, double_4 & clip_rect, NSFonts::IApplicationFonts *appFonts)
|
||||
{
|
||||
memset(clip_rect, 0, 4*sizeof(double));
|
||||
|
||||
if (strClipping.length() <1 || fileName.length()<1)return false;
|
||||
if (strClipping.empty() || fileName.empty()) return false;
|
||||
|
||||
//<top>, <right>, <bottom>, <left> - http://www.w3.org/TR/2001/REC-xsl-20011015/xslspec.html#clip
|
||||
|
||||
@ -114,7 +124,7 @@ bool parse_clipping(std::wstring strClipping,std::wstring fileName, double_4 & c
|
||||
std::vector<std::wstring> Points;
|
||||
std::vector<length> Points_pt;
|
||||
|
||||
boost::algorithm::split(Points,strClipping, boost::algorithm::is_any_of(L" ,"), boost::algorithm::token_compress_on);
|
||||
boost::algorithm::split(Points, strClipping, boost::algorithm::is_any_of(L" ,"), boost::algorithm::token_compress_on);
|
||||
|
||||
for (size_t i = 0; i < Points.size(); i++)
|
||||
{
|
||||
@ -125,9 +135,9 @@ bool parse_clipping(std::wstring strClipping,std::wstring fileName, double_4 & c
|
||||
|
||||
if (!bEnableCrop) return false;
|
||||
|
||||
int fileWidth=0,fileHeight=0;
|
||||
int fileWidth = 0,fileHeight = 0;
|
||||
|
||||
if (!_image_file_::GetResolution(fileName.data(), fileWidth, fileHeight, appFonts) || fileWidth<1 || fileHeight<1) return false;
|
||||
if (!_image_file_::GetResolution(fileName.data(), fileWidth, fileHeight, appFonts) || fileWidth < 1 || fileHeight < 1) return false;
|
||||
|
||||
if (Points_pt.size() > 3)//если другое количество точек .. попозже
|
||||
{
|
||||
@ -143,7 +153,7 @@ bool parse_clipping(std::wstring strClipping,std::wstring fileName, double_4 & c
|
||||
clip_rect[1] = clip_rect[1]*100/fileHeight;
|
||||
clip_rect[3] = clip_rect[3]*100/fileHeight;
|
||||
|
||||
if (clip_rect[0]<0.01 && clip_rect[1]<0.01 && clip_rect[2]<0.01 && clip_rect[3]<0.01)
|
||||
if (clip_rect[0] < 0.01 && clip_rect[1] < 0.01 && clip_rect[2] < 0.01 && clip_rect[3] < 0.01)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@ -475,6 +485,8 @@ void Compute_GraphicFill(const common_draw_fill_attlist & props, const office_el
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((props.draw_color_mode_) && (*props.draw_color_mode_ == L"greyscale"))
|
||||
fill.bitmap->bGrayscale = true;
|
||||
}
|
||||
if (props.draw_fill_gradient_name_)
|
||||
{
|
||||
@ -738,47 +750,49 @@ void pptx_convert_transforms(std::wstring transformStr, oox::pptx_conversion_con
|
||||
|
||||
if (transform.size()>1)//тока с аргументами
|
||||
{
|
||||
int res=0;
|
||||
if ((res = transform[0].find(L"translate"))>=0)//перемещение
|
||||
size_t res = 0;
|
||||
if ((res = transform[0].find(L"translate")) != std::wstring::npos)//перемещение
|
||||
{
|
||||
std::vector<length> Points ;
|
||||
parse_string_to_points(transform[1], Points);
|
||||
|
||||
if (Points.size()>0)
|
||||
if (false == Points.empty())
|
||||
{
|
||||
double x_pt = Points[0].get_value_unit(length::pt);
|
||||
double y_pt = 0;
|
||||
if (Points.size()>1)y_pt = Points[1].get_value_unit(length::pt);//ее может не быть
|
||||
|
||||
Context.get_slide_context().set_translate(x_pt,y_pt);
|
||||
Context.get_slide_context().set_translate(x_pt, y_pt);
|
||||
}
|
||||
}
|
||||
else if ((res = transform[0].find(L"scale"))>=0)//масштабирование
|
||||
else if ((res = transform[0].find(L"scale")) != std::wstring::npos)//масштабирование
|
||||
{
|
||||
std::vector<length> Points ;
|
||||
parse_string_to_points(transform[1], Points);
|
||||
if (Points.size()>0)
|
||||
|
||||
if (false == Points.empty())
|
||||
{
|
||||
double x_pt = Points[0].get_value_unit(length::pt);
|
||||
double y_pt = x_pt;
|
||||
if (Points.size()>1)y_pt = Points[1].get_value_unit(length::pt);//ее может не быть
|
||||
|
||||
Context.get_slide_context().set_scale(x_pt,y_pt);
|
||||
Context.get_slide_context().set_scale(x_pt, y_pt);
|
||||
}
|
||||
}
|
||||
else if ((res = transform[0].find(L"rotate"))>=0)//вращение
|
||||
else if ((res = transform[0].find(L"rotate")) != std::wstring::npos)//вращение
|
||||
{
|
||||
Context.get_slide_context().set_rotate( boost::lexical_cast<double>(transform[1]));
|
||||
Context.get_slide_context().set_translate_rotate();
|
||||
}
|
||||
else if ((res = transform[0].find(L"skewX"))>=0)//вращение
|
||||
else if ((res = transform[0].find(L"skewX")) != std::wstring::npos)//вращение
|
||||
{
|
||||
double angle = boost::lexical_cast<double>(transform[1]);
|
||||
Context.get_slide_context().set_property(_property(L"svg:skewX",angle));
|
||||
Context.get_slide_context().set_property(_property(L"svg:skewX", angle));
|
||||
}
|
||||
else if ((res = transform[0].find(L"skewY"))>=0)//вращение
|
||||
else if ((res = transform[0].find(L"skewY")) != std::wstring::npos)//вращение
|
||||
{
|
||||
double angle = boost::lexical_cast<double>(transform[1]);
|
||||
Context.get_slide_context().set_property(_property(L"svg:skewY",angle));
|
||||
Context.get_slide_context().set_property(_property(L"svg:skewY", angle));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,7 +52,8 @@
|
||||
|
||||
namespace _image_file_
|
||||
{
|
||||
bool GetResolution(const wchar_t* fileName, int & Width, int &Height, NSFonts::IApplicationFonts * appFonts);
|
||||
bool GetResolution(const wchar_t* fileName, int & Width, int &Height, NSFonts::IApplicationFonts *appFonts);
|
||||
void GenerateZeroImage(const std::wstring & fileName);
|
||||
}
|
||||
|
||||
namespace cpdoccore {
|
||||
@ -74,7 +75,7 @@ void Compute_GraphicFill(const odf_types::common_draw_fill_attlist & props,
|
||||
const office_element_ptr & style_image, styles_lite_container &styles, oox::_oox_fill & fill, bool txbx = false);
|
||||
|
||||
typedef double double_4[4];
|
||||
bool parse_clipping(std::wstring strClipping,std::wstring fileName,double_4 & clip_rect, NSFonts::IApplicationFonts * appFonts);
|
||||
bool parse_clipping(std::wstring strClipping, std::wstring fileName, double_4 & clip_rect, NSFonts::IApplicationFonts *appFonts);
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class draw_a : public office_element_impl<draw_a>
|
||||
{
|
||||
|
||||
@ -30,8 +30,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "draw_frame.h"
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
@ -42,6 +40,8 @@
|
||||
#include <xml/attributes.h>
|
||||
#include <odf/odf_document.h>
|
||||
|
||||
#include "draw_common.h"
|
||||
|
||||
#include "serialize_elements.h"
|
||||
#include "style_graphic_properties.h"
|
||||
#include "odfcontext.h"
|
||||
@ -54,6 +54,7 @@
|
||||
#include "datatypes/borderstyle.h"
|
||||
|
||||
#include "../../../OfficeUtils/src/OfficeUtils.h"
|
||||
#include "../../../Common/OfficeFileFormatChecker.h"
|
||||
#include "../../../Common/3dParty/pole/pole.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
@ -153,6 +154,58 @@ void draw_g::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
void draw_g::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
|
||||
if (content_.empty()) return;
|
||||
|
||||
draw_g *group = dynamic_cast<draw_g*> (content_.back().get());
|
||||
draw_frame *frame = dynamic_cast<draw_frame*> (content_.back().get());
|
||||
draw_shape *shape = dynamic_cast<draw_shape*> (content_.back().get());
|
||||
|
||||
if (group)
|
||||
{
|
||||
int x=0, y=0, cx=0, cy=0;
|
||||
x = get_value_emu(group->common_draw_attlists_.position_.svg_x_);
|
||||
y = get_value_emu(group->common_draw_attlists_.position_.svg_y_);
|
||||
|
||||
cx = get_value_emu(group->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_width_);
|
||||
cy = get_value_emu(group->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_height_);
|
||||
|
||||
if (position_child_x1 > x || position_child_x1 < 0) position_child_x1 = x;
|
||||
if (position_child_y1 > y || position_child_y1 < 0) position_child_y1 = y;
|
||||
|
||||
if (position_child_x2 < x + cx || position_child_x2 < 0) position_child_x2 = x + cx;
|
||||
if (position_child_y2 < y + cy || position_child_y2 < 0) position_child_y2 = y + cy;
|
||||
}
|
||||
else if (frame)
|
||||
{
|
||||
int x=0, y=0, cx=0, cy=0;
|
||||
x = get_value_emu(frame->common_draw_attlists_.position_.svg_x_);
|
||||
y = get_value_emu(frame->common_draw_attlists_.position_.svg_y_);
|
||||
|
||||
cx = get_value_emu(frame->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_width_);
|
||||
cy = get_value_emu(frame->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_height_);
|
||||
|
||||
if (position_child_x1 > x || position_child_x1 < 0) position_child_x1 = x;
|
||||
if (position_child_y1 > y || position_child_y1 < 0) position_child_y1 = y;
|
||||
|
||||
if (position_child_x2 < x + cx || position_child_x2 < 0) position_child_x2 = x + cx;
|
||||
if (position_child_y2 < y + cy || position_child_y2 < 0) position_child_y2 = y + cy;
|
||||
}
|
||||
else if (shape)
|
||||
{
|
||||
int x=0, y=0, cx=0, cy=0;
|
||||
x = get_value_emu(shape->common_draw_attlists_.position_.svg_x_);
|
||||
y = get_value_emu(shape->common_draw_attlists_.position_.svg_y_);
|
||||
|
||||
cx = get_value_emu(shape->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_width_);
|
||||
cy = get_value_emu(shape->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_height_);
|
||||
|
||||
if (position_child_x1 > x || position_child_x1 < 0) position_child_x1 = x;
|
||||
if (position_child_y1 > y || position_child_y1 < 0) position_child_y1 = y;
|
||||
|
||||
if (position_child_x2 < x + cx || position_child_x2 < 0) position_child_x2 = x + cx;
|
||||
if (position_child_y2 < y + cy || position_child_y2 < 0) position_child_y2 = y + cy;
|
||||
}
|
||||
}
|
||||
|
||||
std::wostream & draw_g::text_to_stream(std::wostream & _Wostream) const
|
||||
@ -295,50 +348,63 @@ void draw_object_ole::add_child_element( xml::sax * Reader, const std::wstring &
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
|
||||
std::wstring draw_object_ole::detectObject(const std::wstring &fileName)
|
||||
void draw_object_ole::detectObject(const std::wstring &fileName, std::wstring &prog, std::wstring &extension, oox::RelsType &rels)
|
||||
{
|
||||
extension = L".bin";
|
||||
|
||||
POLE::Storage *storage = new POLE::Storage(fileName.c_str());
|
||||
if (storage == NULL) return L"";
|
||||
|
||||
if (storage->open(false, false) == false)
|
||||
if ((storage) && (storage->open(false, false) == true))
|
||||
{
|
||||
delete storage;
|
||||
return L"";
|
||||
}
|
||||
std::wstring prog;
|
||||
POLE::Stream* pStream = new POLE::Stream(storage, L"CompObj");
|
||||
if ((pStream) && (pStream->size() > 28))
|
||||
{
|
||||
//skip the CompObjHeader
|
||||
pStream->seek(28);
|
||||
|
||||
int sz_obj = (int)pStream->size() - 28;
|
||||
|
||||
std::vector<std::string> str;
|
||||
|
||||
while (sz_obj > 0)
|
||||
std::wstring prog;
|
||||
POLE::Stream* pStream = new POLE::Stream(storage, L"CompObj");
|
||||
if ((pStream) && (pStream->size() > 28))
|
||||
{
|
||||
_UINT32 sz = 0;
|
||||
pStream->read((unsigned char*)&sz, 4); sz_obj-= 4;
|
||||
//skip the CompObjHeader
|
||||
pStream->seek(28);
|
||||
|
||||
int sz_obj = (int)pStream->size() - 28;
|
||||
|
||||
std::vector<std::string> str;
|
||||
|
||||
if (sz > sz_obj)
|
||||
break;
|
||||
unsigned char *data = new unsigned char[sz];
|
||||
pStream->read(data, sz);
|
||||
while (sz_obj > 0)
|
||||
{
|
||||
_UINT32 sz = 0;
|
||||
pStream->read((unsigned char*)&sz, 4); sz_obj-= 4;
|
||||
|
||||
if (sz > sz_obj)
|
||||
break;
|
||||
unsigned char *data = new unsigned char[sz];
|
||||
pStream->read(data, sz);
|
||||
|
||||
str.push_back(std::string((char*)data, sz));
|
||||
delete []data;
|
||||
str.push_back(std::string((char*)data, sz));
|
||||
delete []data;
|
||||
|
||||
sz_obj-= sz;
|
||||
}
|
||||
if (!str.empty())
|
||||
{
|
||||
prog = std::wstring (str.back().begin(), str.back().end());
|
||||
}
|
||||
delete pStream;
|
||||
}
|
||||
delete storage;
|
||||
}
|
||||
else
|
||||
{
|
||||
COfficeFileFormatChecker checker(fileName);
|
||||
switch(checker.nFileType)
|
||||
{
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC: extension = L".doc"; prog = L"Word"; rels = oox::typeOleObject; break;
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX: extension = L".docx"; prog = L"Word"; rels = oox::typeMsObject; break;
|
||||
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS: extension = L".xls"; prog = L"Excel"; rels = oox::typeOleObject; break;
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX: extension = L".xlsx"; prog = L"Excel"; rels = oox::typeMsObject; break;
|
||||
|
||||
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT: extension = L".ppt"; prog = L"PowerPoint"; rels = oox::typeOleObject; break;
|
||||
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX: extension = L".pptx"; prog = L"PowerPoint"; rels = oox::typeMsObject; break;
|
||||
|
||||
sz_obj-= sz;
|
||||
}
|
||||
if (!str.empty())
|
||||
{
|
||||
prog = std::wstring (str.back().begin(), str.back().end());
|
||||
}
|
||||
delete pStream;
|
||||
}
|
||||
delete storage;
|
||||
return prog;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -209,6 +209,8 @@ public:
|
||||
static const ElementType type = typeDrawG;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
draw_g() : position_child_x1(-1), position_child_y1(-1), position_child_x2(-1), position_child_y2(-1) {}
|
||||
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
@ -220,6 +222,12 @@ public:
|
||||
|
||||
office_element_ptr_array content_;
|
||||
|
||||
int position_child_x1;
|
||||
int position_child_y1;
|
||||
|
||||
int position_child_x2;
|
||||
int position_child_y2;
|
||||
|
||||
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);
|
||||
@ -327,7 +335,7 @@ 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);
|
||||
|
||||
std::wstring detectObject(const std::wstring &fileName);
|
||||
void detectObject(const std::wstring &fileName, std::wstring &prog, std::wstring &extension, oox::RelsType &rels);
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_object_ole);
|
||||
|
||||
@ -838,12 +838,20 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, union_comm
|
||||
}
|
||||
if (!drawing->isInline)
|
||||
{
|
||||
drawing->relativeHeight = L"2";
|
||||
drawing->behindDoc = L"0";
|
||||
|
||||
if (((drawing->styleWrap && drawing->styleWrap->get_type() == style_wrap::RunThrough) ||
|
||||
!drawing->styleWrap) && styleRunThrough && styleRunThrough->get_type() == run_through::Background)
|
||||
{
|
||||
drawing->behindDoc = L"1";
|
||||
if (!drawing->styleWrap)
|
||||
drawing->styleWrap = style_wrap(style_wrap::RunThrough);
|
||||
|
||||
}
|
||||
if (!drawing->styleWrap)
|
||||
drawing->styleWrap = style_wrap(style_wrap::Parallel);//у опен офис и мс разные дефолты
|
||||
|
||||
drawing->relativeHeight = L"2";
|
||||
drawing->behindDoc = L"0";
|
||||
|
||||
_CP_OPT(int) zIndex = attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_z_index_;
|
||||
|
||||
if (zIndex)//порядок отрисовки объектов
|
||||
@ -853,13 +861,6 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, union_comm
|
||||
else
|
||||
drawing->relativeHeight = std::to_wstring( 2 + *zIndex );
|
||||
}
|
||||
|
||||
if (drawing->styleWrap && drawing->styleWrap->get_type() == style_wrap::RunThrough
|
||||
&& styleRunThrough && styleRunThrough->get_type() == run_through::Background)
|
||||
{
|
||||
drawing-> behindDoc = L"1";
|
||||
}
|
||||
|
||||
drawing->margin_rect[0] = GetMargin(graphicProperties, sideLeft);
|
||||
drawing->margin_rect[1] = GetMargin(graphicProperties, sideTop);
|
||||
drawing->margin_rect[2] = GetMargin(graphicProperties, sideRight);
|
||||
@ -873,14 +874,14 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, union_comm
|
||||
int type = attlists_.rel_size_.style_rel_width_->get_type();
|
||||
|
||||
if (type == odf_types::percent_or_scale::Percent)
|
||||
drawing->pctWidth = attlists_.rel_size_.style_rel_width_->get_percent().get_value();
|
||||
drawing->pctWidth = (int)attlists_.rel_size_.style_rel_width_->get_percent().get_value();
|
||||
}
|
||||
if (attlists_.rel_size_.style_rel_height_ )
|
||||
{
|
||||
int type = attlists_.rel_size_.style_rel_height_->get_type();
|
||||
|
||||
if (type == odf_types::percent_or_scale::Percent)
|
||||
drawing->pctHeight = attlists_.rel_size_.style_rel_height_->get_percent().get_value();
|
||||
drawing->pctHeight = (int)attlists_.rel_size_.style_rel_height_->get_percent().get_value();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1002,7 +1003,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, union_comm
|
||||
drawing->x = val >= 0 ? val : 0; //??? todooo отрицательные величины ...
|
||||
}
|
||||
|
||||
GetProperty(drawing->additional,L"svg:translate_y", dVal);
|
||||
GetProperty(drawing->additional, L"svg:translate_y", dVal);
|
||||
if (dVal)
|
||||
{
|
||||
int val = get_value_emu(dVal.get());
|
||||
@ -1011,16 +1012,11 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, union_comm
|
||||
|
||||
if (drawing->inGroup && drawing->type != oox::typeGroupShape)
|
||||
{
|
||||
Context.get_drawing_context().set_position_child_group (drawing->x, drawing->y);
|
||||
Context.get_drawing_context().set_size_child_group (drawing->cx + drawing->x, drawing->cy + drawing->y);
|
||||
|
||||
// ваще то тут "несовсем" всерно ... нужно сначала все стартовые позиции добавить ..
|
||||
_INT32 x_group_offset, y_group_offset;
|
||||
Context.get_drawing_context().get_position_group(x_group_offset, y_group_offset);
|
||||
|
||||
drawing->x -= x_group_offset;
|
||||
drawing->y -= y_group_offset;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1029,15 +1025,17 @@ void draw_shape::docx_convert(oox::docx_conversion_context & Context)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
oox::_docx_drawing drawing = oox::_docx_drawing();
|
||||
|
||||
drawing.type = oox::typeShape;
|
||||
drawing.id = Context.get_drawing_context().get_current_shape_id();
|
||||
drawing.name = Context.get_drawing_context().get_current_object_name();
|
||||
drawing.inGroup = Context.get_drawing_context().in_group();
|
||||
drawing.type = oox::typeShape;
|
||||
drawing.id = Context.get_drawing_context().get_current_shape_id();
|
||||
drawing.name = Context.get_drawing_context().get_current_object_name();
|
||||
drawing.inGroup = Context.get_drawing_context().in_group();
|
||||
drawing.lined = lined_shape_;
|
||||
drawing.connector = connector_;
|
||||
|
||||
drawing.sub_type = sub_type_;
|
||||
drawing.additional = additional_;//сюда могут добавиться свойства ...
|
||||
|
||||
if (drawing.sub_type !=5 )//line
|
||||
if (drawing.lined == false)
|
||||
{
|
||||
drawing.additional.push_back(_property(L"text-content", Context.get_drawing_context().get_text_stream_shape()));
|
||||
}
|
||||
@ -1189,10 +1187,18 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
|
||||
std::wstring strRectClip = properties->fo_clip_.get();
|
||||
strRectClip = strRectClip.substr(5, strRectClip.length() - 6);
|
||||
|
||||
std::wstring fileName = Context.root()->get_folder() + FILE_SEPARATOR_STR + href;
|
||||
std::wstring fileName = Context.root()->get_folder() + FILE_SEPARATOR_STR + xlink_attlist_.href_.get_value_or(L"");
|
||||
|
||||
drawing->fill.bitmap->bCrop = parse_clipping(strRectClip, fileName, drawing->fill.bitmap->cropRect, NULL/*Context.applicationFonts_*/);
|
||||
}
|
||||
drawing->fill.bitmap->bCrop = parse_clipping(strRectClip, fileName, drawing->fill.bitmap->cropRect, Context.get_mediaitems().applicationFonts());
|
||||
}
|
||||
if (properties->common_draw_fill_attlist_.draw_luminance_)
|
||||
{
|
||||
drawing->fill.bitmap->luminance = properties->common_draw_fill_attlist_.draw_luminance_->get_value();
|
||||
}
|
||||
if (properties->common_draw_fill_attlist_.draw_contrast_)
|
||||
{
|
||||
drawing->fill.bitmap->contrast = properties->common_draw_fill_attlist_.draw_contrast_->get_value();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1346,9 +1352,14 @@ void draw_g::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
Context.reset_context_state();
|
||||
|
||||
if (position_child_x1 >= 0 && position_child_y1 >= 0 )
|
||||
Context.get_drawing_context().set_position_child_group (position_child_x1, position_child_y1);
|
||||
|
||||
if (position_child_x2 >= 0 && position_child_y2 >= 0 )
|
||||
Context.get_drawing_context().set_size_child_group (position_child_x2, position_child_y2);
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
ElementType type = content_[i]->get_type();
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
drawing.content_group_ = temp_stream.str();
|
||||
@ -1367,10 +1378,6 @@ void draw_g::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
if (drawing.inGroup)
|
||||
{
|
||||
Context.get_drawing_context().set_position_child_group (drawing.x, drawing.y);
|
||||
Context.get_drawing_context().set_size_child_group (drawing.cx + drawing.x, drawing.cy + drawing.y);
|
||||
|
||||
// ваще то тут "несовсем" верно ... нужно сначала все стартовые позиции добавить ..
|
||||
_INT32 x_group_offset, y_group_offset;
|
||||
Context.get_drawing_context().get_position_group(x_group_offset, y_group_offset);
|
||||
|
||||
@ -1635,18 +1642,20 @@ void draw_object_ole::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
if (href.empty()) return;
|
||||
|
||||
draw_frame* frame = Context.get_drawing_context().get_current_frame(); //owner
|
||||
draw_frame* frame = Context.get_drawing_context().get_current_frame(); //owner
|
||||
if (!frame) return;
|
||||
|
||||
oox::_docx_drawing * drawing = dynamic_cast<oox::_docx_drawing *>(frame->oox_drawing_.get());
|
||||
oox::_docx_drawing * drawing = dynamic_cast<oox::_docx_drawing *>(frame->oox_drawing_.get());
|
||||
if (!drawing) return;
|
||||
|
||||
drawing->type = oox::typeOleObject;
|
||||
|
||||
bool isMediaInternal = true;
|
||||
drawing->objectId = Context.get_mediaitems().add_or_find(href, drawing->type, isMediaInternal, href);
|
||||
std::wstring extension;
|
||||
detectObject(href, drawing->objectProgId, extension, drawing->type);
|
||||
|
||||
NSFile::CFileBinary::Copy(objectPath, objectPath + extension);
|
||||
|
||||
bool isMediaInternal = true;
|
||||
drawing->objectId = Context.get_mediaitems().add_or_find(href + extension, drawing->type, isMediaInternal, href);
|
||||
|
||||
drawing->objectProgId = detectObject(objectPath);
|
||||
}
|
||||
void draw_control::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
|
||||
@ -162,7 +162,13 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
|
||||
oox::_oox_fill fill;
|
||||
Compute_GraphicFill(properties.common_draw_fill_attlist_, properties.style_background_image_,
|
||||
Context.root()->odf_context().drawStyles() ,fill);
|
||||
Context.root()->odf_context().drawStyles(), fill);
|
||||
if (properties.fo_clip_)
|
||||
{
|
||||
std::wstring strRectClip = properties.fo_clip_.get();
|
||||
Context.get_slide_context().set_clipping(strRectClip.substr(5, strRectClip.length() - 6));
|
||||
}
|
||||
|
||||
Context.get_slide_context().set_fill(fill);
|
||||
|
||||
Context.get_slide_context().set_property(odf_reader::_property(L"border_width_left", Compute_BorderWidth(properties, sideLeft)));
|
||||
@ -170,11 +176,6 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
Context.get_slide_context().set_property(odf_reader::_property(L"border_width_right", Compute_BorderWidth(properties, sideRight)));
|
||||
Context.get_slide_context().set_property(odf_reader::_property(L"border_width_bottom", Compute_BorderWidth(properties, sideBottom)));
|
||||
|
||||
if (properties.fo_clip_)
|
||||
{
|
||||
std::wstring strRectClip = properties.fo_clip_.get();
|
||||
Context.get_slide_context().set_clipping(strRectClip.substr(5,strRectClip.length()-6));
|
||||
}
|
||||
if (common_presentation_attlist_.presentation_class_)
|
||||
{
|
||||
Context.get_slide_context().set_placeHolder_type(common_presentation_attlist_.presentation_class_->get_type_ms());
|
||||
@ -221,7 +222,7 @@ void draw_image::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
}
|
||||
std::wstring text_content_ = Context.get_text_context().end_object();
|
||||
|
||||
if (text_content_.length()>0)
|
||||
if (!text_content_.empty())
|
||||
{
|
||||
Context.get_slide_context().set_property(_property(L"text-content", text_content_));
|
||||
}
|
||||
@ -384,7 +385,18 @@ void draw_object_ole::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;
|
||||
|
||||
if (!href.empty())
|
||||
Context.get_slide_context().set_ole_object(href, detectObject(objectPath));
|
||||
{
|
||||
std::wstring prog, extension;
|
||||
oox::RelsType relsType;
|
||||
detectObject(objectPath, prog, extension, relsType);
|
||||
|
||||
NSFile::CFileBinary::Copy(objectPath, objectPath + extension);
|
||||
|
||||
if (relsType == oox::typeMsObject)
|
||||
Context.get_slide_context().set_ms_object(href + extension, prog);
|
||||
else
|
||||
Context.get_slide_context().set_ole_object(href + extension, prog);
|
||||
}
|
||||
}
|
||||
|
||||
void draw_param::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
|
||||
@ -179,14 +179,14 @@ void draw_frame::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
Context.get_drawing_context().set_property(odf_reader::_property(L"border_width_right", Compute_BorderWidth(properties, sideRight)));
|
||||
Context.get_drawing_context().set_property(odf_reader::_property(L"border_width_bottom", Compute_BorderWidth(properties, sideBottom)));
|
||||
|
||||
oox::_oox_fill fill;
|
||||
Compute_GraphicFill(properties.common_draw_fill_attlist_, properties.style_background_image_,
|
||||
Context.root()->odf_context().drawStyles(), fill);
|
||||
if (properties.fo_clip_)
|
||||
{
|
||||
std::wstring strRectClip = properties.fo_clip_.get();
|
||||
Context.get_drawing_context().set_clipping(strRectClip.substr(5,strRectClip.length()-6));
|
||||
Context.get_drawing_context().set_clipping(strRectClip.substr(5, strRectClip.length() - 6));
|
||||
}
|
||||
oox::_oox_fill fill;
|
||||
Compute_GraphicFill(properties.common_draw_fill_attlist_, properties.style_background_image_,
|
||||
Context.root()->odf_context().drawStyles() ,fill);
|
||||
Context.get_drawing_context().set_fill(fill);
|
||||
|
||||
oox_drawing_ = oox_drawing_ptr(new oox::_xlsx_drawing());
|
||||
@ -228,7 +228,7 @@ void draw_image::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
}
|
||||
std::wstring text_content_ = Context.get_text_context().end_drawing_content();
|
||||
|
||||
if (text_content_.length()>0)
|
||||
if (!text_content_.empty())
|
||||
{
|
||||
Context.get_drawing_context().set_property(_property(L"text-content", text_content_));
|
||||
}
|
||||
@ -359,8 +359,18 @@ void draw_object_ole::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;
|
||||
|
||||
if (!href.empty())
|
||||
Context.get_drawing_context().set_ole_object(href, detectObject(objectPath));
|
||||
|
||||
{
|
||||
std::wstring prog, extension;
|
||||
oox::RelsType relsType;
|
||||
detectObject(objectPath, prog, extension, relsType);
|
||||
|
||||
NSFile::CFileBinary::Copy(objectPath, objectPath + extension);
|
||||
|
||||
if (relsType == oox::typeMsObject)
|
||||
Context.get_drawing_context().set_ms_object(href + extension, prog);
|
||||
else
|
||||
Context.get_drawing_context().set_ole_object(href + extension, prog);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -174,6 +174,7 @@ void draw_line::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
draw_shape::add_attributes(Attributes);
|
||||
|
||||
sub_type_ = 5;
|
||||
lined_shape_ = true;
|
||||
}
|
||||
void draw_line::reset_svg_attributes()
|
||||
{
|
||||
@ -256,8 +257,11 @@ void draw_path::reset_svg_path()
|
||||
std::vector<::svg_path::_polyline> o_Polyline_pt;
|
||||
std::vector<::svg_path::_polyline> o_Polyline_cm;
|
||||
|
||||
bool res = ::svg_path::parseSvgD(o_Polyline_cm, draw_path_attlist_.svg_d_.get(), false);
|
||||
bool bClosed = false;
|
||||
bool res = ::svg_path::parseSvgD(o_Polyline_cm, draw_path_attlist_.svg_d_.get(), false, bClosed);
|
||||
|
||||
if (!bClosed) lined_shape_ = true;
|
||||
|
||||
for (size_t i = 0; i < o_Polyline_cm.size(); i++)
|
||||
{
|
||||
::svg_path::_polyline & poly = o_Polyline_cm[i];
|
||||
@ -275,7 +279,7 @@ void draw_path::reset_svg_path()
|
||||
}
|
||||
o_Polyline_pt.push_back(poly);
|
||||
}
|
||||
if (o_Polyline_pt.size()>0)
|
||||
if (false == o_Polyline_pt.empty())
|
||||
{
|
||||
//сформируем xml-oox сдесь ... а то придется плодить массивы в drawing .. хоть и не красиво..
|
||||
std::wstringstream output_;
|
||||
@ -291,18 +295,24 @@ void draw_polygon_attlist::add_attributes( const xml::attributes_wc_ptr & Attrib
|
||||
CP_APPLY_ATTR(L"svg:viewBox", svg_viewbox_);
|
||||
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:polygon
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_polygon::ns = L"draw";
|
||||
const wchar_t * draw_polygon::name = L"polygon";
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:contour-polygon
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_contour_polygon::ns = L"draw";
|
||||
const wchar_t * draw_contour_polygon::name = L"contour-polygon";
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:contour-path
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_contour_path::ns = L"draw";
|
||||
const wchar_t * draw_contour_path::name = L"contour-path";
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:polygon
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_polygon::ns = L"draw";
|
||||
const wchar_t * draw_polygon::name = L"polygon";
|
||||
|
||||
void draw_polygon::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
draw_polygon_attlist_.add_attributes(Attributes);
|
||||
@ -322,7 +332,7 @@ void draw_polygon::reset_polygon_path()
|
||||
std::vector<::svg_path::_polyline> o_Polyline_pt;
|
||||
std::vector<::svg_path::_polyline> o_Polyline_cm;
|
||||
|
||||
bool res = ::svg_path::parsePolygon(o_Polyline_cm, draw_polygon_attlist_.draw_points_.get(),false, true);
|
||||
bool res = ::svg_path::parsePolygon(o_Polyline_cm, draw_polygon_attlist_.draw_points_.get(), false, true);
|
||||
|
||||
for (size_t ind = 0 ; ind < o_Polyline_cm.size(); ind++)
|
||||
{
|
||||
@ -341,12 +351,12 @@ void draw_polygon::reset_polygon_path()
|
||||
}
|
||||
o_Polyline_pt.push_back(poly);
|
||||
}
|
||||
if (o_Polyline_pt.size()>0)
|
||||
if (false == o_Polyline_pt.empty())
|
||||
{
|
||||
//сформируем xml-oox сдесь ... а то придется плодить массивы в drawing .. хоть и не красиво..
|
||||
std::wstringstream output_;
|
||||
::svg_path::oox_serialize(output_, o_Polyline_pt);
|
||||
additional_.push_back(odf_reader::_property(L"custom_path",output_.str()));
|
||||
additional_.push_back(odf_reader::_property(L"custom_path", output_.str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -368,7 +378,8 @@ void draw_polyline::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
draw_polyline_attlist_.add_attributes(Attributes);
|
||||
draw_shape::add_attributes(Attributes);
|
||||
|
||||
sub_type_ = 8;
|
||||
sub_type_ = 14;
|
||||
lined_shape_ = true;
|
||||
|
||||
}
|
||||
void draw_polyline::reset_polyline_path()
|
||||
@ -382,7 +393,7 @@ void draw_polyline::reset_polyline_path()
|
||||
std::vector<::svg_path::_polyline> o_Polyline_pt;
|
||||
std::vector<::svg_path::_polyline> o_Polyline_cm;
|
||||
|
||||
bool res = ::svg_path::parsePolygon(o_Polyline_cm, draw_polyline_attlist_.draw_points_.get(), false, true);
|
||||
bool res = ::svg_path::parsePolygon(o_Polyline_cm, draw_polyline_attlist_.draw_points_.get(), false, false);
|
||||
|
||||
_CP_OPT(double) start_x, start_y;
|
||||
|
||||
@ -407,7 +418,7 @@ void draw_polyline::reset_polyline_path()
|
||||
}
|
||||
o_Polyline_pt.push_back(poly);
|
||||
}
|
||||
if (o_Polyline_pt.size()>0)
|
||||
if (false == o_Polyline_pt.empty())
|
||||
{
|
||||
//сформируем xml-oox сдесь ... а то придется плодить массивы в drawing .. хоть и не красиво..
|
||||
std::wstringstream output_;
|
||||
@ -546,9 +557,9 @@ void draw_enhanced_geometry::find_draw_type_oox()
|
||||
if (!draw_type_oox_index_)
|
||||
{
|
||||
int count = sizeof(_OO_OOX_custom_shapes) / sizeof(_shape_converter);
|
||||
int pos = odf_type.find(L"ooxml-");
|
||||
size_t pos = odf_type.find(L"ooxml-");
|
||||
|
||||
if (pos < 0)
|
||||
if (pos == std::wstring::npos)
|
||||
{
|
||||
for (long i = 0; i< count; i++)
|
||||
{
|
||||
@ -562,7 +573,7 @@ void draw_enhanced_geometry::find_draw_type_oox()
|
||||
else
|
||||
{
|
||||
std::wstring oox_type = odf_type.substr(pos + 6);
|
||||
for (long i = 0; i< count; i++)
|
||||
for (long i = 0; i < count; i++)
|
||||
{
|
||||
if (_OO_OOX_custom_shapes[i].oox == oox_type)
|
||||
{
|
||||
@ -572,7 +583,7 @@ void draw_enhanced_geometry::find_draw_type_oox()
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((draw_type_oox_index_) && (*draw_type_oox_index_== 179))//L"textBox"
|
||||
if ((draw_type_oox_index_) && (*draw_type_oox_index_== 96))//L"textBox" "mso-spt24"
|
||||
{
|
||||
sub_type_ = 1;//textBox
|
||||
}
|
||||
@ -649,21 +660,23 @@ void draw_connector::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
draw_line_attlist_.add_attributes(Attributes);
|
||||
draw_shape::add_attributes(Attributes);
|
||||
|
||||
sub_type_ = 5; //коннектор - линия, если ломаная (ниже определяется) - то путь
|
||||
|
||||
sub_type_ = 10; //коннектор - линия, если ломаная (ниже определяется) - то путь
|
||||
lined_shape_ = true;
|
||||
connector_ = true;
|
||||
}
|
||||
void draw_connector::reset_svg_path()
|
||||
{
|
||||
if (!draw_connector_attlist_.svg_d_)
|
||||
{
|
||||
bad_shape_ = true;
|
||||
}
|
||||
else
|
||||
if (draw_connector_attlist_.svg_d_)
|
||||
{
|
||||
sub_type_ = 8;
|
||||
|
||||
std::vector<::svg_path::_polyline> o_Polyline_pt;
|
||||
std::vector<::svg_path::_polyline> o_Polyline_cm;
|
||||
|
||||
bool res = ::svg_path::parseSvgD(o_Polyline_cm, draw_connector_attlist_.svg_d_.get(), false);
|
||||
bool bClosed = false;
|
||||
bool res = ::svg_path::parseSvgD(o_Polyline_cm, draw_connector_attlist_.svg_d_.get(), false, bClosed);
|
||||
|
||||
if (!bClosed) lined_shape_ = true;
|
||||
|
||||
double x1=common_draw_attlists_.position_.svg_x_.get_value_or(length(0)).get_value_unit(length::emu);
|
||||
double y1=common_draw_attlists_.position_.svg_y_.get_value_or(length(0)).get_value_unit(length::emu);
|
||||
@ -707,7 +720,7 @@ void dr3d_scene::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
draw_shape::add_attributes(Attributes);
|
||||
|
||||
sub_type_ = 10;
|
||||
sub_type_ = 12;
|
||||
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
@ -718,13 +731,22 @@ const wchar_t * dr3d_extrude::name = L"extrude";
|
||||
|
||||
void dr3d_extrude::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"svg:d", svg_d_);
|
||||
CP_APPLY_ATTR(L"svg:viewBox", svg_viewbox_);
|
||||
draw_path::add_attributes(Attributes);
|
||||
|
||||
//sub_type_ = ??
|
||||
}
|
||||
void dr3d_extrude::reset_svg_path()
|
||||
{
|
||||
if (!svg_d_) return;
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// dr3d:rotate
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * dr3d_rotate::ns = L"dr3d";
|
||||
const wchar_t * dr3d_rotate::name = L"rotate";
|
||||
|
||||
void dr3d_rotate::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
draw_path::add_attributes(Attributes);
|
||||
|
||||
//sub_type_ = ??
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// dr3d:light
|
||||
|
||||
@ -63,7 +63,7 @@ public:
|
||||
static const ElementType type = typeDrawShape;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
|
||||
draw_shape() : bad_shape_(false), word_art_(false), idx_in_owner(-1) {}
|
||||
draw_shape() : bad_shape_(false), word_art_(false), idx_in_owner(-1), lined_shape_(false), connector_(false){}
|
||||
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
friend class odf_document;
|
||||
@ -93,6 +93,8 @@ public:
|
||||
int sub_type_;
|
||||
std::vector<odf_reader::_property> additional_;
|
||||
int idx_in_owner;
|
||||
bool lined_shape_;
|
||||
bool connector_;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -285,7 +287,7 @@ public:
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_polygon);
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
//draw:contour-polygon
|
||||
class draw_contour_polygon : public draw_polygon
|
||||
{
|
||||
@ -297,9 +299,21 @@ public:
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_contour_polygon);
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
//draw:contour-path
|
||||
class draw_contour_path : public draw_path
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
|
||||
static const ElementType type = typeDrawContourPath;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_contour_path);
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
class draw_polyline_attlist
|
||||
{
|
||||
public:
|
||||
@ -572,9 +586,9 @@ public:
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(dr3d_scene);
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
|
||||
class dr3d_extrude : public office_element_impl<dr3d_extrude>
|
||||
class dr3d_extrude : public draw_path
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -586,19 +600,31 @@ public:
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context);
|
||||
|
||||
_CP_OPT(std::wstring) svg_d_;
|
||||
_CP_OPT(std::wstring) svg_viewbox_;
|
||||
|
||||
void reset_svg_path();
|
||||
|
||||
//virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
//virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
//virtual void pptx_convert(oox::pptx_conversion_context & Context);
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(dr3d_extrude);
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
|
||||
class dr3d_rotate : public draw_path
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
|
||||
static const ElementType type = typeDr3dRotate;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
//virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
//virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
//virtual void pptx_convert(oox::pptx_conversion_context & Context);
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(dr3d_rotate);
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
class dr3d_light : public office_element_impl<dr3d_light>
|
||||
{
|
||||
public:
|
||||
|
||||
@ -103,6 +103,7 @@ void draw_shape::common_docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
std::wstring href = fill.bitmap->xlink_href_;
|
||||
fill.bitmap->rId = Context.get_mediaitems().add_or_find(href, oox::typeImage, fill.bitmap->isInternal, href);
|
||||
fill.bitmap->name_space = L"w14";
|
||||
}
|
||||
|
||||
std::wstringstream strm_fill, strm_ln;
|
||||
@ -214,10 +215,18 @@ void draw_path::docx_convert(oox::docx_conversion_context & Context)
|
||||
void draw_connector::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
//if (Context.get_drawing_context().get_current_level() >0 )return;
|
||||
|
||||
if (draw_connector_attlist_.draw_type_)
|
||||
{
|
||||
if (*draw_connector_attlist_.draw_type_ == L"curve")
|
||||
{
|
||||
sub_type_ = 11;
|
||||
}
|
||||
}
|
||||
reset_svg_attributes();
|
||||
common_docx_convert(Context);
|
||||
//...
|
||||
reset_svg_path();
|
||||
|
||||
draw_shape::docx_convert(Context);
|
||||
}
|
||||
void draw_polygon::docx_convert(oox::docx_conversion_context & Context)
|
||||
@ -306,15 +315,17 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
|
||||
std::vector<::svg_path::_polyline> o_Polyline;
|
||||
|
||||
bool res = false;
|
||||
bool bClosed = false;
|
||||
|
||||
try
|
||||
{
|
||||
res = ::svg_path::parseSvgD(o_Polyline, odf_path, true);
|
||||
res = ::svg_path::parseSvgD(o_Polyline, odf_path, true, bClosed);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
res = false;
|
||||
}
|
||||
//if (!bClosed) lined_shape_ = true;
|
||||
|
||||
if (!o_Polyline.empty() && res )
|
||||
{
|
||||
@ -392,11 +403,6 @@ void dr3d_scene::docx_convert(oox::docx_conversion_context & Context)
|
||||
//...
|
||||
draw_shape::docx_convert(Context);
|
||||
}
|
||||
void dr3d_extrude::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
reset_svg_path();
|
||||
|
||||
}
|
||||
void dr3d_light::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user