mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-27 15:51:51 +08:00
Compare commits
17 Commits
core-win-3
...
v4.5.dev.1
| Author | SHA1 | Date | |
|---|---|---|---|
| a607282285 | |||
| 62ea2bbc46 | |||
| 4071fa315b | |||
| 82eae7fc3e | |||
| 8efed345b0 | |||
| f5dcb1bed7 | |||
| 6b4695fc3a | |||
| bed884007c | |||
| 1aa0b03901 | |||
| e2ada4ca61 | |||
| d87649f08e | |||
| 3982ac06d2 | |||
| 0a5d0af882 | |||
| 08e97b4a68 | |||
| c4447d7396 | |||
| c55af15ccd | |||
| 333d2fdbf0 |
@ -125,6 +125,7 @@ const double g_dKoef_mm_to_hps = 2 * g_dKoef_mm_to_pt;
|
||||
|
||||
const static wchar_t* g_sFormatSignature = L"DOCY";
|
||||
const int g_nFormatVersion = 5;
|
||||
const int g_nFormatVersionNoBase64 = 10;
|
||||
extern int g_nCurFormatVersion;
|
||||
namespace c_oAscWrapStyle{enum c_oSerFormat
|
||||
{
|
||||
|
||||
@ -7714,9 +7714,9 @@ namespace BinDocxRW
|
||||
m_nLastFilePos = 0;
|
||||
m_nRealTableCount = 0;
|
||||
}
|
||||
static std::wstring WriteFileHeader(long nDataSize)
|
||||
static std::wstring WriteFileHeader(long nDataSize, int version)
|
||||
{
|
||||
std::wstring sHeader = std::wstring(g_sFormatSignature) + L";v" + std::to_wstring(g_nFormatVersion) + L";" + std::to_wstring(nDataSize) + L";";
|
||||
std::wstring sHeader = std::wstring(g_sFormatSignature) + L";v" + std::to_wstring(version) + L";" + std::to_wstring(nDataSize) + L";";
|
||||
return sHeader;
|
||||
}
|
||||
void WriteMainTableStart()
|
||||
|
||||
@ -47,6 +47,7 @@ BinDocxRW::CDocxSerializer::CDocxSerializer()
|
||||
m_pCurFileWriter = NULL;
|
||||
|
||||
m_bIsNoBase64Save = false;
|
||||
m_bIsNoBase64 = false;
|
||||
m_bSaveChartAsImg = false;
|
||||
}
|
||||
BinDocxRW::CDocxSerializer::~CDocxSerializer()
|
||||
@ -54,52 +55,6 @@ BinDocxRW::CDocxSerializer::~CDocxSerializer()
|
||||
RELEASEOBJECT(m_pParamsWriter);
|
||||
RELEASEOBJECT(m_pCurFileWriter);
|
||||
}
|
||||
bool BinDocxRW::CDocxSerializer::ConvertDocxToDoct(const std::wstring& sSrcFileName, const std::wstring& sDstFileName, const std::wstring& sTmpDir, const std::wstring& sXMLOptions)
|
||||
{
|
||||
std::wstring strDirSrc = NSSystemPath::Combine(sTmpDir, L"from");
|
||||
std::wstring strDirDst = NSSystemPath::Combine(sTmpDir, L"to");
|
||||
std::wstring strEditorBin = NSSystemPath::Combine(strDirDst, L"Editor.bin");
|
||||
|
||||
NSDirectory::CreateDirectory(strDirSrc);
|
||||
NSDirectory::CreateDirectory(strDirDst);
|
||||
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
|
||||
if(S_OK == oCOfficeUtils.ExtractToDirectory(sSrcFileName, strDirSrc, NULL, 0))
|
||||
if(saveToFile(strEditorBin, strDirSrc, sXMLOptions))
|
||||
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(strDirDst, sDstFileName))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
bool BinDocxRW::CDocxSerializer::ConvertDoctToDocx(const std::wstring& sSrcFileName, const std::wstring& sDstFileName, const std::wstring& sTmpDir, const std::wstring& sXMLOptions)
|
||||
{
|
||||
std::wstring strDirSrc = NSSystemPath::Combine(sTmpDir, L"from");
|
||||
std::wstring strEditorBin = NSSystemPath::Combine(strDirSrc, L"Editor.bin");
|
||||
std::wstring strDirDst = NSSystemPath::Combine(sTmpDir, L"to");
|
||||
|
||||
NSDirectory::CreateDirectory(strDirSrc);
|
||||
NSDirectory::CreateDirectory(strDirDst);
|
||||
|
||||
std::wstring sEditorBin = strEditorBin;
|
||||
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
|
||||
if(S_OK == oCOfficeUtils.ExtractToDirectory(sSrcFileName, strDirSrc, NULL, 0))
|
||||
{
|
||||
std::wstring sMediaPath;
|
||||
std::wstring sThemePath;
|
||||
std::wstring sEmbedPath;
|
||||
|
||||
CreateDocxFolders(strDirDst, sThemePath, sMediaPath, sEmbedPath);
|
||||
|
||||
if(loadFromFile(sEditorBin, strDirDst, sXMLOptions, sThemePath, sMediaPath, sEmbedPath))
|
||||
{
|
||||
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(strDirDst, sDstFileName, true))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool BinDocxRW::CDocxSerializer::saveToFile(const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions)
|
||||
{
|
||||
OOX::CPath pathMain(sSrcFileName);
|
||||
@ -144,13 +99,17 @@ bool BinDocxRW::CDocxSerializer::saveToFile(const std::wstring& sSrcFileName, co
|
||||
|
||||
BinaryFileWriter oBinaryFileWriter(*m_pParamsWriter);
|
||||
|
||||
if (m_bIsNoBase64)
|
||||
{
|
||||
oBufferedStream.WriteStringUtf8(oBinaryFileWriter.WriteFileHeader(0, g_nFormatVersionNoBase64));
|
||||
}
|
||||
oBinaryFileWriter.intoBindoc(sDstPath);
|
||||
|
||||
BYTE* pbBinBuffer = oBufferedStream.GetBuffer();
|
||||
int nBinBufferLen = oBufferedStream.GetPosition();
|
||||
|
||||
|
||||
if (m_bIsNoBase64Save)
|
||||
if (m_bIsNoBase64 || m_bIsNoBase64Save)
|
||||
{
|
||||
NSFile::CFileBinary oFile;
|
||||
oFile.CreateFileW(sSrcFileName);
|
||||
@ -166,7 +125,7 @@ bool BinDocxRW::CDocxSerializer::saveToFile(const std::wstring& sSrcFileName, co
|
||||
{
|
||||
NSFile::CFileBinary oFile;
|
||||
oFile.CreateFileW(sSrcFileName);
|
||||
oFile.WriteStringUTF8(oBinaryFileWriter.WriteFileHeader(nBinBufferLen));
|
||||
oFile.WriteStringUTF8(oBinaryFileWriter.WriteFileHeader(nBinBufferLen, g_nFormatVersion));
|
||||
oFile.WriteFile(pbBase64Buffer, nBase64BufferLen);
|
||||
oFile.CloseFile();
|
||||
}
|
||||
@ -268,27 +227,42 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
|
||||
else
|
||||
dst_len += _c;
|
||||
}
|
||||
|
||||
int nDataSize = atoi(dst_len.c_str());
|
||||
BYTE* pData = new BYTE[nDataSize];
|
||||
|
||||
if(false != Base64::Base64Decode((const char*)(pBase64Data + nIndex), nBase64DataSize - nIndex, pData, &nDataSize))
|
||||
int nVersion = g_nFormatVersion;
|
||||
if(!version.empty())
|
||||
{
|
||||
NSBinPptxRW::CDrawingConverter oDrawingConverter;
|
||||
|
||||
NSBinPptxRW::CBinaryFileReader& oBufferedStream = *oDrawingConverter.m_pReader;
|
||||
oBufferedStream.Init(pData, 0, nDataSize);
|
||||
version = version.substr(1);
|
||||
g_nCurFormatVersion = nVersion = std::stoi(version.c_str());
|
||||
}
|
||||
bool bIsNoBase64 = nVersion == g_nFormatVersionNoBase64;
|
||||
|
||||
int nVersion = g_nFormatVersion;
|
||||
if(!version.empty())
|
||||
NSBinPptxRW::CDrawingConverter oDrawingConverter;
|
||||
NSBinPptxRW::CBinaryFileReader& oBufferedStream = *oDrawingConverter.m_pReader;
|
||||
int nDataSize = 0;
|
||||
BYTE* pData = NULL;
|
||||
if (!bIsNoBase64)
|
||||
{
|
||||
nDataSize = atoi(dst_len.c_str());
|
||||
pData = new BYTE[nDataSize];
|
||||
if(Base64::Base64Decode((const char*)(pBase64Data + nIndex), nBase64DataSize - nIndex, pData, &nDataSize))
|
||||
{
|
||||
version = version.substr(1);
|
||||
int nTempVersion = atoi(version.c_str());
|
||||
if(0 != nTempVersion)
|
||||
{
|
||||
g_nCurFormatVersion = nVersion = nTempVersion;
|
||||
}
|
||||
}
|
||||
oBufferedStream.Init(pData, 0, nDataSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
RELEASEARRAYOBJECTS(pData);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nDataSize = nBase64DataSize;
|
||||
pData = pBase64Data;
|
||||
oBufferedStream.Init(pData, 0, nDataSize);
|
||||
oBufferedStream.Seek(nIndex);
|
||||
}
|
||||
|
||||
|
||||
if (NULL != pData)
|
||||
{
|
||||
oDrawingConverter.SetMainDocument(this);
|
||||
oDrawingConverter.SetMediaDstPath(sMediaPath);
|
||||
oDrawingConverter.SetEmbedDstPath(sEmbedPath);
|
||||
@ -343,6 +317,11 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
|
||||
bResultOk = true;
|
||||
|
||||
}
|
||||
if (!bIsNoBase64)
|
||||
{
|
||||
RELEASEARRAYOBJECTS(pData);
|
||||
}
|
||||
|
||||
}
|
||||
RELEASEARRAYOBJECTS(pBase64Data);
|
||||
}
|
||||
@ -472,6 +451,10 @@ void BinDocxRW::CDocxSerializer::setIsNoBase64Save(bool bIsNoBase64Save)
|
||||
{
|
||||
m_bIsNoBase64Save = bIsNoBase64Save;
|
||||
}
|
||||
void BinDocxRW::CDocxSerializer::setIsNoBase64(bool bIsNoBase64)
|
||||
{
|
||||
m_bIsNoBase64 = bIsNoBase64;
|
||||
}
|
||||
void BinDocxRW::CDocxSerializer::setSaveChartAsImg(bool bSaveChartAsImg)
|
||||
{
|
||||
m_bSaveChartAsImg = bSaveChartAsImg;
|
||||
|
||||
@ -54,6 +54,7 @@ namespace BinDocxRW
|
||||
std::wstring m_sFontDir;
|
||||
std::wstring m_sEmbeddedFontsDir;
|
||||
bool m_bIsNoBase64Save;
|
||||
bool m_bIsNoBase64;
|
||||
bool m_bSaveChartAsImg;
|
||||
ParamsWriter* m_pParamsWriter;
|
||||
Writers::FileWriter* m_pCurFileWriter;
|
||||
@ -61,9 +62,6 @@ namespace BinDocxRW
|
||||
CDocxSerializer();
|
||||
virtual ~CDocxSerializer();
|
||||
|
||||
bool ConvertDocxToDoct(const std::wstring& sSrcFileName, const std::wstring& sDstFileName, const std::wstring& sTmpDir, const std::wstring& sXMLOptions);
|
||||
bool ConvertDoctToDocx(const std::wstring& sSrcFileName, const std::wstring& sDstFileName, const std::wstring& sTmpDir, const std::wstring& sXMLOptions);
|
||||
|
||||
bool loadFromFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sThemePath, const std::wstring& sMediaPath, const std::wstring& sEmbedPath);
|
||||
bool saveToFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions);
|
||||
|
||||
@ -78,6 +76,7 @@ namespace BinDocxRW
|
||||
void setFontDir (const std::wstring& sFontDir);
|
||||
void setEmbeddedFontsDir(const std::wstring& sEmbeddedFontsDir);
|
||||
void setIsNoBase64Save (bool bIsNoBase64Save);
|
||||
void setIsNoBase64 (bool bIsNoBase64);
|
||||
void setSaveChartAsImg (bool bSaveChartAsImg);
|
||||
};
|
||||
}
|
||||
|
||||
@ -49,6 +49,7 @@ namespace BinXlsxRW{
|
||||
CXlsxSerializer::CXlsxSerializer()
|
||||
{
|
||||
m_pExternalDrawingConverter = NULL;
|
||||
m_bIsNoBase64 = false;
|
||||
}
|
||||
CXlsxSerializer::~CXlsxSerializer()
|
||||
{
|
||||
@ -134,7 +135,7 @@ namespace BinXlsxRW{
|
||||
oOfficeDrawingConverter.SetFontPicker(pFontPicker);
|
||||
|
||||
BinXlsxRW::BinaryFileWriter oBinaryFileWriter(fp);
|
||||
oBinaryFileWriter.Open(sSrcPath, sDstFileName, pEmbeddedFontsManager, &oOfficeDrawingConverter, sXMLOptions);
|
||||
oBinaryFileWriter.Open(sSrcPath, sDstFileName, pEmbeddedFontsManager, &oOfficeDrawingConverter, sXMLOptions, m_bIsNoBase64);
|
||||
|
||||
RELEASEOBJECT(pFontPicker);
|
||||
return true;
|
||||
@ -226,6 +227,11 @@ namespace BinXlsxRW{
|
||||
{
|
||||
m_pExternalDrawingConverter = pDrawingConverter;
|
||||
}
|
||||
void CXlsxSerializer::setIsNoBase64(bool bIsNoBase64)
|
||||
{
|
||||
m_bIsNoBase64 = bIsNoBase64;
|
||||
}
|
||||
|
||||
void CXlsxSerializer::writeChartXlsx(const std::wstring& sDstFile, const OOX::Spreadsheet::CChartSpace& oChart)
|
||||
{
|
||||
//анализируем chart
|
||||
|
||||
@ -55,6 +55,7 @@ namespace BinXlsxRW {
|
||||
std::wstring m_sFontDir;
|
||||
std::wstring m_sEmbeddedFontsDir;
|
||||
NSBinPptxRW::CDrawingConverter* m_pExternalDrawingConverter;
|
||||
bool m_bIsNoBase64;
|
||||
public:
|
||||
CXlsxSerializer();
|
||||
~CXlsxSerializer();
|
||||
@ -69,6 +70,7 @@ namespace BinXlsxRW {
|
||||
void setFontDir (const std::wstring& sFontDir);
|
||||
void setEmbeddedFontsDir(const std::wstring& sEmbeddedFontsDir);
|
||||
void setDrawingConverter(NSBinPptxRW::CDrawingConverter* pDrawingConverter);
|
||||
void setIsNoBase64 (bool bIsNoBase64);
|
||||
|
||||
void writeChartXlsx (const std::wstring& sDstFile ,const OOX::Spreadsheet::CChartSpace& oChart);
|
||||
};
|
||||
|
||||
@ -594,8 +594,17 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle*
|
||||
|
||||
convert(oox_spPr->xfrm.GetPointer());
|
||||
|
||||
PPTX::Logic::PrstGeom* prstGeom = &oox_spPr->Geometry.as<PPTX::Logic::PrstGeom>();
|
||||
PPTX::Logic::CustGeom* custGeom = &oox_spPr->Geometry.as<PPTX::Logic::CustGeom>();
|
||||
PPTX::Logic::PrstGeom* prstGeom = NULL;
|
||||
PPTX::Logic::CustGeom* custGeom = NULL;
|
||||
|
||||
if (oox_spPr->Geometry.is<PPTX::Logic::PrstGeom>())
|
||||
{
|
||||
prstGeom = &oox_spPr->Geometry.as<PPTX::Logic::PrstGeom>();
|
||||
}
|
||||
if (oox_spPr->Geometry.is<PPTX::Logic::CustGeom>())
|
||||
{
|
||||
custGeom = &oox_spPr->Geometry.as<PPTX::Logic::CustGeom>();
|
||||
}
|
||||
|
||||
convert(prstGeom);
|
||||
convert(custGeom);
|
||||
@ -627,8 +636,13 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle*
|
||||
}
|
||||
odf_context()->drawing_context()->end_line_properties();
|
||||
//-----------------------------------------------------------------------------------------------------------------------------
|
||||
PPTX::Logic::EffectLst* effectLst = &oox_spPr->EffectList.as<PPTX::Logic::EffectLst>();
|
||||
PPTX::Logic::EffectLst* effectLst = NULL;
|
||||
|
||||
if (oox_spPr->EffectList.is<PPTX::Logic::EffectLst>())
|
||||
{
|
||||
effectLst = &oox_spPr->EffectList.as<PPTX::Logic::EffectLst>();
|
||||
}
|
||||
|
||||
if (effectLst) convert(effectLst);
|
||||
else if (oox_sp_style) convert(&oox_sp_style->effectRef, 3);
|
||||
|
||||
@ -642,20 +656,14 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle*
|
||||
|
||||
void OoxConverter::convert(PPTX::Logic::UniFill *oox_fill, DWORD nARGB)
|
||||
{
|
||||
if (oox_fill == NULL) return;
|
||||
|
||||
PPTX::Logic::NoFill* noFill = &oox_fill->as<PPTX::Logic::NoFill>();
|
||||
PPTX::Logic::BlipFill* blipFill = &oox_fill->as<PPTX::Logic::BlipFill>();
|
||||
PPTX::Logic::GradFill* gradFill = &oox_fill->as<PPTX::Logic::GradFill>();
|
||||
PPTX::Logic::SolidFill* solidFill = &oox_fill->as<PPTX::Logic::SolidFill>();
|
||||
PPTX::Logic::PattFill* pattFill = &oox_fill->as<PPTX::Logic::PattFill>();
|
||||
if (oox_fill == NULL) return;
|
||||
|
||||
if (solidFill) convert(solidFill, nARGB);
|
||||
else if (blipFill) convert(blipFill);
|
||||
else if (gradFill) convert(gradFill, nARGB);
|
||||
else if (pattFill) convert(pattFill, nARGB);
|
||||
else if (noFill) odf_context()->drawing_context()->set_no_fill();
|
||||
if (oox_fill->is<PPTX::Logic::NoFill>()) odf_context()->drawing_context()->set_no_fill();
|
||||
|
||||
if (oox_fill->is<PPTX::Logic::BlipFill>()) convert(&oox_fill->as<PPTX::Logic::BlipFill>());
|
||||
if (oox_fill->is<PPTX::Logic::GradFill>()) convert(&oox_fill->as<PPTX::Logic::GradFill>(), nARGB);
|
||||
if (oox_fill->is<PPTX::Logic::SolidFill>()) convert(&oox_fill->as<PPTX::Logic::SolidFill>(),nARGB);
|
||||
if (oox_fill->is<PPTX::Logic::PattFill>()) convert(&oox_fill->as<PPTX::Logic::PattFill>(), nARGB);
|
||||
}
|
||||
|
||||
int OoxConverter::convert(PPTX::Logic::PrstTxWarp *oox_text_preset)
|
||||
@ -783,8 +791,10 @@ void OoxConverter::convert(PPTX::Logic::Path2D *oox_geom_path)
|
||||
|
||||
for (size_t i = 0 ; i < oox_geom_path->Paths.size(); i++)
|
||||
{
|
||||
PPTX::Logic::PathBase* pathBase = &oox_geom_path->Paths[i].Path2D.as<PPTX::Logic::PathBase>();
|
||||
convert(pathBase);
|
||||
if (oox_geom_path->Paths[i].Path2D.is<PPTX::Logic::PathBase>())
|
||||
{
|
||||
convert(&oox_geom_path->Paths[i].Path2D.as<PPTX::Logic::PathBase>());
|
||||
}
|
||||
}
|
||||
|
||||
if (oox_geom_path->stroke.IsInit() && *oox_geom_path->stroke == false)
|
||||
@ -1692,12 +1702,21 @@ void OoxConverter::convert(PPTX::Logic::RunProperties *oox_run_pr, odf_writer::s
|
||||
_CP_OPT(double) opacityText;
|
||||
std::wstring hexColorText;
|
||||
|
||||
PPTX::Logic::GradFill* gradFill = &oox_run_pr->Fill.as<PPTX::Logic::GradFill>();
|
||||
PPTX::Logic::GradFill* gradFill = NULL;
|
||||
PPTX::Logic::SolidFill* solidFill = NULL;
|
||||
|
||||
if (oox_run_pr->Fill.is<PPTX::Logic::GradFill>())
|
||||
{
|
||||
gradFill = &oox_run_pr->Fill.as<PPTX::Logic::GradFill>();
|
||||
}
|
||||
if (gradFill && !gradFill->GsLst.empty())
|
||||
{
|
||||
convert(&gradFill->GsLst[0].color, hexColorText, opacityText);
|
||||
}
|
||||
PPTX::Logic::SolidFill* solidFill = &oox_run_pr->Fill.as<PPTX::Logic::SolidFill>();
|
||||
if (oox_run_pr->Fill.is<PPTX::Logic::SolidFill>())
|
||||
{
|
||||
solidFill = &oox_run_pr->Fill.as<PPTX::Logic::SolidFill>();
|
||||
}
|
||||
if (solidFill)
|
||||
{
|
||||
convert(&solidFill->Color, hexColorText, opacityText);
|
||||
|
||||
@ -4581,10 +4581,13 @@ std::wstring CDrawingConverter::SaveObjectBackground(LONG lStart, LONG lLength)
|
||||
NSBinPptxRW::CXmlWriter oXmlWriter;
|
||||
SaveObjectExWriterInit(oXmlWriter, XMLWRITER_DOC_TYPE_DOCX);
|
||||
|
||||
oXmlWriter.m_bIsTop = true; // не забыть скинуть в самом шейпе
|
||||
PPTX::Logic::Shape& oShape = oElem.as<PPTX::Logic::Shape>();
|
||||
oShape.toXmlWriterVMLBackground(&oXmlWriter, *m_pTheme, *m_pClrMap);
|
||||
if (oElem.is<PPTX::Logic::Shape>())
|
||||
{
|
||||
oXmlWriter.m_bIsTop = true; // не забыть скинуть в самом шейпе
|
||||
|
||||
PPTX::Logic::Shape& oShape = oElem.as<PPTX::Logic::Shape>();
|
||||
oShape.toXmlWriterVMLBackground(&oXmlWriter, *m_pTheme, *m_pClrMap);
|
||||
}
|
||||
--m_nCurrentIndexObject;
|
||||
|
||||
SaveObjectExWriterRelease(oXmlWriter);
|
||||
@ -4606,18 +4609,26 @@ void CDrawingConverter::ConvertShapeVML(PPTX::Logic::SpTreeElem& oElem, const st
|
||||
{
|
||||
ConvertMainPropsToVML(bsMainProps, oWriter, oElem);
|
||||
|
||||
oWriter.m_bIsTop = true; // не забыть скинуть в самом шейпе
|
||||
PPTX::Logic::Shape& oShape = oElem.as<PPTX::Logic::Shape>();
|
||||
oShape.toXmlWriterVML(&oWriter, *m_pTheme, *m_pClrMap, false, bSignature);
|
||||
if (oElem.is<PPTX::Logic::Shape>())
|
||||
{
|
||||
oWriter.m_bIsTop = true; // не забыть скинуть в самом шейпе
|
||||
|
||||
PPTX::Logic::Shape& oShape = oElem.as<PPTX::Logic::Shape>();
|
||||
oShape.toXmlWriterVML(&oWriter, *m_pTheme, *m_pClrMap, false, bSignature);
|
||||
}
|
||||
}
|
||||
|
||||
void CDrawingConverter::ConvertGroupVML(PPTX::Logic::SpTreeElem& oElem, const std::wstring& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter)
|
||||
{
|
||||
ConvertMainPropsToVML(bsMainProps, oWriter, oElem);
|
||||
|
||||
oWriter.m_bIsTop = true; // не забыть скинуть в самом шейпе (вместе с остальными параметрами)
|
||||
PPTX::Logic::SpTree& oGroup = oElem.as<PPTX::Logic::SpTree>();
|
||||
oGroup.toXmlWriterVML(&oWriter, *m_pTheme, *m_pClrMap);
|
||||
if (oElem.is<PPTX::Logic::SpTree>())
|
||||
{
|
||||
oWriter.m_bIsTop = true; // не забыть скинуть в самом шейпе (вместе с остальными параметрами)
|
||||
|
||||
PPTX::Logic::SpTree& oGroup = oElem.as<PPTX::Logic::SpTree>();
|
||||
oGroup.toXmlWriterVML(&oWriter, *m_pTheme, *m_pClrMap);
|
||||
}
|
||||
}
|
||||
void CDrawingConverter::ConvertTextVML(XmlUtils::CXmlNode &nodeTextBox, PPTX::Logic::Shape* pShape)
|
||||
{
|
||||
|
||||
@ -61,6 +61,7 @@ private:
|
||||
std::wstring m_strEmbeddedFontsDirectory;
|
||||
|
||||
std::wstring m_strFolderThemes;
|
||||
bool m_bIsNoBase64;
|
||||
|
||||
extract_to_directory m_fCallbackExtract;
|
||||
compress_from_directory m_fCallbackCompress;
|
||||
@ -93,6 +94,7 @@ public:
|
||||
HRESULT SetFontDir (std::wstring bsFontDir);
|
||||
HRESULT SetThemesDir (std::wstring bsDir);
|
||||
HRESULT SetUseSystemFonts (bool useSystemFonts);
|
||||
void SetIsNoBase64 (bool bIsNoBase64);
|
||||
HRESULT OpenFileToPPTY (std::wstring bsInput, std::wstring bsOutput);
|
||||
HRESULT OpenDirectoryToPPTY (std::wstring bsInput, std::wstring bsOutput);
|
||||
HRESULT ConvertPPTYToPPTX (std::wstring bsInput, std::wstring bsOutput, std::wstring bsThemesFolder);
|
||||
|
||||
@ -67,6 +67,7 @@ CPPTXFile::CPPTXFile(extract_to_directory fCallbackExtract, compress_from_direct
|
||||
m_strEmbeddedFontsDirectory = _T("");
|
||||
|
||||
m_strFolderThemes = _T("");
|
||||
m_bIsNoBase64 = false;
|
||||
|
||||
//m_fCallbackResource = fCallbackResource;
|
||||
m_fCallbackExtract = fCallbackExtract;
|
||||
@ -232,6 +233,10 @@ HRESULT CPPTXFile::SetUseSystemFonts(bool val)
|
||||
m_bIsUseSystemFonts = val;
|
||||
return S_OK;
|
||||
}
|
||||
void CPPTXFile::SetIsNoBase64(bool bIsNoBase64)
|
||||
{
|
||||
m_bIsNoBase64 = bIsNoBase64;
|
||||
}
|
||||
HRESULT CPPTXFile::OpenFileToPPTY(std::wstring bsInput, std::wstring bsOutput)
|
||||
{
|
||||
if (m_strTempDir.empty())
|
||||
@ -325,7 +330,7 @@ HRESULT CPPTXFile::OpenDirectoryToPPTY(std::wstring bsInput, std::wstring bsOutp
|
||||
}
|
||||
}
|
||||
|
||||
PPTX2EditorAdvanced::Convert(oBinaryWriter, *m_pFolder, m_strDirectory, pathDstFileOutput.GetPath());
|
||||
PPTX2EditorAdvanced::Convert(oBinaryWriter, *m_pFolder, m_strDirectory, pathDstFileOutput.GetPath(), m_bIsNoBase64);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@ -360,7 +365,7 @@ HRESULT CPPTXFile::ConvertPPTYToPPTX(std::wstring bsInput, std::wstring bsOutput
|
||||
std::wstring strBsInput = bsInput;
|
||||
std::wstring srcFolder = NSDirectory::GetFolderPath(strBsInput);
|
||||
|
||||
oWriter.OpenPPTY(pSrcBuffer, lFileSize, srcFolder, bsThemesFolder);
|
||||
oWriter.OpenPPTY(pSrcBuffer, lFileSize, srcFolder, bsThemesFolder);
|
||||
|
||||
RELEASEARRAYOBJECTS(pSrcBuffer);
|
||||
HRESULT hRes = S_OK;
|
||||
|
||||
@ -42,6 +42,8 @@ namespace NSBinPptxRW
|
||||
const BYTE g_nodeAttributeStart = 0xFA;
|
||||
const BYTE g_nodeAttributeEnd = 0xFB;
|
||||
|
||||
const int g_nFormatVersionNoBase64 = 10;
|
||||
|
||||
namespace NSSerFormat
|
||||
{
|
||||
enum SerFormat
|
||||
|
||||
@ -790,6 +790,17 @@ namespace NSBinPptxRW
|
||||
{
|
||||
_WriteString(sBuffer.c_str(), (_UINT32)sBuffer.length());
|
||||
}
|
||||
void CBinaryFileWriter::WriteStringUtf8(const std::wstring& sBuffer)
|
||||
{
|
||||
BYTE* pData = NULL;
|
||||
LONG lLen = 0;
|
||||
|
||||
NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sBuffer.c_str(), (LONG)sBuffer.length(), pData, lLen, false);
|
||||
|
||||
WriteBYTEArray(pData, lLen);
|
||||
|
||||
RELEASEARRAYOBJECTS(pData);
|
||||
}
|
||||
CBinaryFileWriter::CBinaryFileWriter()
|
||||
{
|
||||
m_pMainDocument = NULL;
|
||||
@ -844,9 +855,9 @@ namespace NSBinPptxRW
|
||||
m_lPosition += (_UINT32)lCount;
|
||||
}
|
||||
|
||||
void CBinaryFileWriter::WriteMainPart()
|
||||
void CBinaryFileWriter::WriteMainPart(_UINT32 nStartPos)
|
||||
{
|
||||
BYTE* pData = m_pStreamData;
|
||||
BYTE* pData = m_pStreamData + nStartPos;
|
||||
size_t nCount = m_arMainTables.size();
|
||||
|
||||
for (size_t i = 0; i < nCount; i++)
|
||||
|
||||
@ -292,6 +292,7 @@ namespace NSBinPptxRW
|
||||
void WriteStringW3 (const std::wstring& sBuffer);
|
||||
|
||||
void WriteStringW4 (const std::wstring& sBuffer);
|
||||
void WriteStringUtf8(const std::wstring& sBuffer);
|
||||
// --------------------------------------------------------
|
||||
void WriteLONG64 (const _INT64& lValue);
|
||||
void WriteDouble64 (const double& dValue);
|
||||
@ -306,7 +307,7 @@ namespace NSBinPptxRW
|
||||
void StartMainRecord(_INT32 lType);
|
||||
void WriteReserved(size_t lCount);
|
||||
|
||||
void WriteMainPart();
|
||||
void WriteMainPart(_UINT32 nStartPos);
|
||||
|
||||
void WriteString1 (int type, const std::wstring& val);
|
||||
void WriteString2 (int type, const NSCommon::nullable_string& val);
|
||||
|
||||
@ -38,7 +38,7 @@ namespace PPTX2EditorAdvanced
|
||||
{
|
||||
using namespace NSBinPptxRW;
|
||||
|
||||
DWORD Convert(NSBinPptxRW::CBinaryFileWriter& oBinaryWriter, PPTX::Folder& oFolder, const std::wstring& strSourceDirectory, const std::wstring& strDstFile)
|
||||
DWORD Convert(NSBinPptxRW::CBinaryFileWriter& oBinaryWriter, PPTX::Folder& oFolder, const std::wstring& strSourceDirectory, const std::wstring& strDstFile, bool bIsNoBase64)
|
||||
{
|
||||
// сначала соберем все объекты для конвертации и сформируем main-таблицы
|
||||
NSBinPptxRW::CCommonWriter* pCommon = oBinaryWriter.m_pCommon;
|
||||
@ -230,6 +230,12 @@ namespace PPTX2EditorAdvanced
|
||||
oBinaryWriter.m_pCommon->m_oNote_Rels.push_back(nMasterIndex);
|
||||
}
|
||||
|
||||
if (bIsNoBase64)
|
||||
{
|
||||
std::wstring strPrefix = L"PPTY;v"+std::to_wstring(g_nFormatVersionNoBase64)+L";0;";
|
||||
oBinaryWriter.WriteStringUtf8(strPrefix);
|
||||
}
|
||||
_UINT32 nStartPos = oBinaryWriter.GetPosition();
|
||||
// нужно записать все в maintables. А кроме главных таблиц ничего и нету. Все остальное лежит в них
|
||||
// на каждую таблицу - 5 байт (тип и сдвиг)
|
||||
// число таблиц - заранее известно (сделаем 30. если потом не будет хватать - новая версия формата)
|
||||
@ -516,29 +522,35 @@ namespace PPTX2EditorAdvanced
|
||||
// ------------------------------------------------
|
||||
|
||||
oBinaryWriter.WriteEmbeddedFonts();
|
||||
oBinaryWriter.WriteMainPart();
|
||||
oBinaryWriter.WriteMainPart(nStartPos);
|
||||
|
||||
// все записалось нормально. осталось скинуть на диск
|
||||
BYTE* pbBinBuffer = oBinaryWriter.GetBuffer();
|
||||
int nBinBufferLen = (int)oBinaryWriter.GetPosition();
|
||||
int nBase64BufferLen = Base64::Base64EncodeGetRequiredLength(nBinBufferLen, Base64::B64_BASE64_FLAG_NOCRLF);
|
||||
BYTE* pbBase64Buffer = new BYTE[nBase64BufferLen+64];
|
||||
// if (true == Base64::Base64Encode(pbBinBuffer, nBinBufferLen, (LPSTR)pbBase64Buffer, &nBase64BufferLen, Base64::B64_BASE64_FLAG_NOCRLF))
|
||||
if (true == Base64_1::Base64Encode(pbBinBuffer, nBinBufferLen, pbBase64Buffer, &nBase64BufferLen))
|
||||
{
|
||||
CFile oFile;
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
oFile.CreateFileW(strDstFile);
|
||||
#else
|
||||
oFile.CreateFile(strDstFile);
|
||||
#endif
|
||||
std::string strPrefix = "PPTY;v1;" + std::to_string(nBinBufferLen) + ";";
|
||||
oFile.WriteFile((void*)strPrefix.c_str(), (DWORD)strPrefix.length());
|
||||
oFile.WriteFile(pbBase64Buffer, nBase64BufferLen);
|
||||
if (bIsNoBase64)
|
||||
{
|
||||
NSFile::CFileBinary oFile;
|
||||
oFile.CreateFileW(strDstFile);
|
||||
oFile.WriteFile(pbBinBuffer, nBinBufferLen);
|
||||
oFile.CloseFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
int nBase64BufferLen = Base64::Base64EncodeGetRequiredLength(nBinBufferLen, Base64::B64_BASE64_FLAG_NOCRLF);
|
||||
BYTE* pbBase64Buffer = new BYTE[nBase64BufferLen+64];
|
||||
// if (true == Base64::Base64Encode(pbBinBuffer, nBinBufferLen, (LPSTR)pbBase64Buffer, &nBase64BufferLen, Base64::B64_BASE64_FLAG_NOCRLF))
|
||||
if (true == Base64_1::Base64Encode(pbBinBuffer, nBinBufferLen, pbBase64Buffer, &nBase64BufferLen))
|
||||
{
|
||||
NSFile::CFileBinary oFile;
|
||||
oFile.CreateFileW(strDstFile);
|
||||
std::wstring strPrefix = L"PPTY;v1;" + std::to_wstring(nBinBufferLen) + L";";
|
||||
oFile.WriteStringUTF8(strPrefix);
|
||||
oFile.WriteFile(pbBase64Buffer, nBase64BufferLen);
|
||||
oFile.CloseFile();
|
||||
}
|
||||
|
||||
RELEASEARRAYOBJECTS(pbBase64Buffer);
|
||||
RELEASEARRAYOBJECTS(pbBase64Buffer);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,7 +118,7 @@ namespace NSBinPptxRW
|
||||
m_oReader.m_strFolderThemes = pathTheme.GetPath();
|
||||
}
|
||||
|
||||
void OpenPPTY(BYTE* pBuffer, int len, std::wstring srcFolder, std::wstring strThemesFolder)
|
||||
void OpenPPTY(BYTE* pBuffer, int len, std::wstring srcFolder, std::wstring strThemesFolder)
|
||||
{
|
||||
int start_pos = 0;
|
||||
|
||||
@ -158,11 +158,30 @@ namespace NSBinPptxRW
|
||||
int dstLenTemp = XmlUtils::GetInteger(__str_decode_len);
|
||||
//int dstLenTemp = Base64DecodeGetRequiredLength(len);
|
||||
|
||||
BYTE* pDstBuffer = new BYTE[dstLenTemp];
|
||||
int dstLen = dstLenTemp;
|
||||
Base64::Base64Decode((const char*)pBuffer, len, pDstBuffer, &dstLen);
|
||||
int nVersion = 1;
|
||||
if(__str_version.length() > 1)
|
||||
{
|
||||
nVersion = std::stoi(__str_version.substr(1).c_str());
|
||||
}
|
||||
bool bIsNoBase64 = nVersion == g_nFormatVersionNoBase64;
|
||||
|
||||
BYTE* pDstBuffer = NULL;
|
||||
int dstLen = 0;
|
||||
if(!bIsNoBase64)
|
||||
{
|
||||
BYTE* pDstBuffer = new BYTE[dstLenTemp];
|
||||
int dstLen = dstLenTemp;
|
||||
Base64::Base64Decode((const char*)pBuffer, len, pDstBuffer, &dstLen);
|
||||
m_oReader.Init(pDstBuffer, 0, dstLen);
|
||||
}
|
||||
else
|
||||
{
|
||||
pDstBuffer = pBuffer - start_pos;
|
||||
dstLen = len + start_pos;
|
||||
m_oReader.Init(pDstBuffer, 0, dstLen);
|
||||
m_oReader.Seek(start_pos);
|
||||
}
|
||||
|
||||
m_oReader.Init(pDstBuffer, 0, dstLen);
|
||||
m_oReader.m_strFolder = srcFolder;
|
||||
m_oReader.m_strFolderExternalThemes = strThemesFolder;
|
||||
|
||||
@ -415,11 +434,10 @@ namespace NSBinPptxRW
|
||||
LONG lLayouts = (LONG)m_arSlideMasters_Theme[i].m_arLayouts.size();
|
||||
for (LONG j = 0; j < lLayouts; ++j)
|
||||
{
|
||||
arrLays.push_back(PPTX::Logic::XmlId());
|
||||
arrLays.push_back(PPTX::Logic::XmlId(L"p:sldLayoutId"));
|
||||
|
||||
std::wstring sId = std::to_wstring((_UINT64)(0x80000000 + __nCountLayouts + j + 1));
|
||||
|
||||
arrLays[j].m_name = _T("sldLayoutId");
|
||||
arrLays[j].id = sId;
|
||||
arrLays[j].rid = (size_t)(j + 1);
|
||||
}
|
||||
@ -755,11 +773,10 @@ namespace NSBinPptxRW
|
||||
LONG nCountLayouts = 0;
|
||||
for (LONG i = 0; i < nCountMasters; ++i)
|
||||
{
|
||||
m_oPresentation.sldMasterIdLst.push_back(PPTX::Logic::XmlId());
|
||||
m_oPresentation.sldMasterIdLst.push_back(PPTX::Logic::XmlId(L"p:sldMasterId"));
|
||||
|
||||
std::wstring sId = std::to_wstring((_UINT64)(0x80000000 + nCountLayouts));
|
||||
|
||||
m_oPresentation.sldMasterIdLst[i].m_name = _T("sldMasterId");
|
||||
m_oPresentation.sldMasterIdLst[i].id = sId;
|
||||
m_oPresentation.sldMasterIdLst[i].rid = (size_t)(i + 1);
|
||||
nCountLayouts += (LONG)(m_arSlideMasters_Theme[i].m_arLayouts.size() + 1);
|
||||
@ -773,11 +790,10 @@ namespace NSBinPptxRW
|
||||
m_oPresentation.sldIdLst.clear();
|
||||
for (LONG i = 0; i < nCountSlides; ++i)
|
||||
{
|
||||
m_oPresentation.sldIdLst.push_back(PPTX::Logic::XmlId());
|
||||
m_oPresentation.sldIdLst.push_back(PPTX::Logic::XmlId(L"p:sldId"));
|
||||
|
||||
std::wstring sId = std::to_wstring(256 + i);
|
||||
|
||||
m_oPresentation.sldIdLst[i].m_name = _T("sldId");
|
||||
m_oPresentation.sldIdLst[i].id = sId;
|
||||
m_oPresentation.sldIdLst[i].rid = (size_t)nCurrentRels;
|
||||
++nCurrentRels;
|
||||
@ -788,8 +804,8 @@ namespace NSBinPptxRW
|
||||
m_oPresentation.notesMasterIdLst.clear();
|
||||
if (bNotesMasterPresent)
|
||||
{
|
||||
m_oPresentation.notesMasterIdLst.push_back(PPTX::Logic::XmlId());
|
||||
m_oPresentation.notesMasterIdLst[0].m_name = _T("notesMasterId");
|
||||
m_oPresentation.notesMasterIdLst.push_back(PPTX::Logic::XmlId(L"p:notesMasterId"));
|
||||
|
||||
m_oPresentation.notesMasterIdLst[0].rid = (size_t)nCurrentRels;
|
||||
++nCurrentRels;
|
||||
}
|
||||
@ -816,8 +832,10 @@ namespace NSBinPptxRW
|
||||
bIsAuthors = true;
|
||||
}
|
||||
}
|
||||
|
||||
RELEASEARRAYOBJECTS(pDstBuffer);
|
||||
if(!bIsNoBase64)
|
||||
{
|
||||
RELEASEARRAYOBJECTS(pDstBuffer);
|
||||
}
|
||||
|
||||
// content types
|
||||
OOX::CContentTypes *pContentTypes = m_oImageManager.m_pContentTypes;
|
||||
|
||||
@ -32,15 +32,15 @@
|
||||
#ifndef PPTX_LOGIC_EXTP_PROPERTIES_INCLUDE_H_
|
||||
#define PPTX_LOGIC_EXTP_PROPERTIES_INCLUDE_H_
|
||||
|
||||
#include "./../WrapperWritingElement.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/RId.h"
|
||||
#include "../Presentation/SectionLst.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
//<p:ext uri="{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}">
|
||||
//<p14:media xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" r:embed="rId2">
|
||||
//<p14:trim st="93333.0816" end="96583.4816"/>
|
||||
//</p14:media>
|
||||
//</p:ext>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
//<ext uri="{05C60535-1F16-4fd2-B633-F4F36F0B64E0}" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main">
|
||||
// <x14:sparklineGroups xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main">
|
||||
// <x14:sparklineGroup displayEmptyCellsAs="gap">
|
||||
@ -61,10 +61,33 @@
|
||||
// </x14:sparklineGroup>
|
||||
// </x14:sparklineGroups>
|
||||
//</ext>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
//<a:ext uri="{63B3BB69-23CF-44E3-9099-C40C66FF867C}">
|
||||
// <a14:compatExt spid="_x0000_s1025"/>
|
||||
//</a:ext>
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
// <p:ext uri="{521415D9-36F7-43E2-AB2F-B90AF26B5E84}">
|
||||
// <p14:sectionLst xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main">
|
||||
// <p14:section name="123" id="{775558AA-D529-4C59-9762-B6F3CDAC8092}">
|
||||
// <p14:sldIdLst>
|
||||
// <p14:sldId id="256"/>
|
||||
// <p14:sldId id="257"/>
|
||||
// </p14:sldIdLst>
|
||||
// </p14:section>
|
||||
// <p14:section name="qwerty" id="{296A3C58-7D47-4848-A546-3C86980BE927}">
|
||||
// <p14:sldIdLst>
|
||||
// <p14:sldId id="258"/>
|
||||
// </p14:sldIdLst>
|
||||
// </p14:section>
|
||||
// <p14:section name="Раздел без заголовка" id="{DA908BF8-2A15-4E46-B49B-C1BB4B4AAF31}">
|
||||
// <p14:sldIdLst/>
|
||||
// </p14:section>
|
||||
// </p14:sectionLst>
|
||||
// </p:ext>
|
||||
// <p:ext uri="{EFAFB233-063F-42B5-8137-9DF3F51BA10A}">
|
||||
// <p15:sldGuideLst xmlns:p15="http://schemas.microsoft.com/office/powerpoint/2012/main"/>
|
||||
// </p:ext>
|
||||
//</p:extLst>
|
||||
|
||||
namespace PPTX
|
||||
{
|
||||
@ -115,48 +138,61 @@ namespace PPTX
|
||||
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
WritingElement_ReadAttributes_Start( oReader )
|
||||
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("uri"), uri)
|
||||
WritingElement_ReadAttributes_ReadSingle ( oReader, L"uri", uri)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
}
|
||||
void ReadAttributes1(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
WritingElement_ReadAttributes_Start( oReader )
|
||||
WritingElement_ReadAttributes_ReadSingle( oReader, _T("r:embed"), link)
|
||||
WritingElement_ReadAttributes_ReadSingle( oReader, L"r:embed", link)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
}
|
||||
void ReadAttributes2(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
WritingElement_ReadAttributes_Start( oReader )
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, _T("st"), st)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("end"), end)
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, L"st", st)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, L"end", end)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
}
|
||||
void ReadAttributes3(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
WritingElement_ReadAttributes_Start( oReader )
|
||||
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("spid"), spid)
|
||||
WritingElement_ReadAttributes_Start( oReader );
|
||||
WritingElement_ReadAttributes_ReadSingle ( oReader, L"spid", spid)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{//todooo списком ..
|
||||
XmlUtils::CXmlNode media = node.ReadNodeNoNS(_T("media"));
|
||||
if (media.IsValid())
|
||||
{
|
||||
XmlUtils::CXmlNodes oNodes;
|
||||
if (node.GetNodes(L"*", oNodes))
|
||||
{
|
||||
link = media.GetAttribute(_T("r:embed"));
|
||||
|
||||
XmlUtils::CXmlNode trim = media.ReadNodeNoNS(_T("trim"));
|
||||
if (trim.IsValid())
|
||||
int nCount = oNodes.GetCount();
|
||||
for (int i = 0; i < nCount; ++i)
|
||||
{
|
||||
trim.ReadAttributeBase(_T("st"), st);
|
||||
trim.ReadAttributeBase(_T("end"), end);
|
||||
XmlUtils::CXmlNode oNode;
|
||||
oNodes.GetAt(i, oNode);
|
||||
|
||||
std::wstring strName = XmlUtils::GetNameNoNS(oNode.GetName());
|
||||
|
||||
if (L"media" == strName)
|
||||
{
|
||||
link = oNode.GetAttribute(L"r:embed");
|
||||
|
||||
XmlUtils::CXmlNode trim = oNode.ReadNodeNoNS(L"trim");
|
||||
if (trim.IsValid())
|
||||
{
|
||||
trim.ReadAttributeBase(L"st", st);
|
||||
trim.ReadAttributeBase(L"end", end);
|
||||
}
|
||||
}
|
||||
else if (L"compatExt" == strName)
|
||||
{
|
||||
spid = oNode.GetAttribute(L"spid");
|
||||
}
|
||||
else if (L"sectionLst" == strName)
|
||||
{
|
||||
sectionLst = oNode;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
XmlUtils::CXmlNode compatExt = node.ReadNodeNoNS(_T("compatExt"));
|
||||
if (compatExt.IsValid())
|
||||
{
|
||||
spid = media.GetAttribute(_T("spid"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -170,11 +206,11 @@ namespace PPTX
|
||||
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
if (link.IsInit() && uri.IsInit())
|
||||
if (link.IsInit())
|
||||
{
|
||||
pWriter->StartNode(L"p:ext");
|
||||
pWriter->StartAttributes();
|
||||
pWriter->WriteAttribute(L"uri", *uri);
|
||||
pWriter->WriteAttribute(L"uri", std::wstring(L"{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}"));
|
||||
pWriter->EndAttributes();
|
||||
|
||||
pWriter->StartNode(L"p14:media");
|
||||
@ -185,6 +221,16 @@ namespace PPTX
|
||||
pWriter->EndNode(L"p14:media");
|
||||
pWriter->EndNode(L"p:ext");
|
||||
}
|
||||
if (sectionLst.IsInit())
|
||||
{
|
||||
pWriter->StartNode(L"p:ext");
|
||||
pWriter->StartAttributes();
|
||||
pWriter->WriteAttribute(L"uri", std::wstring(L"{521415D9-36F7-43E2-AB2F-B90AF26B5E84}"));
|
||||
pWriter->EndAttributes();
|
||||
|
||||
sectionLst->toXmlWriter(pWriter);
|
||||
pWriter->EndNode(L"p:ext");
|
||||
}
|
||||
}
|
||||
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
@ -201,10 +247,11 @@ namespace PPTX
|
||||
//media
|
||||
nullable<OOX::RId> link;
|
||||
nullable_double st;
|
||||
nullable_double end;
|
||||
|
||||
nullable_double end;
|
||||
//compatExt
|
||||
nullable_string spid;
|
||||
|
||||
nullable<nsPresentation::SectionLst> sectionLst;
|
||||
//dataModelExt
|
||||
//table
|
||||
//sparklineGroups
|
||||
|
||||
@ -896,7 +896,6 @@ namespace PPTX
|
||||
{
|
||||
PPTX::Logic::Ext ext;
|
||||
ext.link = OOX::RId(blipFill.blip->mediaRid);
|
||||
ext.uri = L"{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}";
|
||||
nvPicPr.nvPr.extLst.push_back(ext);
|
||||
|
||||
int nRId = -1;
|
||||
|
||||
@ -45,9 +45,14 @@ namespace PPTX
|
||||
public:
|
||||
PPTX_LOGIC_BASE(XmlId)
|
||||
|
||||
XmlId(std::wstring name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
m_name = XmlUtils::GetNameNoNS(node.GetName());
|
||||
m_name = node.GetName();
|
||||
|
||||
node.ReadAttributeBase(L"r:id", rid);
|
||||
node.ReadAttributeBase(L"id", id);
|
||||
}
|
||||
@ -57,7 +62,7 @@ namespace PPTX
|
||||
oAttr.Write(_T("r:id"), rid.ToString());
|
||||
oAttr.Write(_T("id"), id);
|
||||
|
||||
return XmlUtils::CreateNode(_T("p:") + m_name, oAttr);
|
||||
return XmlUtils::CreateNode(m_name, oAttr);
|
||||
}
|
||||
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
@ -69,17 +74,48 @@ namespace PPTX
|
||||
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
|
||||
}
|
||||
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
|
||||
{
|
||||
LONG _end_rec = pReader->GetPos() + pReader->GetLong() + 4;
|
||||
|
||||
pReader->Skip(1); // start attributes
|
||||
|
||||
while (true)
|
||||
{
|
||||
BYTE _at = pReader->GetUChar_TypeNode();
|
||||
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
|
||||
break;
|
||||
|
||||
switch (_at)
|
||||
{
|
||||
case 0:
|
||||
id = pReader->GetString2();
|
||||
break;
|
||||
case 1:
|
||||
rid = pReader->GetString2();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
pReader->Seek(_end_rec);
|
||||
}
|
||||
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
pWriter->StartNode(_T("p:") + m_name);
|
||||
pWriter->StartNode( m_name );
|
||||
|
||||
pWriter->StartAttributes();
|
||||
pWriter->WriteAttribute(_T("id"), id);
|
||||
pWriter->WriteAttribute(_T("r:id"), rid.ToString());
|
||||
pWriter->WriteAttribute(_T("id"), id);
|
||||
|
||||
std::wstring sRid = rid.ToString();
|
||||
if (sRid.empty() == false)
|
||||
{
|
||||
pWriter->WriteAttribute(_T("r:id"), sRid);
|
||||
}
|
||||
pWriter->EndAttributes();
|
||||
|
||||
pWriter->EndNode(_T("p:") + m_name);
|
||||
pWriter->EndNode( m_name );
|
||||
}
|
||||
|
||||
nullable_string id;
|
||||
|
||||
@ -52,40 +52,42 @@ namespace PPTX
|
||||
class Namespaces
|
||||
{
|
||||
public:
|
||||
Namespaces() : a(L"a", L"http://schemas.openxmlformats.org/drawingml/2006/main"),
|
||||
b(L"b", L"http://schemas.openxmlformats.org/officeDocument/2006/bibliography"),
|
||||
cdr(L"cdr", L"http://schemas.openxmlformats.org/drawingml/2006/chartDrawing"),
|
||||
cp(L"cp", L"http://schemas.openxmlformats.org/package/2006/metadata/core-properties"),
|
||||
dc(L"dc", L"http://purl.org/dc/elements/1.1/"),
|
||||
Namespaces() :
|
||||
a (L"a", L"http://schemas.openxmlformats.org/drawingml/2006/main"),
|
||||
b (L"b", L"http://schemas.openxmlformats.org/officeDocument/2006/bibliography"),
|
||||
cdr (L"cdr", L"http://schemas.openxmlformats.org/drawingml/2006/chartDrawing"),
|
||||
cp (L"cp", L"http://schemas.openxmlformats.org/package/2006/metadata/core-properties"),
|
||||
dc (L"dc", L"http://purl.org/dc/elements/1.1/"),
|
||||
dchrt(L"dchrt", L"http://schemas.openxmlformats.org/drawingml/2006/chart"),
|
||||
dcmitype(L"dcmitype", L"http://purl.org/dc/dcmitype/"),
|
||||
dcterms(L"dcterms", L"http://purl.org/dc/terms/"),
|
||||
ddgrm(L"ddgrm", L"http://schemas.openxmlformats.org/drawingml/2006/diagram"),
|
||||
dgm(L"dgm", L"http://schemas.openxmlformats.org/drawingml/2006/diagram"),
|
||||
dgm (L"dgm", L"http://schemas.openxmlformats.org/drawingml/2006/diagram"),
|
||||
dlckcnv(L"dlckcnv", L"http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas"),
|
||||
dpct(L"dpct", L"http://schemas.openxmlformats.org/drawingml/2006/picture"),
|
||||
ds(L"ds", L"http://schemas.openxmlformats.org/officeDocument/2006/customXml"),
|
||||
m(L"m", L"http://schemas.openxmlformats.org/officeDocument/2006/math"),
|
||||
o(L"o", L"urn:schemas-microsoft-com:office:office"),
|
||||
p(L"p", L"http://schemas.openxmlformats.org/presentationml/2006/main"),
|
||||
pic(L"pic", L"http://schemas.openxmlformats.org/drawingml/2006/picture"),
|
||||
pvml(L"pvml", L"urn:schemas-microsoft-com:office:powerpoint"),
|
||||
r(L"r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships"),
|
||||
s(L"s", L"http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes"),
|
||||
sl(L"sl", L"http://schemas.openxmlformats.org/schemaLibrary/2006/main"),
|
||||
v(L"v", L"urn:schemas-microsoft-com:vml"),
|
||||
ve(L"ve", L"http://schemas.openxmlformats.org/markup-compatibility/2006"),
|
||||
vp(L"vp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"),
|
||||
vt(L"vt", L"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"),
|
||||
w(L"w", L"http://schemas.openxmlformats.org/wordprocessingml/2006/main"),
|
||||
w10(L"w10", L"urn:schemas-microsoft-com:office:word"),
|
||||
wne(L"wne", L"http://schemas.microsoft.com/office/word/2006/wordml"),
|
||||
wp(L"wp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"),
|
||||
x(L"x", L"urn:schemas-microsoft-com:office:excel"),
|
||||
xdr(L"xdr", L"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"),
|
||||
dpct(L"dpct", L"http://schemas.openxmlformats.org/drawingml/2006/picture"),
|
||||
ds (L"ds", L"http://schemas.openxmlformats.org/officeDocument/2006/customXml"),
|
||||
m (L"m", L"http://schemas.openxmlformats.org/officeDocument/2006/math"),
|
||||
o (L"o", L"urn:schemas-microsoft-com:office:office"),
|
||||
p (L"p", L"http://schemas.openxmlformats.org/presentationml/2006/main"),
|
||||
pic (L"pic", L"http://schemas.openxmlformats.org/drawingml/2006/picture"),
|
||||
pvml(L"pvml", L"urn:schemas-microsoft-com:office:powerpoint"),
|
||||
r (L"r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships"),
|
||||
s (L"s", L"http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes"),
|
||||
sl (L"sl", L"http://schemas.openxmlformats.org/schemaLibrary/2006/main"),
|
||||
v (L"v", L"urn:schemas-microsoft-com:vml"),
|
||||
ve (L"ve", L"http://schemas.openxmlformats.org/markup-compatibility/2006"),
|
||||
vp (L"vp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"),
|
||||
vt (L"vt", L"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"),
|
||||
w (L"w", L"http://schemas.openxmlformats.org/wordprocessingml/2006/main"),
|
||||
w10 (L"w10", L"urn:schemas-microsoft-com:office:word"),
|
||||
wne (L"wne", L"http://schemas.microsoft.com/office/word/2006/wordml"),
|
||||
wp (L"wp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"),
|
||||
x (L"x", L"urn:schemas-microsoft-com:office:excel"),
|
||||
xdr (L"xdr", L"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"),
|
||||
xmlns(L"xmlns", L"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"),
|
||||
xsd(L"xsd", L"http://www.w3.org/2001/XMLSchema"),
|
||||
xsi(L"xsi", L"http://www.w3.org/2001/XMLSchema-instance")
|
||||
xsd (L"xsd", L"http://www.w3.org/2001/XMLSchema"),
|
||||
xsi (L"xsi", L"http://www.w3.org/2001/XMLSchema-instance"),
|
||||
p14 (L"p14", L"http://schemas.microsoft.com/office/powerpoint/2010/main")
|
||||
{
|
||||
}
|
||||
|
||||
@ -124,6 +126,7 @@ namespace PPTX
|
||||
const Namespace xmlns;
|
||||
const Namespace xsd;
|
||||
const Namespace xsi;
|
||||
const Namespace p14;
|
||||
};
|
||||
|
||||
static Namespaces g_Namespaces;
|
||||
|
||||
@ -37,19 +37,19 @@
|
||||
#include "FileContainer.h"
|
||||
#include "FileTypes.h"
|
||||
|
||||
#include "Limit/Conformance.h"
|
||||
#include "Logic/TextListStyle.h"
|
||||
#include "Logic/ClrMap.h"
|
||||
#include "Theme/ClrScheme.h"
|
||||
|
||||
#include "Presentation/EmbeddedFont.h"
|
||||
#include "Presentation/Kinsoku.h"
|
||||
#include "Presentation/NotesSz.h"
|
||||
#include "Presentation/PhotoAlbum.h"
|
||||
#include "Logic/XmlId.h"
|
||||
#include "Presentation/SldSz.h"
|
||||
#include "CommentAuthors.h"
|
||||
|
||||
#include "Limit/Conformance.h"
|
||||
#include "Logic/TextListStyle.h"
|
||||
#include "Logic/ClrMap.h"
|
||||
#include "Logic/ExtP.h"
|
||||
#include "Theme/ClrScheme.h"
|
||||
|
||||
namespace PPTX
|
||||
{
|
||||
class Presentation : public WrapperFile, public PPTX::FileContainer
|
||||
@ -87,7 +87,6 @@ namespace PPTX
|
||||
oNode.ReadAttributeBase(L"showSpecialPlsOnTitleSld", attrShowSpecialPlsOnTitleSld);
|
||||
oNode.ReadAttributeBase(L"strictFirstAndLastChars", attrStrictFirstAndLastChars);
|
||||
|
||||
|
||||
//custDataLst (Customer Data List)
|
||||
//custShowLst (List of Custom Shows)
|
||||
defaultTextStyle = oNode.ReadNode(_T("p:defaultTextStyle"));
|
||||
@ -100,8 +99,7 @@ namespace PPTX
|
||||
{
|
||||
oNodeEmbeddedFonts.LoadArray(_T("p:embeddedFont"), embeddedFontLst);
|
||||
|
||||
size_t count = embeddedFontLst.size();
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
for (size_t i = 0; i < embeddedFontLst.size(); ++i)
|
||||
embeddedFontLst[i].SetParentFilePointer(this);
|
||||
}
|
||||
|
||||
@ -111,8 +109,7 @@ namespace PPTX
|
||||
{
|
||||
oNodeHMList.LoadArray(_T("p:handoutMasterId"), handoutMasterIdLst);
|
||||
|
||||
size_t count = handoutMasterIdLst.size();
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
for (size_t i = 0; i < handoutMasterIdLst.size(); ++i)
|
||||
handoutMasterIdLst[i].SetParentFilePointer(this);
|
||||
}
|
||||
|
||||
@ -128,8 +125,7 @@ namespace PPTX
|
||||
{
|
||||
oNodeMIDList.LoadArray(_T("p:notesMasterId"), notesMasterIdLst);
|
||||
|
||||
size_t count = notesMasterIdLst.size();
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
for (size_t i = 0; i < notesMasterIdLst.size(); ++i)
|
||||
notesMasterIdLst[i].SetParentFilePointer(this);
|
||||
}
|
||||
|
||||
@ -147,8 +143,7 @@ namespace PPTX
|
||||
{
|
||||
oNode_sldId.LoadArray(_T("p:sldId"), sldIdLst);
|
||||
|
||||
size_t count = sldIdLst.size();
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
for (size_t i = 0; i < sldIdLst.size(); ++i)
|
||||
sldIdLst[i].SetParentFilePointer(this);
|
||||
}
|
||||
|
||||
@ -158,16 +153,36 @@ namespace PPTX
|
||||
{
|
||||
oNode_sldM_Id.LoadArray(_T("p:sldMasterId"), sldMasterIdLst);
|
||||
|
||||
size_t count = sldMasterIdLst.size();
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
for (size_t i = 0; i < sldMasterIdLst.size(); ++i)
|
||||
sldMasterIdLst[i].SetParentFilePointer(this);
|
||||
}
|
||||
|
||||
sldSz = oNode.ReadNode(_T("p:sldSz"));
|
||||
if (sldSz.is_init())
|
||||
sldSz->SetParentFilePointer(this);
|
||||
//smartTags (Smart Tags)
|
||||
|
||||
XmlUtils::CXmlNode list = oNode.ReadNodeNoNS(_T("extLst"));
|
||||
if (list.IsValid())
|
||||
{
|
||||
XmlUtils::CXmlNodes oNodes;
|
||||
if (list.GetNodes(_T("*"), oNodes))
|
||||
{
|
||||
int nCount = oNodes.GetCount();
|
||||
for (int i = 0; i < nCount; ++i)
|
||||
{
|
||||
XmlUtils::CXmlNode oNode;
|
||||
oNodes.GetAt(i, oNode);
|
||||
|
||||
PPTX::Logic::Ext ext;
|
||||
ext.fromXML(oNode);
|
||||
if (ext.sectionLst.IsInit())
|
||||
{
|
||||
sectionLst = ext.sectionLst;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//smartTags (Smart Tags)
|
||||
Normalize();
|
||||
}
|
||||
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const
|
||||
@ -205,6 +220,7 @@ namespace PPTX
|
||||
pWriter->WriteRecord2(5, sldSz);
|
||||
|
||||
pWriter->WriteRecord2(6, commentAuthors);
|
||||
pWriter->WriteRecord2(7, sectionLst);
|
||||
|
||||
pWriter->EndRecord();
|
||||
}
|
||||
@ -312,6 +328,12 @@ namespace PPTX
|
||||
commentAuthors->fromPPTY(pReader);
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
{
|
||||
sectionLst = new nsPresentation::SectionLst();
|
||||
sectionLst->fromPPTY(pReader);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
pReader->Seek(_end_pos);
|
||||
@ -350,11 +372,11 @@ namespace PPTX
|
||||
|
||||
pWriter->EndAttributes();
|
||||
|
||||
pWriter->WriteArray(_T("p:sldMasterIdLst"), sldMasterIdLst);
|
||||
pWriter->WriteArray(_T("p:notesMasterIdLst"), notesMasterIdLst);
|
||||
pWriter->WriteArray(_T("p:handoutMasterIdLst"), handoutMasterIdLst);
|
||||
pWriter->WriteArray(_T("p:embeddedFontLst"), embeddedFontLst);
|
||||
pWriter->WriteArray(_T("p:sldIdLst"), sldIdLst);
|
||||
pWriter->WriteArray(L"p:sldMasterIdLst", sldMasterIdLst);
|
||||
pWriter->WriteArray(L"p:notesMasterIdLst", notesMasterIdLst);
|
||||
pWriter->WriteArray(L"p:handoutMasterIdLst", handoutMasterIdLst);
|
||||
pWriter->WriteArray(L"p:embeddedFontLst", embeddedFontLst);
|
||||
pWriter->WriteArray(L"p:sldIdLst", sldIdLst);
|
||||
|
||||
pWriter->Write(sldSz);
|
||||
pWriter->Write(notesSz);
|
||||
@ -362,7 +384,17 @@ namespace PPTX
|
||||
pWriter->Write(kinsoku);
|
||||
pWriter->Write(defaultTextStyle);
|
||||
|
||||
pWriter->EndNode(_T("p:presentation"));
|
||||
std::vector<Logic::Ext> extLst;
|
||||
|
||||
if (sectionLst.IsInit())
|
||||
{
|
||||
Logic::Ext exp;
|
||||
exp.sectionLst = sectionLst;
|
||||
extLst.push_back(exp);
|
||||
}
|
||||
pWriter->WriteArray(L"p:extLst", extLst);
|
||||
|
||||
pWriter->EndNode(L"p:presentation");
|
||||
}
|
||||
|
||||
public:
|
||||
@ -380,7 +412,7 @@ namespace PPTX
|
||||
}
|
||||
|
||||
public:
|
||||
//Childs
|
||||
//Childs
|
||||
//custDataLst (Customer Data List)
|
||||
//property<std::list<Presentation::CustShow> > custShowLst (List of Custom Shows)
|
||||
nullable<Logic::TextListStyle> defaultTextStyle;
|
||||
@ -394,6 +426,7 @@ namespace PPTX
|
||||
std::vector<Logic::XmlId> sldIdLst;
|
||||
std::vector<Logic::XmlId> sldMasterIdLst;
|
||||
nullable<nsPresentation::SldSz> sldSz;
|
||||
nullable<nsPresentation::SectionLst> sectionLst;
|
||||
//smartTags (Smart Tags)
|
||||
|
||||
// Attrs
|
||||
|
||||
247
ASCOfficePPTXFile/PPTXFormat/Presentation/SectionLst.h
Normal file
247
ASCOfficePPTXFile/PPTXFormat/Presentation/SectionLst.h
Normal file
@ -0,0 +1,247 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../Logic/XmlId.h"
|
||||
|
||||
namespace PPTX
|
||||
{
|
||||
namespace Logic
|
||||
{
|
||||
class Section : public WrapperWritingElement
|
||||
{
|
||||
public:
|
||||
PPTX_LOGIC_BASE(Section)
|
||||
|
||||
nullable_string id;
|
||||
nullable_string name;
|
||||
std::vector<Logic::XmlId> arSldIdLst;
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
node.ReadAttributeBase(L"id", id);
|
||||
node.ReadAttributeBase(L"name", name);
|
||||
|
||||
XmlUtils::CXmlNode oNodeSldIdLst;
|
||||
if (node.GetNode(L"p14:sldIdLst", oNodeSldIdLst))
|
||||
{
|
||||
oNodeSldIdLst.LoadArray(L"p14:sldId", arSldIdLst);
|
||||
}
|
||||
}
|
||||
|
||||
virtual std::wstring toXML() const
|
||||
{
|
||||
return L"";
|
||||
}
|
||||
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
pWriter->StartNode(L"p14:section");
|
||||
|
||||
pWriter->StartAttributes();
|
||||
pWriter->WriteAttribute2(L"name", name);
|
||||
pWriter->WriteAttribute(L"id", id);
|
||||
|
||||
pWriter->EndAttributes();
|
||||
|
||||
pWriter->StartNode(L"p14:sldIdLst");
|
||||
pWriter->WriteArray2(arSldIdLst);
|
||||
pWriter->EndNode(L"p14:sldIdLst");
|
||||
|
||||
pWriter->EndNode(L"p14:section");
|
||||
}
|
||||
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
|
||||
pWriter->WriteString2(0, id);
|
||||
pWriter->WriteString2(1, name);
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
|
||||
|
||||
pWriter->WriteRecordArray(0, 0, arSldIdLst);
|
||||
|
||||
}
|
||||
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
|
||||
{
|
||||
LONG _end_rec = pReader->GetPos() + pReader->GetLong() + 4;
|
||||
|
||||
pReader->Skip(1); // start attributes
|
||||
|
||||
while (true)
|
||||
{
|
||||
BYTE _at = pReader->GetUChar_TypeNode();
|
||||
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
|
||||
break;
|
||||
|
||||
switch (_at)
|
||||
{
|
||||
case 0:
|
||||
id = pReader->GetString2();
|
||||
break;
|
||||
case 1:
|
||||
name = pReader->GetString2();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
while (pReader->GetPos() < _end_rec)
|
||||
{
|
||||
BYTE _rec = pReader->GetUChar();
|
||||
|
||||
switch (_rec)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
pReader->Skip(4); // len
|
||||
ULONG lCount = pReader->GetULong();
|
||||
|
||||
for (ULONG i = 0; i < lCount; ++i)
|
||||
{
|
||||
pReader->Skip(1);
|
||||
|
||||
Logic::XmlId sldId(L"p14:sldId");
|
||||
|
||||
arSldIdLst.push_back(sldId);
|
||||
arSldIdLst.back().fromPPTY(pReader);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
pReader->SkipRecord();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pReader->Seek(_end_rec);
|
||||
}
|
||||
|
||||
virtual void FillParentPointersForChilds()
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
namespace nsPresentation
|
||||
{
|
||||
class SectionLst : public WrapperWritingElement
|
||||
{
|
||||
public:
|
||||
PPTX_LOGIC_BASE(SectionLst)
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
XmlUtils::CXmlNodes oNodes;
|
||||
if (node.GetNodes(_T("*"), oNodes))
|
||||
{
|
||||
int nCount = oNodes.GetCount();
|
||||
for (int i = 0; i < nCount; ++i)
|
||||
{
|
||||
XmlUtils::CXmlNode oNode;
|
||||
oNodes.GetAt(i, oNode);
|
||||
|
||||
Logic::Section sect;
|
||||
|
||||
arSectionLst.push_back(sect);
|
||||
arSectionLst.back().fromXML(oNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
virtual std::wstring toXML() const
|
||||
{
|
||||
return L"";
|
||||
}
|
||||
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
|
||||
{
|
||||
LONG end = pReader->GetPos() + pReader->GetLong() + 4;
|
||||
|
||||
while (pReader->GetPos() < end)
|
||||
{
|
||||
BYTE _rec = pReader->GetUChar();
|
||||
|
||||
switch (_rec)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
pReader->Skip(4); // len
|
||||
ULONG lCount = pReader->GetULong();
|
||||
|
||||
for (ULONG i = 0; i < lCount; ++i)
|
||||
{
|
||||
pReader->Skip(1);
|
||||
|
||||
Logic::Section sect;
|
||||
|
||||
arSectionLst.push_back(sect);
|
||||
arSectionLst.back().fromPPTY(pReader);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
pReader->SkipRecord();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pReader->Seek(end);
|
||||
}
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
pWriter->WriteRecordArray(0, 0, arSectionLst);
|
||||
}
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
pWriter->StartNode(L"p14:sectionLst");
|
||||
|
||||
pWriter->StartAttributes();
|
||||
pWriter->WriteAttribute(L"xmlns:p14", PPTX::g_Namespaces.p14.m_strLink);
|
||||
pWriter->EndAttributes();
|
||||
|
||||
pWriter->WriteArray2(arSectionLst);
|
||||
|
||||
pWriter->EndNode(L"p14:sectionLst");
|
||||
}
|
||||
|
||||
std::vector<Logic::Section> arSectionLst;
|
||||
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds(){};
|
||||
};
|
||||
}
|
||||
} // namespace PPTX
|
||||
@ -2987,6 +2987,10 @@
|
||||
RelativePath="..\.\PPTXFormat\Presentation.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\PPTXFormat\Presentation\SectionLst.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\.\PPTXFormat\Presentation\SldSz.h"
|
||||
>
|
||||
|
||||
@ -969,6 +969,8 @@ void OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput, PPTX::
|
||||
PPTX::Theme *theme = oParam.oDocx->GetTheme();
|
||||
if (!theme || fmt_index <0) return;
|
||||
|
||||
if (style_ref->Color.is<PPTX::Logic::SchemeClr>() == false) return;
|
||||
|
||||
PPTX::Logic::SchemeClr & schemeClr = style_ref->Color.as<PPTX::Logic::SchemeClr>();
|
||||
|
||||
std::wstring color = schemeClr.val.get();
|
||||
|
||||
@ -47,24 +47,21 @@
|
||||
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
{
|
||||
if (argc < 3) return 0;
|
||||
if (argc < 2) return 0;
|
||||
|
||||
std::wstring sXMLOptions = _T("<Options><TXTOptions><Encoding>1000</Encoding></TXTOptions></Options>");
|
||||
std::wstring sXMLOptions = _T("<Options><TXTOptions><Encoding>50</Encoding></TXTOptions></Options>");
|
||||
|
||||
std::wstring srcFileName = argv[1];
|
||||
std::wstring dstFileName = argv[2];
|
||||
std::wstring outputDir = NSDirectory::GetFolderPath(dstFileName);
|
||||
|
||||
std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
|
||||
|
||||
int n1 = srcFileName.rfind(L".");
|
||||
int n2 = dstFileName.rfind(L".");
|
||||
|
||||
std::wstring ext_1 = n1>=0 ? srcFileName.substr(n1+1, srcFileName.length() - n1): L""; //ext_1.MakeLower();
|
||||
std::wstring ext_2 = n2>=0 ? dstFileName.substr(n2+1, dstFileName.length() - n2): L""; //ext_2.MakeLower();
|
||||
|
||||
int n1 = srcFileName.rfind(_T('.'));
|
||||
std::wstring ext_1 = n1 >= 0 ? srcFileName.substr(n1+1, srcFileName.length() - n1) : _T("");
|
||||
|
||||
std::transform(ext_1.begin(), ext_1.end(), ext_1.begin(), ::tolower);
|
||||
|
||||
std::wstring dstFileName = argc > 2 ? argv[2] : srcFileName + L"_my." + (ext_1 == L"txt" ? L"docx" : L"txt");
|
||||
|
||||
std::wstring outputDir = NSDirectory::GetFolderPath(dstFileName);
|
||||
std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
|
||||
|
||||
CTxtXmlFile txtFile;
|
||||
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
@ -77,7 +74,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
if (S_OK != oCOfficeUtils.CompressFileOrDirectory(dstTempPath.c_str(), dstFileName.c_str(), -1))
|
||||
return S_FALSE;
|
||||
}
|
||||
if (ext_2 == L"txt")
|
||||
else
|
||||
{
|
||||
// docx->txt
|
||||
if (S_OK != oCOfficeUtils.ExtractToDirectory(srcFileName.c_str(), dstTempPath.c_str(), NULL, 0))
|
||||
|
||||
@ -85,7 +85,7 @@ namespace Docx2Txt
|
||||
OOX::CDocument *pDocument, OOX::CNumbering* pNumbering, OOX::CStyles *pStyles);
|
||||
|
||||
size_t NoteCount;
|
||||
std::list<std::wstring> Notes;
|
||||
std::map<std::wstring, std::list<std::wstring>> Notes;
|
||||
|
||||
static std::wstring IntToLowerLetter (int number);
|
||||
static std::wstring IntToUpperLetter (int number);
|
||||
@ -198,10 +198,20 @@ namespace Docx2Txt
|
||||
|
||||
if(NoteCount != 0)
|
||||
{
|
||||
m_outputFile.m_listContent.push_back(_T("---------------------------"));
|
||||
for(std::list<std::wstring>::const_iterator iter = Notes.begin(); iter != Notes.end(); iter++)
|
||||
m_outputFile.m_listContent.push_back(L"");
|
||||
m_outputFile.m_listContent.push_back(L"---------------------------");
|
||||
|
||||
for(std::map<std::wstring, std::list<std::wstring>>::const_iterator iter_map = Notes.begin(); iter_map != Notes.end(); iter_map++)
|
||||
{
|
||||
m_outputFile.m_listContent.push_back(*iter);
|
||||
bool bFirst = true;
|
||||
|
||||
for(std::list<std::wstring>::const_iterator iter = iter_map->second.begin(); iter != iter_map->second.end(); iter++)
|
||||
{
|
||||
if (bFirst) m_outputFile.m_listContent.push_back(iter_map->first + L" " + *iter);
|
||||
else m_outputFile.m_listContent.push_back(*iter);
|
||||
|
||||
bFirst = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -491,31 +501,52 @@ namespace Docx2Txt
|
||||
|
||||
if (run->m_arrItems[j]->getType() == OOX::et_w_footnoteReference || run->m_arrItems[j]->getType() == OOX::et_w_endnoteReference)
|
||||
{// todooo Ref ????
|
||||
|
||||
std::list<std::wstring> notes_content;
|
||||
|
||||
OOX::Logic::CFootnoteReference* footnote_ref = dynamic_cast<OOX::Logic::CFootnoteReference*>(run->m_arrItems[j]);
|
||||
OOX::Logic::CEndnoteReference* endnote_ref = dynamic_cast<OOX::Logic::CEndnoteReference*>(run->m_arrItems[j]);
|
||||
NoteCount++;
|
||||
std::wstring s = _T("[") + ToWString(NoteCount) + _T("]");
|
||||
Notes.push_back(s);
|
||||
if(run->m_arrItems[j]->getType() == OOX::et_w_footnoteReference)
|
||||
|
||||
if (footnote_ref)
|
||||
{
|
||||
smart_ptr<OOX::File> pFile = pDocument->Find(OOX::FileTypes::FootNote);
|
||||
if (pFile.IsInit())
|
||||
{
|
||||
OOX::CFootnotes *pFootnotes = (OOX::CFootnotes*)pFile.operator->();
|
||||
for (long r =0 ;r < pFootnotes->m_arrFootnote.size(); r++)
|
||||
convert(pFootnotes->m_arrFootnote[r]->m_arrItems, Notes, Event, false, pDocument, pNumbering, pStyles);
|
||||
for (size_t r = 0; r < pFootnotes->m_arrFootnote.size(); r++)
|
||||
{
|
||||
OOX::CFtnEdn* note = dynamic_cast<OOX::CFtnEdn*>(pFootnotes->m_arrFootnote[r]);
|
||||
|
||||
if (note && note->m_oId == footnote_ref->m_oId)
|
||||
{
|
||||
convert(pFootnotes->m_arrFootnote[r]->m_arrItems, notes_content, Event, false, pDocument, pNumbering, pStyles);
|
||||
}
|
||||
}
|
||||
}
|
||||
Notes.insert(std::make_pair(ToWString(NoteCount), notes_content));
|
||||
}
|
||||
else if(run->m_arrItems[j]->getType() == OOX::et_w_endnoteReference)
|
||||
if (endnote_ref)
|
||||
{
|
||||
smart_ptr<OOX::File> pFile = pDocument->Find(OOX::FileTypes::EndNote);
|
||||
if (pFile.IsInit())
|
||||
{
|
||||
OOX::CEndnotes *pEndnotes = (OOX::CEndnotes*)pFile.operator->();
|
||||
for (long r =0 ;r < pEndnotes->m_arrEndnote.size(); r++)
|
||||
convert(pEndnotes->m_arrEndnote[r]->m_arrItems, Notes, Event, false, pDocument, pNumbering, pStyles);
|
||||
|
||||
for (size_t r =0; r < pEndnotes->m_arrEndnote.size(); r++)
|
||||
{
|
||||
OOX::CFtnEdn* note = dynamic_cast<OOX::CFtnEdn*>(pEndnotes->m_arrEndnote[r]);
|
||||
|
||||
if (note && note->m_oId == endnote_ref->m_oId)
|
||||
{
|
||||
convert(pEndnotes->m_arrEndnote[r]->m_arrItems, notes_content, Event, false, pDocument, pNumbering, pStyles);
|
||||
}
|
||||
}
|
||||
}
|
||||
Notes.insert(std::make_pair(ToWString(NoteCount), notes_content));
|
||||
}
|
||||
|
||||
wstr.replace(wstr.find(_T("_")), 1 , ToWString(NoteCount));
|
||||
wstr += L"[" + ToWString(NoteCount) + L"]"; ;
|
||||
}
|
||||
line += wstr;
|
||||
}
|
||||
|
||||
@ -104,13 +104,6 @@ static int ParseTxtOptions(const std::wstring & sXmlOptions)
|
||||
|
||||
HRESULT CTxtXmlFile::txt_LoadFromFile(const std::wstring & sSrcFileName, const std::wstring & sDstPath, const std::wstring & sXMLOptions)
|
||||
{
|
||||
//проверка на структуру xml - если что не так выкинет быстро
|
||||
//HRESULT hr = xml_LoadFromFile(sSrcFileName, sDstPath, sXMLOptions);
|
||||
//if(hr == S_OK)
|
||||
// return S_OK;
|
||||
|
||||
//As Text
|
||||
|
||||
Writers::FileWriter *pDocxWriter = new Writers::FileWriter(sDstPath, L"", true, 1, false, NULL, L"");
|
||||
if (pDocxWriter == NULL) return S_FALSE;
|
||||
|
||||
|
||||
@ -58,10 +58,17 @@ BaseObjectPtr DConn::clone()
|
||||
void DConn::readFields(CFRecord& record)
|
||||
{
|
||||
unsigned short flags1, reserved1;
|
||||
unsigned char flags2, reserved2;
|
||||
unsigned char flags2, reserved2, reserved3;
|
||||
|
||||
record >> frtHeaderOld >> dbt >> flags1 >> cParams >> reserved1 >> flags2 >> reserved2;
|
||||
|
||||
//DBT_ODBC 0x0001 ODBC-based source
|
||||
//DBT_DAO 0x0002 DAO-based source
|
||||
//DBT_WEB 0x0004 Web query
|
||||
//DBT_OLEDB 0x0005 OLE DB-based source
|
||||
//DBT_TXT 0x0006 Text-based source created via text query
|
||||
//DBT_ADO 0x0007 ADO record set
|
||||
|
||||
fSavePwd = GETBIT(flags1, 0);
|
||||
fTablesOnlyHtml = GETBIT(flags1, 1);
|
||||
fTableNames = GETBIT(flags1, 2);
|
||||
@ -84,17 +91,39 @@ void DConn::readFields(CFRecord& record)
|
||||
case 4: grbitDbt.reset(new ConnGrbitDbtWeb); break;
|
||||
case 5: grbitDbt.reset(new ConnGrbitDbtOledb); break;
|
||||
case 7: grbitDbt.reset(new ConnGrbitDbtAdo); break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (grbitDbt)
|
||||
{
|
||||
record >> *grbitDbt;
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned short unused;
|
||||
record >> unused;
|
||||
}
|
||||
|
||||
record >> bVerDbqueryEdit >> bVerDbqueryRefreshed >> bVerDbqueryRefreshableMin >> wRefreshInterval >> wHtmlFmt >> wHtmlFmt >> rcc >> credMethod;
|
||||
record >> bVerDbqueryEdit >> bVerDbqueryRefreshed >> bVerDbqueryRefreshableMin >> wRefreshInterval >> wHtmlFmt >> rcc >> credMethod >> reserved3;
|
||||
|
||||
record >> rgchSourceDataFile >> rgchSourceConnectionFile >> rgchConnectionName >> rgchConnectionDesc >> rgchSSOApplicationID >> tableNames;
|
||||
if (dbt == 5)
|
||||
{
|
||||
record >> rgchSourceDataFile;
|
||||
}
|
||||
|
||||
for ( unsigned short i = 0; i < cParams; i++)
|
||||
record >> rgchSourceConnectionFile >> rgchConnectionName >> rgchConnectionDesc;
|
||||
|
||||
if (dbt == 1 || dbt == 5)
|
||||
{
|
||||
record >> rgchSSOApplicationID;
|
||||
}
|
||||
|
||||
if (fTableNames)
|
||||
{
|
||||
record >> tableNames;
|
||||
}
|
||||
|
||||
for ( unsigned short i = 0; fStandAlone && i < cParams; i++)
|
||||
{
|
||||
DConnParameter val;
|
||||
params.push_back(val);
|
||||
@ -111,7 +140,22 @@ void DConn::readFields(CFRecord& record)
|
||||
if (connection)
|
||||
record >> *connection;
|
||||
|
||||
record >> rgbSQL >> rgbSQLSav >> rgbEditWebPage >> id;
|
||||
if (dbt == 1 || dbt == 5)
|
||||
{
|
||||
record >> rgbSQL;
|
||||
}
|
||||
|
||||
if (dbt == 1)
|
||||
{
|
||||
record >> rgbSQLSav;
|
||||
}
|
||||
|
||||
if (dbt == 4)
|
||||
{
|
||||
record >> rgbEditWebPage;
|
||||
}
|
||||
|
||||
record >> id;
|
||||
|
||||
int skip = record.getDataSize() - record.getRdPtr();
|
||||
|
||||
|
||||
@ -215,20 +215,30 @@ void XLUnicodeStringSegmented::load(CFRecord& record)
|
||||
record >> cchTotal;
|
||||
|
||||
if (cchTotal < 1) return;
|
||||
|
||||
if (cchTotal > record.getDataSize() - record.getRdPtr())
|
||||
{
|
||||
cchTotal = cchTotal >> 8;
|
||||
}
|
||||
|
||||
_UINT32 cchTotal_test = 0;
|
||||
while(true)
|
||||
{
|
||||
if (record.isEOF())
|
||||
break;
|
||||
|
||||
if (cchTotal_test >= cchTotal)
|
||||
break;
|
||||
|
||||
_UINT32 max_string_size = cchTotal - cchTotal_test;
|
||||
|
||||
XLUnicodeString string;
|
||||
record >> string;
|
||||
|
||||
cchTotal_test += string.value().length();
|
||||
|
||||
arStrings.push_back(string.value());
|
||||
|
||||
strTotal += string.value();
|
||||
cchTotal_test += arStrings.back().length();
|
||||
strTotal += arStrings.back();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -71,6 +71,10 @@ void PtgStr::loadFields(CFRecord& record)
|
||||
{
|
||||
string_ = string_.substr(1, string_.length() - 2);
|
||||
}
|
||||
else if (pos1 > 0)
|
||||
{
|
||||
boost::algorithm::replace_all(string_, L"\"", L"\"\"");
|
||||
}
|
||||
|
||||
string_ = L"\"" + string_ + L"\"";
|
||||
}
|
||||
|
||||
@ -67,6 +67,10 @@ void PtgSxName::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool f
|
||||
if ((name) && (name->ifdb >= 0 && name->ifdb < global_info->arPivotCacheSxNames.size()))
|
||||
{
|
||||
_Name = global_info->arPivotCacheSxNames[name->ifdb];
|
||||
if (std::wstring::npos != _Name.find(L" "))
|
||||
{
|
||||
_Name = L"'" + _Name + L"'";
|
||||
}
|
||||
}
|
||||
else if (!global_info->arPivotSxNames[sxIndex].pair.empty())
|
||||
{
|
||||
|
||||
@ -97,7 +97,7 @@ int DBB::serialize(std::wostream & strm)
|
||||
|
||||
for (size_t i = 0; i < arPivotCacheFields.size(); i++)
|
||||
{
|
||||
if(arPivotCacheFields[i] == false)
|
||||
if(arPivotCacheFields[i] == false && indexOPER < m_arSXOPER.size())
|
||||
{
|
||||
m_arSXOPER[indexOPER++]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
|
||||
@ -206,8 +206,8 @@ int DBQUERY::serialize_connection(std::wostream & strm)
|
||||
{
|
||||
CP_XML_NODE(L"connection")
|
||||
{
|
||||
CP_XML_ATTR(L"id", 1); //connectionId in connections(root)
|
||||
CP_XML_ATTR(L"name", L"Connection");
|
||||
CP_XML_ATTR(L"id", connectionId);
|
||||
CP_XML_ATTR(L"name", L"Connection" + std::to_wstring(connectionId));
|
||||
|
||||
CP_XML_ATTR(L"type", queryOrParam->query.dbt);
|
||||
//switch(queryOrParam->query.dbt)
|
||||
@ -222,22 +222,24 @@ int DBQUERY::serialize_connection(std::wostream & strm)
|
||||
//}
|
||||
|
||||
if (queryOrParam->query.fSavePwd) CP_XML_ATTR(L"savePassword", 1);
|
||||
if (queryOrParam->query.fSavePwd) CP_XML_ATTR(L"refreshedVersion", 1);
|
||||
CP_XML_ATTR(L"refreshedVersion", 1);
|
||||
|
||||
int index = 0;
|
||||
CP_XML_NODE(L"dbPr")
|
||||
{
|
||||
if (index < m_arSXString.size())
|
||||
std::wstring command, connection;
|
||||
for (index = 0; index < queryOrParam->query.cstQuery; index++)
|
||||
{
|
||||
CP_XML_ATTR(L"command", m_arSXString[index]);
|
||||
command += m_arSXString[index];
|
||||
}
|
||||
index++;
|
||||
|
||||
if (index < m_arSXString.size())
|
||||
|
||||
for (; index < queryOrParam->query.cstQuery + queryOrParam->query.cstOdbcConn; index++)
|
||||
{
|
||||
CP_XML_ATTR(L"connection", m_arSXString[index]);
|
||||
connection += m_arSXString[index];
|
||||
}
|
||||
index++;
|
||||
|
||||
CP_XML_ATTR(L"connection", connection);
|
||||
CP_XML_ATTR(L"command", command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -175,7 +175,7 @@ const bool FDB::loadContent(BinProcessor& proc)
|
||||
return true;
|
||||
}
|
||||
|
||||
int FDB::serialize(std::wostream & strm)
|
||||
int FDB::serialize(std::wostream & strm, bool bSql)
|
||||
{
|
||||
SXFDB* fdb = dynamic_cast<SXFDB*>(m_SXFDB.get());
|
||||
SXFDBType* fdb_type = dynamic_cast<SXFDBType*>(m_SXFDBType.get());
|
||||
@ -189,14 +189,21 @@ int FDB::serialize(std::wostream & strm)
|
||||
CP_XML_NODE(L"cacheField")
|
||||
{
|
||||
CP_XML_ATTR(L"name", fdb->stFieldName.value());
|
||||
|
||||
CP_XML_ATTR(L"numFmtId", fdb_type->wTypeSql);
|
||||
//CP_XML_ATTR(L"sqlType", fdb_type->wTypeSql); //in db
|
||||
|
||||
if (bSql)
|
||||
{
|
||||
CP_XML_ATTR(L"numFmtId", 0);
|
||||
if (fdb_type->wTypeSql > 0)
|
||||
CP_XML_ATTR(L"sqlType", fdb_type->wTypeSql);
|
||||
}
|
||||
else
|
||||
{
|
||||
CP_XML_ATTR(L"numFmtId", fdb_type->wTypeSql);
|
||||
}
|
||||
if (m_arSRCSXOPER.empty() && m_arGRPSXOPER.empty() == false)
|
||||
{
|
||||
CP_XML_ATTR(L"databaseField", 0);
|
||||
}
|
||||
|
||||
switch(fdb_type->wTypeSql)//format code
|
||||
{
|
||||
case 0x0000:
|
||||
|
||||
@ -47,7 +47,7 @@ public:
|
||||
|
||||
virtual const bool loadContent(BinProcessor& proc);
|
||||
|
||||
int serialize(std::wostream & strm);
|
||||
int serialize(std::wostream & strm, bool bSql);
|
||||
|
||||
static const ElementType type = typeFDB;
|
||||
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
#include "PIVOTCACHE.h"
|
||||
#include "SXSRC.h"
|
||||
#include "SXADDLCACHE.h"
|
||||
#include "FDB.h"
|
||||
|
||||
#include "../Biff_records/SXStreamID.h"
|
||||
#include "../Biff_records/SXVS.h"
|
||||
@ -110,6 +111,8 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm)
|
||||
|
||||
if (!db || !db_ex)return 0;
|
||||
|
||||
bool bSql = false;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"pivotCacheDefinition")
|
||||
@ -124,13 +127,16 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm)
|
||||
CP_XML_ATTR(L"enableRefresh", 1);
|
||||
CP_XML_ATTR(L"refreshedBy", db->rgb.value());
|
||||
CP_XML_ATTR(L"refreshedDate", db_ex->numDate.data.value);
|
||||
CP_XML_ATTR(L"recordCount", db->crdbUsed);
|
||||
CP_XML_ATTR(L"recordCount", db->crdbdb);
|
||||
//createdVersion="1"
|
||||
//refreshedVersion="2"
|
||||
//upgradeOnRefresh="1">
|
||||
SXSRC* src = dynamic_cast<SXSRC*>(m_SXSRC.get());
|
||||
if (src)
|
||||
{
|
||||
bSql = src->bSql;
|
||||
src->serialize(CP_XML_STREAM());
|
||||
}
|
||||
|
||||
if (pivot_cache->m_arFDB.empty() == false)
|
||||
{
|
||||
@ -140,7 +146,10 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm)
|
||||
|
||||
for (size_t i = 0; i < pivot_cache->m_arFDB.size(); i++)
|
||||
{
|
||||
pivot_cache->m_arFDB[i]->serialize(CP_XML_STREAM());
|
||||
FDB *field = dynamic_cast<FDB *>(pivot_cache->m_arFDB[i].get());
|
||||
if (!field) continue;
|
||||
|
||||
field->serialize(CP_XML_STREAM(), bSql);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,12 +193,15 @@ int PIVOTVIEW::serialize(std::wostream & strm)
|
||||
core->m_PIVOTPI->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"dataFields")
|
||||
if (core->m_arSXDI.empty() == false)
|
||||
{
|
||||
CP_XML_ATTR(L"count", view->cDimData);
|
||||
for (size_t i = 0; i < core->m_arSXDI.size(); i++)
|
||||
CP_XML_NODE(L"dataFields")
|
||||
{
|
||||
core->m_arSXDI[i]->serialize(CP_XML_STREAM());
|
||||
CP_XML_ATTR(L"count", view->cDimData);
|
||||
for (size_t i = 0; i < core->m_arSXDI.size(); i++)
|
||||
{
|
||||
core->m_arSXDI[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
//CP_XML_NODE(L"pivotTableStyleInfo")
|
||||
|
||||
@ -38,6 +38,8 @@
|
||||
#include "../Biff_records/SXString.h"
|
||||
#include "../Biff_records/SXDtr.h"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
@ -82,7 +84,10 @@ const bool SXOPER::loadContent(BinProcessor& proc)
|
||||
}
|
||||
bNumber = !bInteger;
|
||||
node = L"n";
|
||||
value = std::to_wstring(num->num.data.value);
|
||||
if (bInteger)
|
||||
value = std::to_wstring((int)num->num.data.value);
|
||||
else
|
||||
value = boost::lexical_cast<std::wstring>(num->num.data.value);
|
||||
}
|
||||
else if(proc.optional<SxBool>())
|
||||
{
|
||||
|
||||
@ -38,9 +38,9 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
SXSRC::SXSRC()
|
||||
{
|
||||
bSql = false;
|
||||
}
|
||||
|
||||
|
||||
@ -57,6 +57,7 @@ BaseObjectPtr SXSRC::clone()
|
||||
// SXSRC = DREF / SXTBL / DBQUERY
|
||||
const bool SXSRC::loadContent(BinProcessor& proc)
|
||||
{
|
||||
bSql = false;
|
||||
if(!proc.optional<DREF>())
|
||||
{
|
||||
if(!proc.optional<SXTBL>())
|
||||
@ -65,6 +66,7 @@ const bool SXSRC::loadContent(BinProcessor& proc)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bSql = true;
|
||||
}
|
||||
}
|
||||
m_source = elements_.back();
|
||||
|
||||
@ -52,6 +52,7 @@ public:
|
||||
static const ElementType type = typeSXSRC;
|
||||
|
||||
BaseObjectPtr m_source;
|
||||
bool bSql;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -44,9 +44,11 @@ namespace OOX
|
||||
public:
|
||||
RId() : m_id(0)
|
||||
{
|
||||
bNumber = false;
|
||||
}
|
||||
RId(const size_t id) : m_id(id)
|
||||
{
|
||||
bNumber = true;
|
||||
}
|
||||
RId(const std::wstring& rid)
|
||||
{
|
||||
@ -68,11 +70,13 @@ namespace OOX
|
||||
{
|
||||
std::wstring strParam = rid.substr(nFindStringLength);
|
||||
m_id = XmlUtils::GetUInteger(strParam);
|
||||
bNumber = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_id = 0;
|
||||
m_sId = rid;
|
||||
bNumber = false;
|
||||
}
|
||||
|
||||
return *this;
|
||||
@ -80,8 +84,9 @@ namespace OOX
|
||||
|
||||
const RId& operator= (const RId& oSrc)
|
||||
{
|
||||
m_id = oSrc.m_id;
|
||||
m_sId = oSrc.m_sId;
|
||||
m_id = oSrc.m_id;
|
||||
m_sId = oSrc.m_sId;
|
||||
bNumber = oSrc.bNumber;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -118,6 +123,7 @@ namespace OOX
|
||||
|
||||
const RId next() const
|
||||
{
|
||||
bNumber = true;
|
||||
return RId(m_id + 1);
|
||||
}
|
||||
|
||||
@ -125,8 +131,10 @@ namespace OOX
|
||||
{
|
||||
if(!m_sId.empty())
|
||||
return m_sId;
|
||||
else
|
||||
else if (bNumber)
|
||||
return _T("rId") + std::to_wstring((unsigned int)m_id);
|
||||
else
|
||||
return L"";
|
||||
}
|
||||
template<typename T>
|
||||
void toPPTY(BYTE type, T pWriter) const
|
||||
@ -137,6 +145,7 @@ namespace OOX
|
||||
private:
|
||||
size_t m_id;
|
||||
std::wstring m_sId;
|
||||
mutable bool bNumber;
|
||||
};
|
||||
} // namespace OOX
|
||||
|
||||
|
||||
@ -2377,6 +2377,38 @@ namespace NSEditorApi
|
||||
pEvent->Release();
|
||||
}
|
||||
};
|
||||
|
||||
class CAscCefMenuEvent : public CAscMenuEvent
|
||||
{
|
||||
public:
|
||||
int m_nSenderId;
|
||||
|
||||
public:
|
||||
CAscCefMenuEvent(int nType = -1) : CAscMenuEvent(nType)
|
||||
{
|
||||
m_nSenderId = -1;
|
||||
}
|
||||
virtual ~CAscCefMenuEvent()
|
||||
{
|
||||
}
|
||||
|
||||
LINK_PROPERTY_INT(SenderId)
|
||||
};
|
||||
|
||||
class CAscCefMenuEventListener
|
||||
{
|
||||
public:
|
||||
// memory release!!!
|
||||
virtual void OnEvent(CAscCefMenuEvent* pEvent)
|
||||
{
|
||||
if (NULL != pEvent)
|
||||
pEvent->Release();
|
||||
}
|
||||
virtual bool IsSupportEvent(int nEventType)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
namespace NSEditorApi
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
hunspell_build_static {
|
||||
DEFINES += HUNSPELL_STATIC
|
||||
}
|
||||
|
||||
building_hunspell {
|
||||
DEFINES += BUILDING_LIBHUNSPELL
|
||||
|
||||
@ -9,7 +9,17 @@ QT -= core gui
|
||||
TARGET = hunspell
|
||||
TEMPLATE = lib
|
||||
|
||||
hunspell_build_static {
|
||||
|
||||
CONFIG += staticlib
|
||||
|
||||
} else {
|
||||
|
||||
CONFIG += shared
|
||||
CONFIG += plugin
|
||||
|
||||
}
|
||||
|
||||
CONFIG += building_hunspell
|
||||
|
||||
CORE_ROOT_DIR = $$PWD/../../../..
|
||||
|
||||
5
Makefile
5
Makefile
@ -61,6 +61,7 @@ ASCDOCUMENTSCORE := $(LIBDIR)/$(LIB_PREFIX)ascdocumentscore$(SHARED_EXT)
|
||||
LIBXML := $(LIBDIR)/$(LIB_PREFIX)libxml$(LIB_EXT)
|
||||
LICENSEMANAGER := $(LIBDIR)/$(LIB_PREFIX)LicenceManager$(LIB_EXT)
|
||||
OOXMLSIGNATURE := $(LIBDIR)/$(LIB_PREFIX)ooxmlsignature$(LIB_EXT)
|
||||
HUNSPELL := $(LIBDIR)/$(LIB_PREFIX)hunspell$(SHARED_EXT)
|
||||
|
||||
TARGETS += $(ALLFONTSGEN)
|
||||
TARGETS += $(X2T)
|
||||
@ -89,6 +90,7 @@ TARGETS += $(ASCDOCUMENTSCORE)
|
||||
TARGETS += $(LIBXML)
|
||||
TARGETS += $(LICENSEMANAGER)
|
||||
TARGETS += $(OOXMLSIGNATURE)
|
||||
TARGETS += $(HUNSPELL)
|
||||
|
||||
X2T_PRO := $(abspath X2tConverter/build/Qt/X2tSLN.pro)
|
||||
HTMLFILEINTERNAL_PRO := $(abspath ../desktop-sdk/HtmlFile/Internal/Internal.pro)
|
||||
@ -117,6 +119,7 @@ ASCDOCUMENTSCORE_PRO := $(abspath ../desktop-sdk/ChromiumBasedEditors/lib/AscDoc
|
||||
LIBXML_PRO := $(abspath DesktopEditor/xml/build/qt/libxml2.pro)
|
||||
LICENSEMANAGER_PRO := $(abspath LicenceManager/linux/LicenseManager.pro)
|
||||
OOXMLSIGNATURE_PRO := $(abspath DesktopEditor/xmlsec/src/ooxmlsignature.pro)
|
||||
HUNSPELL_PRO := $(abspath DesktopEditor/hunspell-1.3.3/src/qt/hunspell.pro)
|
||||
|
||||
# PROS += $(basename $(X2T_PRO)).build
|
||||
# PROS += ALLFONTSGEN_PRO
|
||||
@ -168,6 +171,7 @@ QT_PROJ += ASCDOCUMENTSCORE
|
||||
QT_PROJ += LIBXML
|
||||
QT_PROJ += LICENSEMANAGER
|
||||
QT_PROJ += OOXMLSIGNATURE
|
||||
QT_PROJ += HUNSPELL
|
||||
|
||||
# X2T_DEP += $(XLSFORMATLIB)
|
||||
# X2T_DEP += $(ODFFILEWRITERLIB)
|
||||
@ -217,6 +221,7 @@ ASCDOCUMENTSCORE_DEP += $(XPSFILE)
|
||||
#ASCDOCUMENTSCORE_DEP += $(LICENSEMANAGER)
|
||||
ASCDOCUMENTSCORE_DEP += $(LIBXML)
|
||||
ASCDOCUMENTSCORE_DEP += $(OOXMLSIGNATURE)
|
||||
ASCDOCUMENTSCORE_DEP += $(HUNSPELL)
|
||||
|
||||
OOXMLSIGNATURE_DEP += $(LIBXML)
|
||||
|
||||
|
||||
@ -128,6 +128,7 @@ namespace NExtractTools
|
||||
// Save to file (from temp dir)
|
||||
BinDocxRW::CDocxSerializer m_oCDocxSerializer;
|
||||
|
||||
m_oCDocxSerializer.setIsNoBase64(params.getIsNoBase64());
|
||||
m_oCDocxSerializer.setFontDir(params.getFontPath());
|
||||
|
||||
//bool bRes = m_oCDocxSerializer.saveToFile (sResDoct, sSrcDocx, sTemp);
|
||||
@ -188,7 +189,8 @@ namespace NExtractTools
|
||||
|
||||
BinDocxRW::CDocxSerializer m_oCDocxSerializer;
|
||||
|
||||
m_oCDocxSerializer.setFontDir(params.getFontPath());
|
||||
m_oCDocxSerializer.setIsNoBase64(params.getIsNoBase64());
|
||||
m_oCDocxSerializer.setFontDir(params.getFontPath());
|
||||
|
||||
std::wstring sXmlOptions = _T("");
|
||||
std::wstring sThemePath; // will be filled by 'CreateDocxFolders' method
|
||||
@ -255,6 +257,7 @@ namespace NExtractTools
|
||||
// Save to file (from temp dir)
|
||||
BinXlsxRW::CXlsxSerializer m_oCXlsxSerializer;
|
||||
|
||||
m_oCXlsxSerializer.setIsNoBase64(params.getIsNoBase64());
|
||||
m_oCXlsxSerializer.setFontDir(params.getFontPath());
|
||||
|
||||
return m_oCXlsxSerializer.saveToFile (sTo, sXlsxDir, bXmlOptions ? params.getXmlOptions() : L"") ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
@ -309,7 +312,8 @@ namespace NExtractTools
|
||||
|
||||
BinXlsxRW::CXlsxSerializer m_oCXlsxSerializer;
|
||||
|
||||
m_oCXlsxSerializer.setFontDir(params.getFontPath());
|
||||
m_oCXlsxSerializer.setIsNoBase64(params.getIsNoBase64());
|
||||
m_oCXlsxSerializer.setFontDir(params.getFontPath());
|
||||
|
||||
std::wstring sXmlOptions = _T("");
|
||||
std::wstring sMediaPath; // will be filled by 'CreateXlsxFolders' method
|
||||
@ -377,6 +381,7 @@ namespace NExtractTools
|
||||
|
||||
if (pptx_file)
|
||||
{
|
||||
pptx_file->SetIsNoBase64(params.getIsNoBase64());
|
||||
pptx_file->put_TempDirectory(sTemp);
|
||||
pptx_file->SetFontDir (params.getFontPath());
|
||||
nRes = (S_OK == pptx_file->OpenFileToPPTY (sFrom, sTo)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
@ -438,6 +443,7 @@ namespace NExtractTools
|
||||
|
||||
if (pptx_file)
|
||||
{
|
||||
pptx_file->SetIsNoBase64(params.getIsNoBase64());
|
||||
pptx_file->SetFontDir(params.getFontPath());
|
||||
nRes = (S_OK == pptx_file->ConvertPPTYToPPTX(sTargetBin, sTo, sThemeDir)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
|
||||
@ -492,7 +498,8 @@ namespace NExtractTools
|
||||
// Save to file (from temp dir)
|
||||
BinXlsxRW::CXlsxSerializer m_oCXlsxSerializer;
|
||||
|
||||
m_oCXlsxSerializer.setFontDir(params.getFontPath());
|
||||
m_oCXlsxSerializer.setIsNoBase64(params.getIsNoBase64());
|
||||
m_oCXlsxSerializer.setFontDir(params.getFontPath());
|
||||
|
||||
int nRes = m_oCXlsxSerializer.saveToFile (sResultXlstFileEditor, sCSV, params.getXmlOptions()) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
if (SUCCEEDED_X2T(nRes))
|
||||
@ -517,6 +524,7 @@ namespace NExtractTools
|
||||
// Save to file (from temp dir)
|
||||
BinXlsxRW::CXlsxSerializer m_oCXlsxSerializer;
|
||||
|
||||
m_oCXlsxSerializer.setIsNoBase64(params.getIsNoBase64());
|
||||
m_oCXlsxSerializer.setFontDir(params.getFontPath());
|
||||
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
@ -541,6 +549,7 @@ namespace NExtractTools
|
||||
// Save to file (from temp dir)
|
||||
BinXlsxRW::CXlsxSerializer m_oCXlsxSerializer;
|
||||
|
||||
m_oCXlsxSerializer.setIsNoBase64(params.getIsNoBase64());
|
||||
m_oCXlsxSerializer.setFontDir(params.getFontPath());
|
||||
|
||||
return m_oCXlsxSerializer.saveToFile(sTo, sFrom, params.getXmlOptions()) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
@ -562,6 +571,7 @@ namespace NExtractTools
|
||||
|
||||
BinXlsxRW::CXlsxSerializer m_oCXlsxSerializer;
|
||||
|
||||
m_oCXlsxSerializer.setIsNoBase64(params.getIsNoBase64());
|
||||
m_oCXlsxSerializer.setFontDir(params.getFontPath());
|
||||
|
||||
std::wstring sMediaPath;
|
||||
@ -587,6 +597,7 @@ namespace NExtractTools
|
||||
// Save to file (from temp dir)
|
||||
BinXlsxRW::CXlsxSerializer m_oCXlsxSerializer;
|
||||
|
||||
m_oCXlsxSerializer.setIsNoBase64(params.getIsNoBase64());
|
||||
m_oCXlsxSerializer.setFontDir(params.getFontPath());
|
||||
|
||||
std::wstring sXMLOptions = _T("");
|
||||
@ -617,6 +628,7 @@ namespace NExtractTools
|
||||
// Save to file (from temp dir)
|
||||
BinXlsxRW::CXlsxSerializer m_oCXlsxSerializer;
|
||||
|
||||
m_oCXlsxSerializer.setIsNoBase64(params.getIsNoBase64());
|
||||
m_oCXlsxSerializer.setFontDir(params.getFontPath());
|
||||
|
||||
std::wstring sToTemp = sTemp + FILE_SEPARATOR_STR + _T("output.csv");
|
||||
@ -645,7 +657,14 @@ namespace NExtractTools
|
||||
pdfWriter.SetTempFolder(sTemp);
|
||||
pdfWriter.SetThemesPlace(sThemeDir);
|
||||
int nReg = (bPaid == false) ? 0 : 1;
|
||||
return S_OK == pdfWriter.OnlineWordToPdf(sFrom, sTo) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
if (params.getIsNoBase64())
|
||||
{
|
||||
return S_OK == pdfWriter.OnlineWordToPdfFromBinary(sFrom, sTo) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
else
|
||||
{
|
||||
return S_OK == pdfWriter.OnlineWordToPdf(sFrom, sTo) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
}
|
||||
int bin2image (const std::wstring &sTFileDir, BYTE* pBuffer, LONG lBufferLen, const std::wstring &sTo, const std::wstring &sTemp, const std::wstring &sThemeDir, InputParams& params)
|
||||
{
|
||||
@ -1713,8 +1732,8 @@ namespace NExtractTools
|
||||
std::wstring sTempDocx = sTemp + FILE_SEPARATOR_STR + wsFilePathInFilename + L"_DOCX";
|
||||
NSDirectory::CreateDirectory(sTempDocx);
|
||||
|
||||
BinDocxRW::CDocxSerializer m_oCDocxSerializer;
|
||||
|
||||
BinDocxRW::CDocxSerializer m_oCDocxSerializer;
|
||||
m_oCDocxSerializer.setIsNoBase64(params.getIsNoBase64());
|
||||
m_oCDocxSerializer.setFontDir(params.getFontPath());
|
||||
|
||||
std::wstring sXmlOptions;
|
||||
|
||||
@ -358,6 +358,7 @@ namespace NExtractTools
|
||||
std::wstring* m_sHtmlFileInternalPath;
|
||||
std::wstring* m_sPassword;
|
||||
std::wstring* m_sTempDir;
|
||||
bool* m_bIsNoBase64;
|
||||
//output params
|
||||
mutable bool m_bOutputConvertCorrupted;
|
||||
public:
|
||||
@ -383,6 +384,7 @@ namespace NExtractTools
|
||||
m_sHtmlFileInternalPath = NULL;
|
||||
m_sPassword = NULL;
|
||||
m_sTempDir = NULL;
|
||||
m_bIsNoBase64 = NULL;
|
||||
|
||||
m_bOutputConvertCorrupted = false;
|
||||
}
|
||||
@ -408,6 +410,7 @@ namespace NExtractTools
|
||||
RELEASEOBJECT(m_sHtmlFileInternalPath);
|
||||
RELEASEOBJECT(m_sPassword);
|
||||
RELEASEOBJECT(m_sTempDir);
|
||||
RELEASEOBJECT(m_bIsNoBase64);
|
||||
}
|
||||
|
||||
bool FromXmlFile(const std::wstring& sFilename)
|
||||
@ -496,6 +499,8 @@ namespace NExtractTools
|
||||
m_sPassword = new std::wstring(sValue);
|
||||
else if(_T("m_sTempDir") == sName)
|
||||
m_sTempDir = new std::wstring(sValue);
|
||||
else if(_T("m_bIsNoBase64") == sName)
|
||||
m_bIsNoBase64 = new bool(XmlUtils::GetBoolean2(sValue));
|
||||
}
|
||||
else if(_T("m_nCsvDelimiterChar") == sName)
|
||||
{
|
||||
@ -523,6 +528,10 @@ namespace NExtractTools
|
||||
{
|
||||
return (NULL != m_sFontDir) ? (*m_sFontDir) : L"";
|
||||
}
|
||||
bool getIsNoBase64() const
|
||||
{
|
||||
return (NULL != m_bIsNoBase64) ? (*m_bIsNoBase64) : false;
|
||||
}
|
||||
std::wstring getXmlOptions()
|
||||
{
|
||||
std::wstring sRes;
|
||||
|
||||
@ -41,6 +41,7 @@ namespace BinXlsxRW
|
||||
|
||||
const static wchar_t* g_sFormatSignature = L"XLSY";
|
||||
const int g_nFormatVersion = 2;
|
||||
const int g_nFormatVersionNoBase64 = 10;
|
||||
extern int g_nCurFormatVersion;
|
||||
|
||||
namespace c_oFileTypes{enum c_oFileTypes
|
||||
|
||||
@ -4244,7 +4244,7 @@ namespace BinXlsxRW
|
||||
RELEASEOBJECT(m_oBcw);
|
||||
}
|
||||
void Open(const std::wstring& sInputDir, const std::wstring& sFileDst, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager,
|
||||
NSBinPptxRW::CDrawingConverter* pOfficeDrawingConverter, const std::wstring& sXMLOptions)
|
||||
NSBinPptxRW::CDrawingConverter* pOfficeDrawingConverter, const std::wstring& sXMLOptions, bool bIsNoBase64)
|
||||
{
|
||||
OOX::CPath path(sFileDst);
|
||||
//создаем папку для media
|
||||
@ -4286,21 +4286,35 @@ namespace BinXlsxRW
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bIsNoBase64)
|
||||
{
|
||||
oBufferedStream.WriteStringUtf8(WriteFileHeader(0, g_nFormatVersionNoBase64));
|
||||
}
|
||||
intoBindoc(*pXlsx, oBufferedStream, pEmbeddedFontsManager, pOfficeDrawingConverter);
|
||||
|
||||
BYTE* pbBinBuffer = oBufferedStream.GetBuffer();
|
||||
int nBinBufferLen = oBufferedStream.GetPosition();
|
||||
int nBase64BufferLen = Base64::Base64EncodeGetRequiredLength(nBinBufferLen, Base64::B64_BASE64_FLAG_NOCRLF);
|
||||
BYTE* pbBase64Buffer = new BYTE[nBase64BufferLen+64];
|
||||
if(true == Base64_1::Base64Encode(pbBinBuffer, nBinBufferLen, pbBase64Buffer, &nBase64BufferLen))
|
||||
if (bIsNoBase64)
|
||||
{
|
||||
CFile oFile;
|
||||
oFile.CreateFile(sFileDst);
|
||||
oFile.WriteStringUTF8(WriteFileHeader(nBinBufferLen));
|
||||
oFile.WriteFile(pbBase64Buffer, nBase64BufferLen);
|
||||
NSFile::CFileBinary oFile;
|
||||
oFile.CreateFileW(sFileDst);
|
||||
oFile.WriteFile(pbBinBuffer, nBinBufferLen);
|
||||
oFile.CloseFile();
|
||||
}
|
||||
RELEASEARRAYOBJECTS(pbBase64Buffer);
|
||||
else
|
||||
{
|
||||
int nBase64BufferLen = Base64::Base64EncodeGetRequiredLength(nBinBufferLen, Base64::B64_BASE64_FLAG_NOCRLF);
|
||||
BYTE* pbBase64Buffer = new BYTE[nBase64BufferLen+64];
|
||||
if(true == Base64_1::Base64Encode(pbBinBuffer, nBinBufferLen, pbBase64Buffer, &nBase64BufferLen))
|
||||
{
|
||||
NSFile::CFileBinary oFile;
|
||||
oFile.CreateFileW(sFileDst);
|
||||
oFile.WriteStringUTF8(WriteFileHeader(nBinBufferLen, g_nFormatVersion));
|
||||
oFile.WriteFile(pbBase64Buffer, nBase64BufferLen);
|
||||
oFile.CloseFile();
|
||||
}
|
||||
RELEASEARRAYOBJECTS(pbBase64Buffer);
|
||||
}
|
||||
}
|
||||
|
||||
RELEASEOBJECT(pXlsx);
|
||||
@ -4368,9 +4382,9 @@ namespace BinXlsxRW
|
||||
WriteMainTableEnd();
|
||||
}
|
||||
private:
|
||||
std::wstring WriteFileHeader(int nDataSize)
|
||||
std::wstring WriteFileHeader(int nDataSize, int version)
|
||||
{
|
||||
std::wstring sHeader = std::wstring(g_sFormatSignature) + L";v" + std::to_wstring(g_nFormatVersion)+ L";" + std::to_wstring(nDataSize) + L";";
|
||||
std::wstring sHeader = std::wstring(g_sFormatSignature) + L";v" + std::to_wstring(version)+ L";" + std::to_wstring(nDataSize) + L";";
|
||||
return sHeader;
|
||||
}
|
||||
void WriteMainTableStart()
|
||||
|
||||
@ -4262,25 +4262,41 @@ namespace BinXlsxRW {
|
||||
else
|
||||
dst_len += _c;
|
||||
}
|
||||
int nDataSize = atoi(dst_len.c_str());
|
||||
BYTE* pData = new BYTE[nDataSize];
|
||||
|
||||
if(false != Base64::Base64Decode((const char*)(pBase64Data + nIndex), nBase64DataSize - nIndex, pData, &nDataSize))
|
||||
int nVersion = g_nFormatVersion;
|
||||
if(!version.empty())
|
||||
{
|
||||
NSBinPptxRW::CBinaryFileReader& oBufferedStream = *pOfficeDrawingConverter->m_pReader;
|
||||
oBufferedStream.Init(pData, 0, nDataSize);
|
||||
version = version.substr(1);
|
||||
g_nCurFormatVersion = nVersion = std::stoi(version.c_str());
|
||||
}
|
||||
bool bIsNoBase64 = nVersion == g_nFormatVersionNoBase64;
|
||||
|
||||
int nVersion = g_nFormatVersion;
|
||||
if(version.length() > 0)
|
||||
NSBinPptxRW::CBinaryFileReader& oBufferedStream = *pOfficeDrawingConverter->m_pReader;
|
||||
|
||||
int nDataSize = 0;
|
||||
BYTE* pData = NULL;
|
||||
if (!bIsNoBase64)
|
||||
{
|
||||
nDataSize = atoi(dst_len.c_str());
|
||||
pData = new BYTE[nDataSize];
|
||||
if(Base64::Base64Decode((const char*)(pBase64Data + nIndex), nBase64DataSize - nIndex, pData, &nDataSize))
|
||||
{
|
||||
version = version.substr(1);
|
||||
|
||||
int nTempVersion = atoi(version.c_str());
|
||||
if(0 != nTempVersion)
|
||||
{
|
||||
g_nCurFormatVersion = nVersion = nTempVersion;
|
||||
}
|
||||
oBufferedStream.Init(pData, 0, nDataSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
RELEASEARRAYOBJECTS(pData);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nDataSize = nBase64DataSize;
|
||||
pData = pBase64Data;
|
||||
oBufferedStream.Init(pData, 0, nDataSize);
|
||||
oBufferedStream.Seek(nIndex);
|
||||
}
|
||||
|
||||
if(NULL != pData)
|
||||
{
|
||||
// File Type
|
||||
std::wstring sDstPathCSV = sDstPath;
|
||||
BYTE fileType;
|
||||
@ -4321,7 +4337,13 @@ namespace BinXlsxRW {
|
||||
}
|
||||
bResultOk = true;
|
||||
}
|
||||
if (!bIsNoBase64)
|
||||
{
|
||||
RELEASEARRAYOBJECTS(pData);
|
||||
}
|
||||
|
||||
}
|
||||
RELEASEARRAYOBJECTS(pBase64Data);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user