mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-15 20:36:10 +08:00
Compare commits
177 Commits
core-linux
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| 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 | |||
| 4e81420eed | |||
| e26f836da7 | |||
| 69d2b12f53 | |||
| f2260748c8 | |||
| b59f84b262 | |||
| 3e5fed8482 | |||
| 538e477818 | |||
| b212e878c6 | |||
| 05694d13f3 | |||
| 1dd72c99a2 | |||
| 4b73e58693 | |||
| bee4f57dd3 | |||
| dd40e3e53c | |||
| d657ece017 | |||
| b21b1b8aaf | |||
| 09fb980060 | |||
| 142f9f57a3 | |||
| 1955dc98df | |||
| 28346c4571 | |||
| 9810087ee1 | |||
| 2b8e1456c2 | |||
| 274c000ce7 | |||
| 9e6dd1fbb1 | |||
| 158692f824 | |||
| 49723e648a | |||
| 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>
|
||||
|
||||
@ -61,7 +61,7 @@ namespace DocFileFormat
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
long Converter::Convert(WordDocument* doc, WordprocessingDocument* docx, const ProgressCallback* progress)
|
||||
_UINT32 Converter::Convert(WordDocument* doc, WordprocessingDocument* docx, const ProgressCallback* progress)
|
||||
{
|
||||
if (!doc || !docx) return S_FALSE;
|
||||
|
||||
@ -202,20 +202,18 @@ namespace DocFileFormat
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
long Converter::LoadAndConvert(const std::wstring& strSrcFile, const std::wstring& strDstDirectory, const std::wstring& password, const ProgressCallback* progress, bool &bMacros)
|
||||
_UINT32 Converter::LoadAndConvert(const std::wstring& strSrcFile, const std::wstring& strDstDirectory, const std::wstring& password, const ProgressCallback* progress, bool &bMacros)
|
||||
{
|
||||
long result = S_FALSE;
|
||||
|
||||
WordDocument doc(progress, m_sTempFolder);
|
||||
WordprocessingDocument docx(strDstDirectory, &doc);
|
||||
|
||||
result = doc.LoadDocument(strSrcFile, password);
|
||||
_UINT32 result = doc.LoadDocument(strSrcFile, password);
|
||||
|
||||
if (result == S_OK)
|
||||
if (result == 0)
|
||||
{
|
||||
result = Convert(&doc, &docx, progress);
|
||||
|
||||
if (result == S_OK)
|
||||
if (result == 0)
|
||||
{
|
||||
docx.SaveDocument(bMacros);
|
||||
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "../../Common/DocxFormat/Source/Base/Types_32.h"
|
||||
|
||||
struct ProgressCallback;
|
||||
|
||||
@ -48,9 +49,9 @@ namespace DocFileFormat
|
||||
|
||||
std::wstring m_sTempFolder;
|
||||
|
||||
long LoadAndConvert(const std::wstring & strSrcFile, const std::wstring & strDstDirectory, const std::wstring & password, const ProgressCallback* progress, bool &bMacros);
|
||||
_UINT32 LoadAndConvert(const std::wstring & strSrcFile, const std::wstring & strDstDirectory, const std::wstring & password, const ProgressCallback* progress, bool &bMacros);
|
||||
|
||||
private:
|
||||
long Convert(WordDocument* doc, WordprocessingDocument* docx, const ProgressCallback* progress);
|
||||
_UINT32 Convert(WordDocument* doc, WordprocessingDocument* docx, const ProgressCallback* progress);
|
||||
};
|
||||
}
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -117,7 +117,7 @@ namespace DocFileFormat
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
int WordDocument::LoadDocument(const std::wstring & fileName, const std::wstring & password)
|
||||
_UINT32 WordDocument::LoadDocument(const std::wstring & fileName, const std::wstring & password)
|
||||
{
|
||||
m_sFileName = fileName;
|
||||
m_sPassword = password;
|
||||
|
||||
@ -94,7 +94,7 @@ namespace DocFileFormat
|
||||
WordDocument (const ProgressCallback* pCallFunc, const std::wstring & tempFolder );
|
||||
virtual ~WordDocument();
|
||||
|
||||
int LoadDocument(const std::wstring & fileName, const std::wstring & password);
|
||||
_UINT32 LoadDocument(const std::wstring & fileName, const std::wstring & password);
|
||||
|
||||
int nWordVersion;
|
||||
int nDocumentCodePage;
|
||||
|
||||
@ -34,9 +34,9 @@
|
||||
#include "../DocDocxConverter/Converter.h"
|
||||
#include "../../OfficeUtils/src/OfficeUtils.h"
|
||||
|
||||
HRESULT COfficeDocFile::LoadFromFile(const std::wstring & docFile, const std::wstring & docxDirectory, const std::wstring & password, bool &bMacros, ProgressCallback *ffCallBack)
|
||||
_UINT32 COfficeDocFile::LoadFromFile(const std::wstring & docFile, const std::wstring & docxDirectory, const std::wstring & password, bool &bMacros, ProgressCallback *ffCallBack)
|
||||
{
|
||||
HRESULT hr = S_FALSE;
|
||||
_UINT32 hr = 0;
|
||||
|
||||
DocFileFormat::Converter docToDocx;
|
||||
docToDocx.m_sTempFolder = m_sTempFolder;
|
||||
@ -46,7 +46,7 @@ HRESULT COfficeDocFile::LoadFromFile(const std::wstring & docFile, const std::w
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT COfficeDocFile::SaveToFile (const std::wstring & sDstFileName, const std::wstring & sSrcFileName, ProgressCallback *ffCallBack )
|
||||
_UINT32 COfficeDocFile::SaveToFile (const std::wstring & sDstFileName, const std::wstring & sSrcFileName, ProgressCallback *ffCallBack )
|
||||
{
|
||||
return S_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -53,8 +53,8 @@ public:
|
||||
|
||||
std::wstring m_sTempFolder;
|
||||
|
||||
HRESULT LoadFromFile(const std::wstring & sSrcFileName, const std::wstring & sDstFileName, const std::wstring & password, bool &bMacros, ProgressCallback *ffCallBack = NULL);
|
||||
HRESULT SaveToFile(const std::wstring & sDstFileName, const std::wstring & sSrcFileName, ProgressCallback *ffCallBack = NULL);
|
||||
_UINT32 LoadFromFile(const std::wstring & sSrcFileName, const std::wstring & sDstFileName, const std::wstring & password, bool &bMacros, ProgressCallback *ffCallBack = NULL);
|
||||
_UINT32 SaveToFile(const std::wstring & sDstFileName, const std::wstring & sSrcFileName, ProgressCallback *ffCallBack = NULL);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -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()))
|
||||
|
||||
@ -85,7 +85,7 @@ namespace BinXlsxRW{
|
||||
sMediaPath = pathMediaDir.GetPath();
|
||||
sEmbedPath = pathEmbedDir.GetPath();
|
||||
}
|
||||
int CXlsxSerializer::loadFromFile(const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sMediaDir, const std::wstring& sEmbedDir)
|
||||
_UINT32 CXlsxSerializer::loadFromFile(const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sMediaDir, const std::wstring& sEmbedDir)
|
||||
{
|
||||
std::wstring strFileInDir = NSSystemPath::GetDirectoryName(sSrcFileName);
|
||||
|
||||
@ -100,7 +100,7 @@ namespace BinXlsxRW{
|
||||
BinXlsxRW::BinaryFileReader oBinaryFileReader;
|
||||
return oBinaryFileReader.ReadFile(sSrcFileName, sDstPath, &oDrawingConverter, sXMLOptions);
|
||||
}
|
||||
int CXlsxSerializer::saveToFile(const std::wstring& sDstFileName, const std::wstring& sSrcPath, const std::wstring& sXMLOptions)
|
||||
_UINT32 CXlsxSerializer::saveToFile(const std::wstring& sDstFileName, const std::wstring& sSrcPath, const std::wstring& sXMLOptions)
|
||||
{
|
||||
COfficeFontPicker* pFontPicker = new COfficeFontPicker();
|
||||
pFontPicker->Init(m_sFontDir);
|
||||
@ -136,7 +136,7 @@ namespace BinXlsxRW{
|
||||
oOfficeDrawingConverter.SetFontPicker(pFontPicker);
|
||||
|
||||
BinXlsxRW::BinaryFileWriter oBinaryFileWriter(fp);
|
||||
int result = oBinaryFileWriter.Open(sSrcPath, sDstFileName, pEmbeddedFontsManager, &oOfficeDrawingConverter, sXMLOptions, m_bIsNoBase64);
|
||||
_UINT32 result = oBinaryFileWriter.Open(sSrcPath, sDstFileName, pEmbeddedFontsManager, &oOfficeDrawingConverter, sXMLOptions, m_bIsNoBase64);
|
||||
|
||||
RELEASEOBJECT(pFontPicker);
|
||||
return result;
|
||||
@ -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());
|
||||
}
|
||||
};
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
#define XLSX_SERIALIZER
|
||||
|
||||
#include <string>
|
||||
#include "../../Common/DocxFormat/Source/Base/Types_32.h"
|
||||
|
||||
namespace OOX
|
||||
{
|
||||
@ -62,8 +63,8 @@ namespace BinXlsxRW {
|
||||
|
||||
static void CreateXlsxFolders (const std::wstring& sXmlOptions, const std::wstring& sDstPath, std::wstring& sMediaPath, std::wstring& sEmbedPath);
|
||||
|
||||
int loadFromFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sMediaDir, const std::wstring& sEmbedPath);
|
||||
int saveToFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions);
|
||||
_UINT32 loadFromFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sMediaDir, const std::wstring& sEmbedPath);
|
||||
_UINT32 saveToFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions);
|
||||
|
||||
bool saveChart (NSBinPptxRW::CBinaryFileReader* pReader, long lLength, const std::wstring& sFilename, const long& lChartNumber);
|
||||
|
||||
@ -73,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;
|
||||
|
||||
@ -105,7 +105,7 @@ HRESULT convert_single(std::wstring srcFileName)
|
||||
}
|
||||
_CP_LOG << L"[info] " << srcFileName << std::endl;
|
||||
|
||||
nResult = ConvertODF2OOXml(srcTempPath, dstTempPath, L"C:\\Windows\\Fonts", srcTempPath2, L"password", NULL);
|
||||
nResult = ConvertODF2OOXml(srcTempPath, dstTempPath, L"C:\\Windows\\Fonts", srcTempPath2, L"", NULL);
|
||||
|
||||
if (srcTempPath != srcFileName)
|
||||
{
|
||||
|
||||
@ -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,18 +501,7 @@ 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;
|
||||
}
|
||||
@ -528,20 +509,17 @@ namespace formulasconvert {
|
||||
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(
|
||||
expr,
|
||||
complexRef,
|
||||
&replace_point_space,
|
||||
boost::match_default | boost::format_all);
|
||||
|
||||
boost::regex_replace(
|
||||
workstr,
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -553,13 +531,10 @@ namespace formulasconvert {
|
||||
{
|
||||
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);
|
||||
boost::regex_replace(
|
||||
workstr,
|
||||
boost::wregex(L"('.*?')|(\".*?\")"),
|
||||
&convert_scobci, boost::match_default | boost::format_all);
|
||||
|
||||
//распарсить по диапазонам - одф-пробел, ик-эль-запятая
|
||||
|
||||
@ -591,10 +566,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 +583,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 +681,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 +698,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:
|
||||
@ -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_;
|
||||
@ -72,6 +185,9 @@ std::wstring oox2odf_converter::Impl::table_name_ = L"";
|
||||
|
||||
void oox2odf_converter::Impl::replace_cells_range(std::wstring& expr)
|
||||
{
|
||||
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+\\!)?([\\w^0-9$]*\\d*)\\:?([\\w^0-9$]*\\d*)?");
|
||||
// $ Sheet2 ! $ A1 : $ B5
|
||||
// $ Sheet2 ! $ A : $ A
|
||||
// $ Sheet2 ! $ 1 : $ 1
|
||||
@ -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;
|
||||
}
|
||||
@ -167,7 +286,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 +296,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);
|
||||
|
||||
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 +322,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 +341,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 +373,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 +397,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 +433,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 +451,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 +469,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 +478,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 +507,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 +537,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 +545,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 +557,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 +576,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 +623,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 +710,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);
|
||||
|
||||
@ -310,6 +310,7 @@ typedef xml::writer::element<wchar_t> xml_element;
|
||||
#define CP_XML_WRITER(STRM) if (bool _b_ = false) {} else for (xml_writer _xml_wr_((STRM));!_b_;_b_=true)
|
||||
#define CP_XML_NODE(NAME) if (bool _b_ = false) {} else for (xml_element _xml_node_(_xml_wr_, (NAME));!_b_;_b_=true)
|
||||
#define CP_XML_ATTR(NAME, VAL) _xml_node_.attr((NAME),(VAL))
|
||||
#define CP_XML_ATTR2(NAME, VAL) _xml_node_.attr((std::wstring(NAME).c_str()),(VAL))
|
||||
#define CP_XML_CONTENT(VAL) _xml_node_.contents((VAL))
|
||||
#define CP_XML_STREAM() _xml_node_.stream()
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
|
||||
#include "../include/odf/odf_document.h"
|
||||
|
||||
int ConvertOds2Xlsx(cpdoccore::odf_reader::odf_document & inputOdf, const std::wstring & dstPath, const std::wstring & fontsPath)
|
||||
_UINT32 ConvertOds2Xlsx(cpdoccore::odf_reader::odf_document & inputOdf, const std::wstring & dstPath, const std::wstring & fontsPath)
|
||||
{
|
||||
cpdoccore::oox::package::xlsx_document outputXlsx;
|
||||
cpdoccore::oox::xlsx_conversion_context conversionContext( &inputOdf);
|
||||
@ -56,7 +56,7 @@ int ConvertOds2Xlsx(cpdoccore::odf_reader::odf_document & inputOdf, const std::w
|
||||
outputXlsx.write(dstPath);
|
||||
return 0;
|
||||
}
|
||||
int ConvertOdt2Docx(cpdoccore::odf_reader::odf_document & inputOdf, const std::wstring & dstPath, const std::wstring & fontsPath)
|
||||
_UINT32 ConvertOdt2Docx(cpdoccore::odf_reader::odf_document & inputOdf, const std::wstring & dstPath, const std::wstring & fontsPath)
|
||||
{
|
||||
cpdoccore::oox::package::docx_document outputDocx;
|
||||
cpdoccore::oox::docx_conversion_context conversionContext(&inputOdf);
|
||||
@ -70,7 +70,7 @@ int ConvertOdt2Docx(cpdoccore::odf_reader::odf_document & inputOdf, const std::w
|
||||
|
||||
return 0;
|
||||
}
|
||||
int ConvertOdp2Pptx(cpdoccore::odf_reader::odf_document & inputOdf, const std::wstring & dstPath, const std::wstring & fontsPath)
|
||||
_UINT32 ConvertOdp2Pptx(cpdoccore::odf_reader::odf_document & inputOdf, const std::wstring & dstPath, const std::wstring & fontsPath)
|
||||
{
|
||||
cpdoccore::oox::package::pptx_document outputPptx;
|
||||
cpdoccore::oox::pptx_conversion_context conversionContext(&inputOdf);
|
||||
@ -83,9 +83,9 @@ int ConvertOdp2Pptx(cpdoccore::odf_reader::odf_document & inputOdf, const std::w
|
||||
|
||||
return 0;
|
||||
}
|
||||
int ConvertODF2OOXml(const std::wstring & srcPath, const std::wstring & dstPath, const std::wstring & fontsPath, const std::wstring & tempPath, const std::wstring & password, const ProgressCallback* CallBack)
|
||||
_UINT32 ConvertODF2OOXml(const std::wstring & srcPath, const std::wstring & dstPath, const std::wstring & fontsPath, const std::wstring & tempPath, const std::wstring & password, const ProgressCallback* CallBack)
|
||||
{
|
||||
int nResult = 0;
|
||||
_UINT32 nResult = 0;
|
||||
|
||||
try
|
||||
{
|
||||
@ -134,9 +134,9 @@ int ConvertODF2OOXml(const std::wstring & srcPath, const std::wstring & dstPath,
|
||||
|
||||
}
|
||||
|
||||
int ConvertOTF2ODF(const std::wstring & srcPath)
|
||||
_UINT32 ConvertOTF2ODF(const std::wstring & srcPath)
|
||||
{
|
||||
int nResult = 0;
|
||||
_UINT32 nResult = 0;
|
||||
|
||||
std::wstring manifest_xml = srcPath + FILE_SEPARATOR_STR + L"META-INF" + FILE_SEPARATOR_STR + L"manifest.xml";
|
||||
std::wstring mimetype_xml = srcPath + FILE_SEPARATOR_STR + L"mimetype";
|
||||
|
||||
@ -31,10 +31,11 @@
|
||||
*/
|
||||
|
||||
#include "../../DesktopEditor/common/Types.h"
|
||||
#include "../../Common/DocxFormat/Source/Base/Types_32.h"
|
||||
#include <string>
|
||||
|
||||
struct ProgressCallback;
|
||||
|
||||
int ConvertODF2OOXml(const std::wstring & srcPath, const std::wstring & dstPath, const std::wstring & fontsPath, const std::wstring & tempPath, const std::wstring & password, const ProgressCallback* CallBack);
|
||||
_UINT32 ConvertODF2OOXml(const std::wstring & srcPath, const std::wstring & dstPath, const std::wstring & fontsPath, const std::wstring & tempPath, const std::wstring & password, const ProgressCallback* CallBack);
|
||||
|
||||
int ConvertOTF2ODF(const std::wstring & otfPath);
|
||||
_UINT32 ConvertOTF2ODF(const std::wstring & otfPath);
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -589,12 +589,17 @@ void docx_conversion_context::reset_context_state()
|
||||
state_.in_run_ = false;
|
||||
state_.is_paragraph_keep_ = false;
|
||||
|
||||
state_.drawing_text_props_.clear();
|
||||
state_.text_properties_stack_.clear();
|
||||
|
||||
get_styles_context().text_style_ext().clear();
|
||||
}
|
||||
void docx_conversion_context::back_context_state()
|
||||
{
|
||||
state_ = keep_state_.back();
|
||||
keep_state_.pop_back();
|
||||
|
||||
get_styles_context().text_style_ext().clear();
|
||||
}
|
||||
|
||||
void docx_conversion_context::add_new_run(std::wstring parentStyleId)
|
||||
@ -1756,6 +1761,11 @@ void docx_conversion_context::serialize_list_properties(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
|
||||
void docx_conversion_context::set_drawing_text_props (const std::wstring &props)
|
||||
{
|
||||
get_styles_context().text_style_ext() = props;
|
||||
}
|
||||
|
||||
void docx_conversion_context::add_delayed_element(odf_reader::office_element * Elm)
|
||||
{
|
||||
delayed_elements_.push_back(Elm);
|
||||
|
||||
@ -900,6 +900,8 @@ public:
|
||||
|
||||
table_content_context & get_table_content_context() { return table_content_context_;}
|
||||
|
||||
void set_drawing_text_props (const std::wstring &props);
|
||||
|
||||
void docx_convert_delayed ();
|
||||
void add_delayed_element (odf_reader::office_element * Elm);
|
||||
|
||||
@ -940,10 +942,10 @@ public:
|
||||
void add_alphabetical_index_text (odf_reader::office_element_ptr & elem);
|
||||
|
||||
void set_process_headers_footers(bool Val) { process_headers_footers_ = Val; }
|
||||
headers_footers & get_headers_footers() { return headers_footers_; }
|
||||
|
||||
headers_footers & get_headers_footers() { return headers_footers_; }
|
||||
header_footer_context & get_header_footer_context() { return header_footer_context_; }
|
||||
|
||||
drop_cap_context & get_drop_cap_context(){return drop_cap_context_;}
|
||||
drop_cap_context & get_drop_cap_context() {return drop_cap_context_;}
|
||||
|
||||
styles_map styles_map_;
|
||||
bool process_headers_footers_;
|
||||
@ -962,6 +964,8 @@ private:
|
||||
bool in_run_ = false;
|
||||
bool is_paragraph_keep_ = false;
|
||||
|
||||
std::wstring drawing_text_props_;
|
||||
|
||||
std::vector< const odf_reader::style_text_properties*> text_properties_stack_;
|
||||
}state_;
|
||||
std::vector<_context_state> keep_state_;
|
||||
|
||||
@ -231,7 +231,7 @@ void docx_serialize_image_child(std::wostream & strm, _docx_drawing & val)
|
||||
CP_XML_NODE(L"a:avLst");
|
||||
}
|
||||
|
||||
oox_serialize_ln(CP_XML_STREAM(),val.additional);
|
||||
oox_serialize_ln(CP_XML_STREAM(), val.additional);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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];
|
||||
}
|
||||
|
||||
@ -117,9 +117,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;
|
||||
|
||||
|
||||
@ -171,7 +171,7 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
|
||||
if (content_.dimension_ == L"y")
|
||||
CP_XML_ATTR(L"val",L"l");// "b" | "l" | "r" | "t"// == bottom left right top
|
||||
}
|
||||
//oox_serialize_ln(_Wostream,content_.graphic_properties_);
|
||||
//oox_serialize_ln(_Wostream, content_.graphic_properties_);
|
||||
|
||||
odf_reader::GetProperty(content_.properties_, L"num_format", strVal);
|
||||
odf_reader::GetProperty(content_.properties_, L"link-data-style-to-source", boolVal);
|
||||
|
||||
@ -198,7 +198,9 @@ std::wstringstream & styles_context::list_style()
|
||||
|
||||
void styles_context::docx_serialize_text_style(std::wostream & strm, std::wstring parenStyleId, std::wstring & strChange)
|
||||
{
|
||||
if (!text_style_.str().empty())
|
||||
const std::wstring & text_style_str = text_style_.str();
|
||||
|
||||
if (!text_style_str.empty() || !text_style_ext_.empty())
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
@ -208,14 +210,17 @@ void styles_context::docx_serialize_text_style(std::wostream & strm, std::wstrin
|
||||
{
|
||||
CP_XML_STREAM() << L"<w:rStyle w:val=\"" << parenStyleId << L"\" />";
|
||||
}
|
||||
const std::wstring & test_str = text_style_.str();
|
||||
CP_XML_STREAM() << test_str;
|
||||
CP_XML_STREAM() << text_style_str;
|
||||
|
||||
if (!strChange.empty())//rPrChange
|
||||
{
|
||||
CP_XML_STREAM() << strChange;
|
||||
strChange.clear();
|
||||
}
|
||||
if (!text_style_ext_.empty())
|
||||
{
|
||||
CP_XML_STREAM() << text_style_ext_;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -141,6 +141,7 @@ public:
|
||||
|
||||
std::wstring & extern_node(){return extern_node_;}
|
||||
std::wstring & hlinkClick(){return hlinkClick_;}
|
||||
std::wstring & text_style_ext(){return text_style_ext_;}
|
||||
|
||||
const odf_reader::style_instance * get_current_processed_style() const { return current_processed_style_; }
|
||||
|
||||
@ -152,6 +153,7 @@ private:
|
||||
|
||||
std::wstring extern_node_;
|
||||
std::wstring hlinkClick_;
|
||||
std::wstring text_style_ext_;
|
||||
|
||||
std::wstringstream list_style_;
|
||||
std::wstringstream text_style_;
|
||||
|
||||
@ -108,6 +108,8 @@ static const std::wstring _ooxShapeType[]=
|
||||
L"custGeom",//uses sub-sub type,
|
||||
L"polygon",
|
||||
L"roundRect",
|
||||
L"bentConnector3",
|
||||
L"curvedConnector3"
|
||||
};
|
||||
|
||||
|
||||
@ -124,8 +126,14 @@ static const std::wstring _ooxDashStyle[]=
|
||||
L"sysDashDotDot"
|
||||
};
|
||||
|
||||
void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_property> & prop, bool always_draw)
|
||||
void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_property> & prop, bool always_draw, const std::wstring &ns)
|
||||
{
|
||||
std::wstring ns_att = (ns == L"a" ? L"" : ns + L":");
|
||||
std::wstring ns_node = L"a:ln";
|
||||
|
||||
if (ns == L"w14")
|
||||
ns_node = L"w14:textOutline";
|
||||
|
||||
_CP_OPT(std::wstring) strStrokeColor;
|
||||
_CP_OPT(int) iStroke;
|
||||
_CP_OPT(double) dStrokeWidth;
|
||||
@ -143,30 +151,30 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"a:ln")
|
||||
CP_XML_NODE(ns_node)
|
||||
{
|
||||
std::wstring color, dash_style, fill = L"a:solidFill" ;
|
||||
std::wstring color, dash_style, fill = ns + L":solidFill" ;
|
||||
|
||||
if (strStrokeColor) color = *strStrokeColor;
|
||||
|
||||
if (iStroke)
|
||||
{
|
||||
if (iStroke.get() == 0 || bWordArt) fill = L"a:noFill";
|
||||
if (iStroke.get() == 0 || bWordArt) fill = ns + L":noFill";
|
||||
else dash_style = _ooxDashStyle[iStroke.get()];
|
||||
}
|
||||
|
||||
if ((dStrokeWidth) && (*dStrokeWidth >= 0) && fill != L"a:noFill")
|
||||
if ((dStrokeWidth) && (*dStrokeWidth >= 0) && fill != ns + L":noFill")
|
||||
{
|
||||
int val = dStrokeWidth.get() * 12700; //in emu (1 pt = 12700)
|
||||
if (val < 10) val = 12700;
|
||||
|
||||
CP_XML_ATTR(L"w", val);
|
||||
CP_XML_ATTR2(ns_att + L"w", val);
|
||||
if (color.length()<1)color = L"729FCF";
|
||||
}
|
||||
|
||||
CP_XML_NODE(fill)
|
||||
{
|
||||
if (fill != L"a:noFill")
|
||||
if (fill != ns + L":noFill")
|
||||
{
|
||||
if ( color.empty() )
|
||||
{
|
||||
@ -174,47 +182,49 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
|
||||
else color = L"FFFFFF";
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"a:srgbClr")
|
||||
CP_XML_NODE(ns + L":srgbClr")
|
||||
{
|
||||
CP_XML_ATTR(L"val",color);
|
||||
CP_XML_ATTR2(ns_att + L"val",color);
|
||||
|
||||
if (dStrokeOpacity)
|
||||
{
|
||||
CP_XML_NODE(L"a:alpha")
|
||||
CP_XML_NODE(ns + L":alpha")
|
||||
{
|
||||
CP_XML_ATTR(L"val", (int)(*dStrokeOpacity * 1000));
|
||||
CP_XML_ATTR2(ns_att + L"val", (int)(*dStrokeOpacity * 1000));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fill != L"a:noFill")
|
||||
if (fill != ns + L":noFill")
|
||||
{
|
||||
_CP_OPT(std::wstring) strVal;
|
||||
|
||||
if (dash_style.length() > 0 && dash_style != L"solid")
|
||||
{
|
||||
CP_XML_NODE(L"a:prstDash"){CP_XML_ATTR(L"val", dash_style);}
|
||||
CP_XML_NODE(ns + L":prstDash"){CP_XML_ATTR2(ns_att + L"val", dash_style);}
|
||||
}
|
||||
odf_reader::GetProperty(prop,L"marker-start", strVal);
|
||||
if (strVal)
|
||||
{
|
||||
CP_XML_NODE(L"a:headEnd"){CP_XML_ATTR(L"type", strVal.get());}
|
||||
CP_XML_NODE(ns + L":headEnd"){CP_XML_ATTR2(ns_att + L"type", strVal.get());}
|
||||
}
|
||||
odf_reader::GetProperty(prop,L"marker-end",strVal);
|
||||
if (strVal)
|
||||
{
|
||||
CP_XML_NODE(L"a:tailEnd"){CP_XML_ATTR(L"type",strVal.get());}
|
||||
CP_XML_NODE(ns + L":tailEnd"){CP_XML_ATTR2(ns_att + L"type",strVal.get());}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_property> & prop, const std::wstring & shapeGeomPreset)
|
||||
void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_property> & prop, const std::wstring & shapeGeomPreset, const std::wstring &ns)
|
||||
{
|
||||
std::wstring ns_att = (ns == L"a" ? L"" : ns + L":");
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"a:avLst")
|
||||
CP_XML_NODE(ns + L":avLst")
|
||||
{
|
||||
_CP_OPT(std::wstring) strModifiers;
|
||||
odf_reader::GetProperty(prop, L"oox-draw-modifiers", strModifiers);
|
||||
@ -235,16 +245,16 @@ 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"))
|
||||
{
|
||||
names.push_back(L"hf");
|
||||
names.push_back(L"vf");
|
||||
}
|
||||
//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"))
|
||||
//{
|
||||
// names.push_back(L"hf");
|
||||
// names.push_back(L"vf");
|
||||
//}
|
||||
else if (std::wstring::npos != shapeGeomPreset.find(L"hexagon"))
|
||||
{
|
||||
names.push_back(L"adj");
|
||||
@ -268,20 +278,20 @@ void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_pro
|
||||
{
|
||||
if (values[i].empty()) continue;
|
||||
|
||||
CP_XML_NODE(L"a:gd")
|
||||
CP_XML_NODE(ns + L":gd")
|
||||
{
|
||||
if (names.size() > i)
|
||||
{
|
||||
CP_XML_ATTR(L"name", names[i]);
|
||||
CP_XML_ATTR2(ns_att + L"name", names[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (values.size() > 1)
|
||||
CP_XML_ATTR(L"name", L"adj" + std::to_wstring(i + 1));
|
||||
CP_XML_ATTR2(ns_att + L"name", L"adj" + std::to_wstring(i + 1));
|
||||
else
|
||||
CP_XML_ATTR(L"name", L"adj");
|
||||
CP_XML_ATTR2(ns_att + L"name", L"adj");
|
||||
}
|
||||
CP_XML_ATTR(L"fmla", L"val " + values[i]);
|
||||
CP_XML_ATTR2(ns_att + L"fmla", L"val " + values[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -410,7 +420,7 @@ void _oox_drawing::serialize_shape(std::wostream & strm)
|
||||
shapeGeomPreset = L"rect";
|
||||
}
|
||||
}
|
||||
else if (sub_type < 10 && sub_type >= 0)
|
||||
else if (sub_type <= 12 && sub_type >= 0)
|
||||
{
|
||||
shapeGeomPreset = _ooxShapeType[sub_type]; //odf -> oox
|
||||
}
|
||||
|
||||
@ -118,8 +118,8 @@ namespace oox {
|
||||
};
|
||||
typedef _CP_PTR(_oox_drawing) oox_drawing_ptr;
|
||||
|
||||
void oox_serialize_ln (std::wostream & strm, const std::vector<odf_reader::_property> & val, bool always_draw = false);
|
||||
void oox_serialize_aLst (std::wostream & strm, const std::vector<odf_reader::_property> & val, const std::wstring & shapeGeomPreset);
|
||||
void oox_serialize_ln (std::wostream & strm, const std::vector<odf_reader::_property> & val, bool always_draw = false, const std::wstring &ns = L"a");
|
||||
void oox_serialize_aLst (std::wostream & strm, const std::vector<odf_reader::_property> & val, const std::wstring & shapeGeomPreset, const std::wstring &ns = L"a");
|
||||
void oox_serialize_action (std::wostream & strm, const _action_desc & val);
|
||||
|
||||
}
|
||||
|
||||
@ -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>();}
|
||||
@ -53,55 +53,59 @@ namespace oox {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void oox_serialize_none_fill(std::wostream & strm)
|
||||
void oox_serialize_none_fill(std::wostream & strm, const std::wstring &ns)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"a:noFill");
|
||||
CP_XML_NODE(ns + L":noFill");
|
||||
}
|
||||
}
|
||||
void oox_serialize_srgb(std::wostream & strm,std::wstring color,_CP_OPT(double) opacity)
|
||||
void oox_serialize_srgb(std::wostream & strm, const std::wstring &color,_CP_OPT(double) opacity, const std::wstring &ns)
|
||||
{
|
||||
std::wstring ns_att = (ns == L"a" ? L"" : ns + L":");
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"a:srgbClr")
|
||||
CP_XML_NODE(ns + L":srgbClr")
|
||||
{
|
||||
CP_XML_ATTR(L"val", color);
|
||||
CP_XML_ATTR2(ns_att + L"val", color);
|
||||
if (opacity)
|
||||
{
|
||||
CP_XML_NODE(L"a:alpha")
|
||||
CP_XML_NODE(ns + L":alpha")
|
||||
{
|
||||
CP_XML_ATTR(L"val", std::to_wstring((int)(*opacity)*1000));// + L"%");
|
||||
CP_XML_ATTR2(ns_att + L"val", std::to_wstring((int)(*opacity)*1000));// + L"%");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void oox_serialize_srgb(std::wostream & strm,std::wstring color,_CP_OPT(odf_types::percent) opacity)
|
||||
void oox_serialize_srgb(std::wostream & strm, const std::wstring &color, _CP_OPT(odf_types::percent) opacity, const std::wstring &ns)
|
||||
{
|
||||
std::wstring ns_att = (ns == L"a" ? L"" : ns + L":");
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"a:srgbClr")
|
||||
CP_XML_NODE(ns + L":srgbClr")
|
||||
{
|
||||
CP_XML_ATTR(L"val",color);
|
||||
CP_XML_ATTR2(ns_att + L"val",color);
|
||||
if (opacity)
|
||||
{
|
||||
CP_XML_NODE(L"a:alpha")
|
||||
CP_XML_NODE(ns + L":alpha")
|
||||
{
|
||||
CP_XML_ATTR(L"val", std::to_wstring((int)opacity->get_value()*1000));// + L"%");
|
||||
CP_XML_ATTR2(ns_att + L"val", std::to_wstring((int)opacity->get_value() * 1000));// + L"%");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void oox_serialize_solid_fill(std::wostream & strm, const _oox_fill & val)
|
||||
void oox_serialize_solid_fill(std::wostream & strm, const _oox_fill & val, const std::wstring &ns)
|
||||
{
|
||||
if (!val.solid)return;
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"a:solidFill")
|
||||
CP_XML_NODE(ns + L":solidFill")
|
||||
{
|
||||
oox_serialize_srgb(CP_XML_STREAM(), val.solid->color, val.opacity);
|
||||
oox_serialize_srgb(CP_XML_STREAM(), val.solid->color, val.opacity, ns);
|
||||
}
|
||||
|
||||
}
|
||||
@ -151,20 +155,25 @@ void vml_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
|
||||
}
|
||||
}
|
||||
}
|
||||
void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
|
||||
void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val, const std::wstring &ns)
|
||||
{
|
||||
if (!val.bitmap) return;
|
||||
|
||||
std::wstring ns_att = (ns == L"a" ? L"" : ns + L":");
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(std::wstring(val.bitmap->name_space + L":blipFill"))
|
||||
{
|
||||
//if (val.bitmap->rotate) CP_XML_ATTR(L"a:rotWithShape",*(val.bitmap->rotate));
|
||||
//else CP_XML_ATTR(L"a:rotWithShape",1);
|
||||
//if (val.bitmap->rotate) CP_XML_ATTR(ns + L":rotWithShape",*(val.bitmap->rotate));
|
||||
//else CP_XML_ATTR(ns + L":rotWithShape",1);
|
||||
|
||||
if (val.bitmap->dpi) CP_XML_ATTR(L"a:dpi", *val.bitmap->dpi);
|
||||
if (val.bitmap->dpi)
|
||||
{
|
||||
CP_XML_ATTR2(ns + L":dpi", *val.bitmap->dpi);
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"a:blip")
|
||||
CP_XML_NODE(ns + L":blip")
|
||||
{
|
||||
if (val.bitmap->isInternal)
|
||||
{
|
||||
@ -176,38 +185,42 @@ void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
|
||||
|
||||
if (val.opacity)
|
||||
{
|
||||
CP_XML_NODE(L"a:alphaModFix")
|
||||
CP_XML_NODE(ns + L":alphaModFix")
|
||||
{
|
||||
CP_XML_ATTR(L"amt",(int)(*val.opacity * 1000));
|
||||
CP_XML_ATTR2(ns_att + L"amt", (int)(*val.opacity * 1000));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (val.bitmap->bGrayscale)
|
||||
{
|
||||
CP_XML_NODE(ns + L":grayscl");
|
||||
}
|
||||
}
|
||||
if (val.bitmap->bCrop)
|
||||
{
|
||||
CP_XML_NODE(L"a:srcRect")
|
||||
CP_XML_NODE(ns + L":srcRect")
|
||||
{
|
||||
CP_XML_ATTR(L"l", static_cast<int>(val.bitmap->cropRect[0]*1000));
|
||||
CP_XML_ATTR(L"t", static_cast<int>(val.bitmap->cropRect[1]*1000));
|
||||
CP_XML_ATTR(L"r", static_cast<int>(val.bitmap->cropRect[2]*1000));
|
||||
CP_XML_ATTR(L"b", static_cast<int>(val.bitmap->cropRect[3]*1000));
|
||||
CP_XML_ATTR2(ns_att + L"l", static_cast<int>(val.bitmap->cropRect[0]*1000));
|
||||
CP_XML_ATTR2(ns_att + L"t", static_cast<int>(val.bitmap->cropRect[1]*1000));
|
||||
CP_XML_ATTR2(ns_att + L"r", static_cast<int>(val.bitmap->cropRect[2]*1000));
|
||||
CP_XML_ATTR2(ns_att + L"b", static_cast<int>(val.bitmap->cropRect[3]*1000));
|
||||
}
|
||||
}
|
||||
if (val.bitmap->bTile)
|
||||
{
|
||||
CP_XML_NODE(L"a:tile")
|
||||
CP_XML_NODE(ns + L":tile")
|
||||
{
|
||||
//tx="0" ty="0" sx="100000" sy="100000"
|
||||
CP_XML_ATTR(L"flip", "none");
|
||||
CP_XML_ATTR(L"algn", L"ctr");
|
||||
CP_XML_ATTR2(ns_att + L"flip", "none");
|
||||
CP_XML_ATTR2(ns_att + L"algn", L"ctr");
|
||||
}
|
||||
}
|
||||
else if (val.bitmap->bStretch)
|
||||
{
|
||||
CP_XML_NODE(L"a:stretch")
|
||||
CP_XML_NODE(ns + L":stretch")
|
||||
{
|
||||
if (!val.bitmap->bCrop)
|
||||
{
|
||||
CP_XML_NODE(L"a:fillRect");
|
||||
CP_XML_NODE(ns + L":fillRect");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -269,25 +282,27 @@ void vml_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val)
|
||||
}
|
||||
}
|
||||
}
|
||||
void oox_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val)
|
||||
void oox_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val, const std::wstring &ns)
|
||||
{
|
||||
if (!val.gradient) return;
|
||||
|
||||
std::wstring ns_att = (ns == L"a" ? L"" : ns + L":");
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"a:gradFill")
|
||||
CP_XML_NODE(ns + L":gradFill")
|
||||
{
|
||||
if (val.gradient->colors.size()>0)
|
||||
{
|
||||
CP_XML_NODE(L"a:gsLst")
|
||||
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(L"a:gs")
|
||||
CP_XML_NODE(ns + L":gs")
|
||||
{
|
||||
CP_XML_ATTR(L"pos", (int)(col.pos * 1000));//%
|
||||
oox_serialize_srgb(CP_XML_STREAM(), col.color_ref, col.opacity);
|
||||
CP_XML_ATTR2(ns_att + L"pos", (int)(col.pos * 1000));//%
|
||||
oox_serialize_srgb(CP_XML_STREAM(), col.color_ref, col.opacity, ns);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -298,25 +313,25 @@ void oox_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val)
|
||||
switch(val.gradient->style)
|
||||
{
|
||||
case 0:
|
||||
CP_XML_NODE(L"a:lin")
|
||||
CP_XML_NODE(ns + L":lin")
|
||||
{
|
||||
CP_XML_ATTR(L"ang",(int)angle);//gr in rad
|
||||
CP_XML_ATTR2(ns_att + L"ang",(int)angle);//gr in rad
|
||||
}break;
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
CP_XML_NODE(L"a:path")
|
||||
CP_XML_NODE(ns + L":path")
|
||||
{
|
||||
if (val.gradient->style == 1) CP_XML_ATTR(L"path", L"rect");
|
||||
if (val.gradient->style == 2) CP_XML_ATTR(L"path", L"circle");
|
||||
if (val.gradient->style == 3) CP_XML_ATTR(L"path", L"shape");
|
||||
if (val.gradient->style == 1) CP_XML_ATTR2(ns_att + L"path", L"rect");
|
||||
if (val.gradient->style == 2) CP_XML_ATTR2(ns_att + L"path", L"circle");
|
||||
if (val.gradient->style == 3) CP_XML_ATTR2(ns_att + L"path", L"shape");
|
||||
|
||||
CP_XML_NODE(L"a:fillToRect")
|
||||
CP_XML_NODE(ns + L":fillToRect")
|
||||
{
|
||||
CP_XML_ATTR(L"l", (int)(val.gradient->rect[0] * 1000));
|
||||
CP_XML_ATTR(L"t", (int)(val.gradient->rect[1] * 1000));
|
||||
CP_XML_ATTR(L"r", (int)(val.gradient->rect[2] * 1000));
|
||||
CP_XML_ATTR(L"b", (int)(val.gradient->rect[3] * 1000));
|
||||
CP_XML_ATTR2(ns_att + L"l", (int)(val.gradient->rect[0] * 1000));
|
||||
CP_XML_ATTR2(ns_att + L"t", (int)(val.gradient->rect[1] * 1000));
|
||||
CP_XML_ATTR2(ns_att + L"r", (int)(val.gradient->rect[2] * 1000));
|
||||
CP_XML_ATTR2(ns_att + L"b", (int)(val.gradient->rect[3] * 1000));
|
||||
}
|
||||
}break;
|
||||
}
|
||||
@ -324,22 +339,24 @@ void oox_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val)
|
||||
//tileRect (Tile Rectangle) §20.1.8.59
|
||||
}
|
||||
}
|
||||
void oox_serialize_hatch_fill(std::wostream & strm, const _oox_fill & val)
|
||||
void oox_serialize_hatch_fill(std::wostream & strm, const _oox_fill & val, const std::wstring &ns)
|
||||
{
|
||||
if (!val.hatch)return;
|
||||
|
||||
std::wstring ns_att = (ns == L"a" ? L"" : ns + L":");
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"a:pattFill")
|
||||
CP_XML_NODE(ns + L":pattFill")
|
||||
{
|
||||
CP_XML_ATTR(L"prst",val.hatch->preset);
|
||||
CP_XML_NODE(L"a:fgClr")//опять для ms важно что этот цвет перед back
|
||||
CP_XML_ATTR2(ns_att + L"prst", val.hatch->preset);
|
||||
CP_XML_NODE(ns + L":fgClr")//опять для ms важно что этот цвет перед back
|
||||
{
|
||||
oox_serialize_srgb(CP_XML_STREAM(), val.hatch->color_ref, val.opacity);
|
||||
}
|
||||
if (val.hatch->color_back_ref)
|
||||
{
|
||||
CP_XML_NODE(L"a:bgClr")
|
||||
CP_XML_NODE(ns + L":bgClr")
|
||||
{
|
||||
oox_serialize_srgb(CP_XML_STREAM(), *val.hatch->color_back_ref ,val.opacity);
|
||||
}
|
||||
@ -379,23 +396,23 @@ void vml_serialize_background (std::wostream & strm, const _oox_fill & val, cons
|
||||
}
|
||||
}
|
||||
|
||||
void oox_serialize_fill (std::wostream & strm, const _oox_fill & val)
|
||||
void oox_serialize_fill (std::wostream & strm, const _oox_fill & val, const std::wstring &ns)
|
||||
{
|
||||
switch (val.type)
|
||||
{
|
||||
case 0:
|
||||
oox_serialize_none_fill(strm);
|
||||
oox_serialize_none_fill(strm, ns);
|
||||
break;
|
||||
case 1:
|
||||
oox_serialize_solid_fill(strm, val);
|
||||
oox_serialize_solid_fill(strm, val, ns);
|
||||
break;
|
||||
case 2:
|
||||
oox_serialize_bitmap_fill(strm, val);
|
||||
oox_serialize_bitmap_fill(strm, val, ns);
|
||||
break;
|
||||
case 3:
|
||||
oox_serialize_gradient_fill(strm, val);
|
||||
oox_serialize_gradient_fill(strm, val, ns);
|
||||
break;
|
||||
case 4: oox_serialize_hatch_fill(strm, val);
|
||||
case 4: oox_serialize_hatch_fill(strm, val, ns);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,6 +70,7 @@ namespace oox {
|
||||
bool bStretch;
|
||||
bool bCrop;
|
||||
bool bTile;
|
||||
bool bGrayscale;
|
||||
|
||||
double cropRect[4];//0-left, 1 -top, 2- right, 3 - bottom
|
||||
|
||||
@ -143,10 +144,12 @@ namespace oox {
|
||||
}
|
||||
};
|
||||
|
||||
void vml_serialize_background (std::wostream & strm, const _oox_fill & val, const std::wstring & color, int id);
|
||||
void oox_serialize_fill (std::wostream & strm, const _oox_fill & val);
|
||||
void oox_serialize_srgb (std::wostream & strm,std::wstring color,_CP_OPT(double) opacity);
|
||||
void oox_serialize_srgb (std::wostream & strm,std::wstring color,_CP_OPT(odf_types::percent) opacity);
|
||||
void oox_serialize_bitmap_fill (std::wostream & strm, const _oox_fill & val);
|
||||
void vml_serialize_background (std::wostream & strm, const _oox_fill & val, const std::wstring &color, int id);
|
||||
|
||||
void oox_serialize_srgb (std::wostream & strm, const std::wstring &color, _CP_OPT(double) opacity, const std::wstring &ns = L"a");
|
||||
void oox_serialize_srgb (std::wostream & strm, const std::wstring &color, _CP_OPT(odf_types::percent) opacity, const std::wstring &ns = L"a");
|
||||
void oox_serialize_bitmap_fill (std::wostream & strm, const _oox_fill & val, const std::wstring &ns = L"a");
|
||||
|
||||
void oox_serialize_fill (std::wostream & strm, const _oox_fill & val, const std::wstring &ns = L"a");
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
@ -274,7 +274,7 @@ void pptx_serialize_chart(std::wostream & strm, _pptx_drawing & val)
|
||||
}
|
||||
val.serialize_xfrm(CP_XML_STREAM(), L"p", true);
|
||||
|
||||
//oox_serialize_ln(CP_XML_STREAM(),val.additional);
|
||||
//oox_serialize_ln(CP_XML_STREAM(), val.additional);
|
||||
|
||||
CP_XML_NODE(L"a:graphic")
|
||||
{
|
||||
@ -311,7 +311,7 @@ void pptx_serialize_table(std::wostream & strm, _pptx_drawing & val)
|
||||
}
|
||||
val.serialize_xfrm(CP_XML_STREAM(), L"p", true);
|
||||
|
||||
//oox_serialize_ln(CP_XML_STREAM(),val.additional);
|
||||
//oox_serialize_ln(CP_XML_STREAM(), val.additional);
|
||||
|
||||
CP_XML_NODE(L"a:graphic")
|
||||
{
|
||||
@ -352,7 +352,7 @@ void pptx_serialize_object(std::wostream & strm, _pptx_drawing & val)
|
||||
}
|
||||
val.serialize_xfrm(CP_XML_STREAM(), L"p", true);
|
||||
|
||||
//oox_serialize_ln(CP_XML_STREAM(),val.additional);
|
||||
//oox_serialize_ln(CP_XML_STREAM(), val.additional);
|
||||
|
||||
CP_XML_NODE(L"a:graphic")
|
||||
{
|
||||
|
||||
@ -538,8 +538,11 @@ 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;
|
||||
|
||||
GetProperty(obj.additional_, L"text-content", sTextContent);
|
||||
GetProperty(obj.additional_, L"color-mode", sColorMode);
|
||||
|
||||
if (sTextContent)//в ms office на картинке нельзя сделать надпись - меняем тип на рект с заливкой картинкой
|
||||
{
|
||||
drawing.type = typeShape;
|
||||
@ -549,6 +552,9 @@ 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->bStretch = true;
|
||||
|
||||
if ((sColorMode) && (*sColorMode == L"greyscale"))
|
||||
drawing.fill.bitmap->bGrayscale = true;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
std::wstring ref;/// это ссылка на выходной внешний объект
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -252,7 +252,7 @@ void xlsx_serialize_chart(std::wostream & strm, _xlsx_drawing & val)
|
||||
CP_XML_NODE(L"xdr:cNvGraphicFramePr");
|
||||
}
|
||||
val.serialize_xfrm(CP_XML_STREAM(), L"xdr");
|
||||
//oox_serialize_ln(CP_XML_STREAM(),val.additional);
|
||||
//oox_serialize_ln(CP_XML_STREAM(), val.additional);
|
||||
|
||||
CP_XML_NODE(L"a:graphic")
|
||||
{
|
||||
|
||||
@ -202,20 +202,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 +256,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 +539,10 @@ 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);
|
||||
|
||||
if (sTextContent)//в ms office на картинке нельзя сделать надпись - меняем тип на рект с заливкой картинкой
|
||||
{
|
||||
@ -546,6 +554,9 @@ void xlsx_drawing_context::process_image(drawing_object_description & obj, _xlsx
|
||||
drawing.fill.bitmap->bCrop = odf_reader::parse_clipping(obj.clipping_string_, fileName, drawing.fill.bitmap->cropRect, NULL/*applicationFonts_*/);
|
||||
drawing.fill.bitmap->bStretch = true;
|
||||
|
||||
if ((sColorMode) && (*sColorMode == L"greyscale"))
|
||||
drawing.fill.bitmap->bGrayscale = true;
|
||||
|
||||
std::wstring ref;/// это ссылка на выходной внешний объект
|
||||
bool isMediaInternal = false;
|
||||
|
||||
|
||||
@ -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];
|
||||
|
||||
|
||||
@ -52,6 +52,7 @@ public:
|
||||
std::wstringstream hyperlinks_;
|
||||
std::wstringstream comments_;
|
||||
std::wstringstream sort_;
|
||||
std::wstringstream tableParts_;
|
||||
std::wstringstream autofilter_;
|
||||
std::wstringstream conditionalFormatting_;
|
||||
std::wstringstream picture_background_;
|
||||
@ -99,16 +100,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_;
|
||||
@ -215,6 +218,13 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
CP_XML_ATTR(L"r:id",impl_->vml_drawingId_);
|
||||
}
|
||||
}
|
||||
if (!impl_->tableParts_.str().empty())
|
||||
{
|
||||
CP_XML_NODE(L"tableParts")
|
||||
{
|
||||
CP_XML_STREAM() << impl_->tableParts_.str();
|
||||
}
|
||||
}
|
||||
if (!impl_->ole_objects_.str().empty())
|
||||
{
|
||||
CP_XML_NODE(L"oleObjects")
|
||||
|
||||
@ -60,6 +60,7 @@ public:
|
||||
std::wostream & drawing();
|
||||
std::wostream & comments();
|
||||
std::wostream & autofilter();
|
||||
std::wostream & tableParts();
|
||||
std::wostream & conditionalFormatting();
|
||||
std::wostream & picture_background();
|
||||
std::wostream & dataValidations();
|
||||
|
||||
@ -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());
|
||||
@ -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:
|
||||
@ -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_;
|
||||
|
||||
@ -540,7 +540,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;
|
||||
}
|
||||
}
|
||||
@ -772,7 +772,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 +815,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 +1470,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];
|
||||
|
||||
|
||||
@ -134,10 +134,21 @@ 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)
|
||||
|
||||
{
|
||||
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) && (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;
|
||||
}
|
||||
}
|
||||
|
||||
void xlsx_table_state::start_column(unsigned int repeated, const std::wstring & defaultCellStyleName)
|
||||
@ -149,6 +160,11 @@ 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;
|
||||
}
|
||||
|
||||
unsigned int xlsx_table_state::columns_count() const
|
||||
{
|
||||
return columns_count_;
|
||||
@ -195,7 +211,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 +240,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 +257,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)
|
||||
@ -421,6 +437,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 +477,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.
|
||||
|
||||
@ -53,6 +53,36 @@ 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_values;
|
||||
typedef _CP_PTR(xlsx_data_range_values) xlsx_data_range_values_ptr;
|
||||
|
||||
class xlsx_data_range_values
|
||||
{
|
||||
public:
|
||||
xlsx_data_range_values(size_t row, size_t col1, size_t col2) : withHeader(false), filter(false), row_header(row), start_column(col1), end_column(col2)
|
||||
{
|
||||
for (size_t i = start_column; i <= end_column; i++)
|
||||
values.push_back(L"");
|
||||
}
|
||||
|
||||
size_t row_header;
|
||||
size_t start_column;
|
||||
size_t end_column;
|
||||
|
||||
bool withHeader;
|
||||
bool filter;
|
||||
|
||||
std::vector<std::wstring> values;
|
||||
|
||||
void set_value(size_t col, size_t row, const std::wstring& value)
|
||||
{
|
||||
while (col - start_column + 1 >= values.size())
|
||||
values.push_back(L"");
|
||||
|
||||
values[col - start_column] = value;
|
||||
}
|
||||
bool in_range(size_t col, size_t row) {return (row_header == row && (col >= start_column && col <= end_column));}
|
||||
};
|
||||
|
||||
class xlsx_data_range
|
||||
{
|
||||
@ -70,7 +100,7 @@ public:
|
||||
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);
|
||||
@ -82,6 +112,8 @@ 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 start_column (unsigned int repeated, const std::wstring & defaultCellStyleName);
|
||||
void start_row (const std::wstring & StyleName, const std::wstring & defaultCellStyleName);
|
||||
@ -92,8 +124,8 @@ public:
|
||||
|
||||
void add_empty_row(int count);
|
||||
|
||||
void set_end_table(){ bEndTable = true; }
|
||||
bool get_end_table(){ return bEndTable; }
|
||||
void set_end_table(){ bEndTable_ = true; }
|
||||
bool get_end_table(){ return bEndTable_; }
|
||||
|
||||
std::wstring current_row_style () const;
|
||||
std::wstring default_row_cell_style () const;
|
||||
@ -147,17 +179,18 @@ public:
|
||||
|
||||
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;
|
||||
bool bRTL_;
|
||||
bool bEndTable_;
|
||||
xlsx_conversion_context * context_;
|
||||
|
||||
std::wstring tableName_;
|
||||
|
||||
@ -66,11 +66,11 @@ void xlsx_table_context::start_database_range(std::wstring tableName, std::wstri
|
||||
ref = convert.convert_named_ref(ref);
|
||||
|
||||
std::wstring ref1, ref2;
|
||||
int pos = ref.find(L":");
|
||||
size_t pos = 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;
|
||||
@ -90,13 +90,15 @@ void xlsx_table_context::start_database_range(std::wstring tableName, std::wstri
|
||||
|
||||
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);
|
||||
getCellAddressInv(ref1, col1, row1);
|
||||
xlsx_data_ranges_.back()->cell_start = std::pair<int, int>(col1, row1);
|
||||
|
||||
getCellAddressInv(ref2, col, row);
|
||||
xlsx_data_ranges_.back()->cell_end = std::pair<int, int>(col,row);
|
||||
getCellAddressInv(ref2, col2, row2);
|
||||
xlsx_data_ranges_.back()->cell_end = std::pair<int, int>(col2, row2);
|
||||
|
||||
xlsx_data_ranges_values_.push_back(xlsx_data_range_values_ptr(new xlsx_data_range_values(row1, col1, col2)));
|
||||
}
|
||||
|
||||
if (!xlsx_table_name.empty())
|
||||
@ -117,17 +119,42 @@ void xlsx_table_context::set_database_header (bool val)
|
||||
if (xlsx_data_ranges_.empty()) return;
|
||||
|
||||
xlsx_data_ranges_.back()->withHeader = val;
|
||||
xlsx_data_ranges_values_.back()->withHeader = val;
|
||||
}
|
||||
void xlsx_table_context::set_database_filter (bool val)
|
||||
{
|
||||
if (xlsx_data_ranges_.empty()) return;
|
||||
|
||||
xlsx_data_ranges_.back()->filter = val;
|
||||
xlsx_data_ranges_values_.back()->filter = val;
|
||||
}
|
||||
void xlsx_table_context::end_database_range()
|
||||
{
|
||||
}
|
||||
|
||||
void xlsx_table_context::set_database_range_value(int index, const std::wstring& value)
|
||||
{
|
||||
size_t col = state()->current_column();
|
||||
size_t row = state()->current_row();
|
||||
|
||||
xlsx_data_ranges_values_[index]->set_value(col, row, value);
|
||||
}
|
||||
|
||||
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_values_.size(); i++)
|
||||
{
|
||||
if ((xlsx_data_ranges_values_[i]->withHeader || xlsx_data_ranges_values_[i]->filter)
|
||||
&& xlsx_data_ranges_values_[i]->in_range(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 ));
|
||||
@ -258,6 +285,83 @@ void xlsx_table_context::serialize_sort(std::wostream & _Wostream)
|
||||
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()->tableName_);
|
||||
|
||||
for (std::multimap<std::wstring, int>::iterator it = range.first; it != range.second; ++it)
|
||||
{
|
||||
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]->table_name);
|
||||
CP_XML_ATTR(L"displayName", xlsx_data_ranges_[it->second]->table_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_values_[it->second]->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;
|
||||
|
||||
@ -82,6 +82,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);
|
||||
@ -119,15 +120,17 @@ public:
|
||||
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);
|
||||
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::vector<xlsx_data_range_values_ptr> xlsx_data_ranges_values_;
|
||||
|
||||
std::multimap<std::wstring, int> xlsx_data_ranges_map_;
|
||||
std::multimap<std::wstring, int> xlsx_data_ranges_map_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -71,7 +71,7 @@ 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_)
|
||||
@ -79,6 +79,8 @@ xlsx_conversion_context::xlsx_conversion_context(odf_reader::odf_document * odfD
|
||||
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;
|
||||
@ -201,6 +203,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 +237,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();
|
||||
@ -436,8 +476,9 @@ 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_autofilter (current_sheet().autofilter());
|
||||
get_table_context().serialize_sort (current_sheet().sort());
|
||||
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());
|
||||
|
||||
@ -502,6 +543,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,19 +702,36 @@ 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));
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -160,6 +162,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,6 +200,7 @@ public:
|
||||
|
||||
mediaitems & get_mediaitems() { return mediaitems_; }
|
||||
|
||||
static std::unordered_map<std::wstring, int> mapExternalLink_;
|
||||
private:
|
||||
void create_new_sheet (std::wstring const & name);
|
||||
|
||||
@ -206,15 +215,16 @@ private:
|
||||
|
||||
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 +237,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 },
|
||||
@ -222,7 +222,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 },
|
||||
|
||||
@ -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")
|
||||
{
|
||||
|
||||
@ -284,7 +284,7 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr
|
||||
|
||||
point.pos = 0;
|
||||
if (image_style->draw_start_color_) point.color_ref = image_style->draw_start_color_->get_hex_value();
|
||||
if (image_style->draw_start_intensity_) point.opacity = image_style->draw_start_intensity_->get_value();
|
||||
//if (image_style->draw_start_intensity_) point.opacity = image_style->draw_start_intensity_->get_value();
|
||||
|
||||
fill->colors.push_back(point);
|
||||
|
||||
@ -300,7 +300,7 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr
|
||||
|
||||
point.pos = 0;
|
||||
if (image_style->draw_end_color_) point.color_ref = image_style->draw_end_color_->get_hex_value();
|
||||
if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
|
||||
//if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
|
||||
|
||||
fill->colors.push_back(point);
|
||||
|
||||
@ -312,7 +312,7 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr
|
||||
|
||||
point.pos = 100;
|
||||
if (image_style->draw_end_color_) point.color_ref = image_style->draw_end_color_->get_hex_value();
|
||||
if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
|
||||
//if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
|
||||
|
||||
fill->colors.push_back(point);
|
||||
}break;
|
||||
@ -328,13 +328,13 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr
|
||||
|
||||
point.pos = 0;
|
||||
if (image_style->draw_start_color_) point.color_ref = image_style->draw_start_color_->get_hex_value();
|
||||
if (image_style->draw_start_intensity_) point.opacity = image_style->draw_start_intensity_->get_value();
|
||||
//if (image_style->draw_start_intensity_) point.opacity = image_style->draw_start_intensity_->get_value();
|
||||
|
||||
fill->colors.push_back(point);
|
||||
|
||||
point.pos = 100;
|
||||
if (image_style->draw_end_color_) point.color_ref = image_style->draw_end_color_->get_hex_value();
|
||||
if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
|
||||
//if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
|
||||
|
||||
fill->colors.push_back(point);
|
||||
|
||||
@ -475,6 +475,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_)
|
||||
{
|
||||
|
||||
@ -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 {
|
||||
@ -295,50 +296,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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -327,7 +327,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,14 +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);
|
||||
@ -874,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();
|
||||
}
|
||||
|
||||
}
|
||||
@ -896,7 +896,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, union_comm
|
||||
//////////////////////////////////////////
|
||||
bool bTxbx = (drawing->sub_type == 1);
|
||||
|
||||
Compute_GraphicFill(graphicProperties.common_draw_fill_attlist_, graphicProperties.style_background_image_, Context.root()->odf_context().drawStyles() ,drawing->fill, bTxbx);
|
||||
Compute_GraphicFill(graphicProperties.common_draw_fill_attlist_, graphicProperties.style_background_image_, Context.root()->odf_context().drawStyles(),drawing->fill, bTxbx);
|
||||
|
||||
if ((drawing->fill.bitmap) && (drawing->fill.bitmap->rId.empty()))
|
||||
{
|
||||
@ -1038,9 +1038,11 @@ void draw_shape::docx_convert(oox::docx_conversion_context & Context)
|
||||
drawing.sub_type = sub_type_;
|
||||
drawing.additional = additional_;//сюда могут добавиться свойства ...
|
||||
|
||||
if (drawing.sub_type !=5 )//line
|
||||
if (drawing.sub_type != 5 &&
|
||||
drawing.sub_type != 11 &&
|
||||
drawing.sub_type != 12 )//line, connectors
|
||||
{
|
||||
drawing.additional.push_back(_property(L"text-content",Context.get_drawing_context().get_text_stream_shape()));
|
||||
drawing.additional.push_back(_property(L"text-content", Context.get_drawing_context().get_text_stream_shape()));
|
||||
}
|
||||
|
||||
Context.get_drawing_context().clear_stream_shape();
|
||||
@ -1055,7 +1057,7 @@ void draw_shape::docx_convert(oox::docx_conversion_context & Context)
|
||||
bad_shape_ = false;
|
||||
}
|
||||
|
||||
if (drawing.fill.type < 1 && !IsExistProperty(drawing.additional,L"stroke"))//бывает что и не определено ничего
|
||||
if (drawing.fill.type < 1 && !IsExistProperty(drawing.additional, L"stroke"))//бывает что и не определено ничего
|
||||
{
|
||||
drawing.fill.solid = oox::oox_solid_fill::create();
|
||||
drawing.fill.solid->color = L"729FCF";
|
||||
@ -1636,18 +1638,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)
|
||||
{
|
||||
|
||||
@ -384,7 +384,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)
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -69,7 +69,14 @@ void draw_shape_attlist::add_attributes( const xml::attributes_wc_ptr & Attribut
|
||||
|
||||
void draw_shape::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
if CP_CHECK_NAME(L"draw", L"enhanced-geometry")
|
||||
{
|
||||
CP_CREATE_ELEMENT(enhanced_geometry_);
|
||||
}
|
||||
else
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
}
|
||||
void draw_shape::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
@ -539,9 +546,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++)
|
||||
{
|
||||
@ -555,7 +562,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)
|
||||
{
|
||||
@ -565,7 +572,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
|
||||
}
|
||||
@ -642,17 +649,15 @@ 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; //коннектор - линия, если ломаная (ниже определяется) - то путь
|
||||
|
||||
}
|
||||
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;
|
||||
|
||||
@ -700,7 +705,7 @@ void dr3d_scene::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
draw_shape::add_attributes(Attributes);
|
||||
|
||||
sub_type_ = 10;
|
||||
sub_type_ = 12;
|
||||
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
|
||||
@ -85,7 +85,8 @@ public:
|
||||
odf_types::common_xlink_attlist xlink_attlist_;
|
||||
_CP_OPT(std::wstring) draw_id_; //используется для анимашек
|
||||
|
||||
office_element_ptr_array content_;
|
||||
office_element_ptr_array content_;
|
||||
office_element_ptr enhanced_geometry_;
|
||||
|
||||
bool bad_shape_;
|
||||
bool word_art_;
|
||||
|
||||
@ -72,34 +72,66 @@ void draw_shape::common_docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
Context.get_drawing_context().add_name_object(name.get_value_or(L"Shape"));
|
||||
|
||||
//////////////////////////////на другом контексте
|
||||
//---------------------------сначала элементы графики потом все остальное
|
||||
if (enhanced_geometry_)
|
||||
enhanced_geometry_->docx_convert(Context);
|
||||
|
||||
//---------------------------на другом контексте
|
||||
//тут может быть не только текст , но и таблицы, другие объекты ...
|
||||
oox::StreamsManPtr prev = Context.get_stream_man();
|
||||
|
||||
std::wstringstream temp_stream(Context.get_drawing_context().get_text_stream_shape());
|
||||
Context.set_stream_man( boost::shared_ptr<oox::streams_man>( new oox::streams_man(temp_stream) ));
|
||||
|
||||
//сначала элементы графики потом все остальное
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
ElementType type = content_[i]->get_type();
|
||||
|
||||
if (type == typeDrawCustomShape) // || ....
|
||||
{
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
}
|
||||
Context.reset_context_state();
|
||||
|
||||
if (word_art_)
|
||||
{
|
||||
const std::wstring styleName = common_draw_attlists_.shape_with_text_and_styles_.
|
||||
common_shape_draw_attlist_.draw_style_name_.get_value_or(L"");
|
||||
|
||||
style_instance* styleInst = Context.root()->odf_context().styleContainer().style_by_name(styleName, odf_types::style_family::Graphic,Context.process_headers_footers_);
|
||||
style_content * content = styleInst ? styleInst->content() : NULL;
|
||||
graphic_format_properties * graphicProp = content ? content->get_graphic_properties() : NULL;
|
||||
|
||||
if (graphicProp)
|
||||
{
|
||||
oox::_oox_fill fill;
|
||||
Compute_GraphicFill(graphicProp->common_draw_fill_attlist_, graphicProp->style_background_image_,
|
||||
Context.root()->odf_context().drawStyles(), fill);
|
||||
if ((fill.bitmap) && (fill.bitmap->rId.empty()))
|
||||
{
|
||||
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;
|
||||
oox::oox_serialize_fill(strm_fill, fill, L"w14");
|
||||
std::wstring textFill = strm_fill.str();
|
||||
|
||||
std::vector<_property> props;
|
||||
graphicProp->apply_to(props);
|
||||
|
||||
oox::oox_serialize_ln(strm_ln, props, false, L"w14");
|
||||
std::wstring textLn = strm_ln.str();
|
||||
|
||||
std::wstring text_props;
|
||||
if (!textLn.empty())
|
||||
{
|
||||
text_props += textLn;
|
||||
}
|
||||
if (!textFill.empty())
|
||||
{
|
||||
text_props += L"<w14:textFill>" + textFill + L"</w14:textFill>";
|
||||
}
|
||||
Context.set_drawing_text_props(text_props);
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
ElementType type = content_[i]->get_type();
|
||||
|
||||
if (type != typeDrawCustomShape)
|
||||
{
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
|
||||
Context.back_context_state();
|
||||
@ -183,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)
|
||||
|
||||
@ -162,13 +162,22 @@ void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context)
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
Context.get_text_context().start_object();
|
||||
|
||||
if (enhanced_geometry_)
|
||||
enhanced_geometry_->pptx_convert(Context);
|
||||
|
||||
if (word_art_)
|
||||
{
|
||||
//set fill & stroke to text
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->pptx_convert(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_));
|
||||
}
|
||||
@ -289,6 +298,13 @@ void draw_connector::reset_svg_attributes()
|
||||
}
|
||||
void draw_connector::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
if (draw_connector_attlist_.draw_type_)
|
||||
{
|
||||
if (*draw_connector_attlist_.draw_type_ == L"curve")
|
||||
{
|
||||
sub_type_ = 11;
|
||||
}
|
||||
}
|
||||
reset_svg_attributes();
|
||||
reset_svg_path();
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -66,6 +66,9 @@ namespace odf_reader {
|
||||
|
||||
void draw_shape::common_xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
if (enhanced_geometry_)
|
||||
enhanced_geometry_->xlsx_convert(Context);
|
||||
|
||||
common_draw_shape_with_text_and_styles_attlist common_draw_attlist_ = common_draw_attlists_.shape_with_text_and_styles_;
|
||||
|
||||
const int z_index = common_draw_attlist_.common_shape_draw_attlist_.draw_z_index_.get_value_or(0);
|
||||
@ -130,11 +133,17 @@ void draw_shape::common_xlsx_convert(oox::xlsx_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);
|
||||
Context.get_drawing_context().set_fill(fill);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
Context.get_text_context().start_drawing_content();
|
||||
|
||||
if (word_art_)
|
||||
{
|
||||
//Context.get_text_context().start_drawing_fill(fill);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->xlsx_convert(Context);
|
||||
@ -143,7 +152,7 @@ void draw_shape::common_xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
|
||||
if (!text_content_.empty())
|
||||
{
|
||||
Context.get_drawing_context().set_property(_property(L"text-content",text_content_));
|
||||
Context.get_drawing_context().set_property(_property(L"text-content", text_content_));
|
||||
}
|
||||
|
||||
Context.get_drawing_context().end_drawing();
|
||||
@ -202,6 +211,15 @@ void draw_path::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
|
||||
void draw_connector::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
if (draw_connector_attlist_.draw_type_)
|
||||
{
|
||||
if (*draw_connector_attlist_.draw_type_ == L"curve")
|
||||
{
|
||||
sub_type_ = 11;
|
||||
}
|
||||
}
|
||||
reset_svg_attributes();
|
||||
|
||||
reset_svg_path();
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
Context.get_drawing_context().start_shape(6);
|
||||
|
||||
@ -200,7 +200,11 @@ odf_document::Impl::Impl(const std::wstring & srcPath, const std::wstring & temp
|
||||
|
||||
if (false == map_encryptions_.empty())
|
||||
{
|
||||
if (password.empty()) return;
|
||||
if (password.empty())
|
||||
{
|
||||
bError = true;
|
||||
return;
|
||||
}
|
||||
|
||||
//decrypt files
|
||||
tmp_folder_ = NSDirectory::CreateDirectoryWithUniqueName(tempPath);
|
||||
@ -286,17 +290,22 @@ bool odf_document::Impl::decrypt_folder (const std::wstring &password, const std
|
||||
bool result = true;
|
||||
for (size_t i = 0; i < arFiles.size(); ++i)
|
||||
{
|
||||
result = false;
|
||||
std::wstring sFileName = NSFile::GetFileName(arFiles[i]);
|
||||
|
||||
std::map<std::wstring, std::pair<office_element_ptr, int>>::iterator pFind = map_encryptions_.find(arFiles[i]);
|
||||
if ( pFind != map_encryptions_.end() )
|
||||
std::map<std::wstring, std::pair<office_element_ptr, int>>::iterator pFind;
|
||||
if (false == map_encryptions_.empty())
|
||||
{
|
||||
result = decrypt_file(password, arFiles[i], dstPath + FILE_SEPARATOR_STR + sFileName, pFind->second.first, pFind->second.second);
|
||||
|
||||
if (false == result)
|
||||
break;
|
||||
pFind = map_encryptions_.find(arFiles[i]);
|
||||
if ( pFind != map_encryptions_.end() )
|
||||
{
|
||||
result = decrypt_file(password, arFiles[i], dstPath + FILE_SEPARATOR_STR + sFileName, pFind->second.first, pFind->second.second);
|
||||
|
||||
if (false == result)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!result && false == map_encryptions_extra_.empty())
|
||||
{
|
||||
pFind = map_encryptions_extra_.find(arFiles[i]);
|
||||
if ( pFind != map_encryptions_.end() )
|
||||
@ -306,10 +315,11 @@ bool odf_document::Impl::decrypt_folder (const std::wstring &password, const std
|
||||
if (false == result)
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSFile::CFileBinary::Copy(arFiles[i], dstPath + FILE_SEPARATOR_STR + sFileName);
|
||||
}
|
||||
}
|
||||
if (!result)
|
||||
{
|
||||
NSFile::CFileBinary::Copy(arFiles[i], dstPath + FILE_SEPARATOR_STR + sFileName);
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
for (size_t i = 0; result && i < arDirectories.size(); ++i)
|
||||
|
||||
@ -71,7 +71,7 @@ style_instance::style_instance(
|
||||
|
||||
style_instance * styles_container::hyperlink_style()
|
||||
{
|
||||
if (hyperlink_style_pos_ > 0 && hyperlink_style_pos_ < instances_.size())
|
||||
if (hyperlink_style_pos_ > 0 && hyperlink_style_pos_ < (int)instances_.size())
|
||||
return instances_[hyperlink_style_pos_].get();
|
||||
else
|
||||
return NULL;
|
||||
|
||||
@ -110,7 +110,7 @@ public:
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context);
|
||||
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
|
||||
|
||||
@ -122,6 +122,10 @@ void graphic_format_properties::apply_to(std::vector<_property> & properties)
|
||||
if (draw_fit_to_size_) properties.push_back(_property(L"fit-to-size", *draw_fit_to_size_));
|
||||
if (draw_fit_to_contour_) properties.push_back(_property(L"fit-to-contour", *draw_fit_to_contour_));
|
||||
|
||||
if (common_draw_fill_attlist_.draw_color_mode_)
|
||||
{
|
||||
properties.push_back(_property(L"color-mode", *common_draw_fill_attlist_.draw_color_mode_));
|
||||
}
|
||||
if (common_padding_attlist_.fo_padding_)
|
||||
{
|
||||
properties.push_back(_property(L"text-padding-left", common_padding_attlist_.fo_padding_->get_value_unit(length::emu)));
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user