Compare commits

..

6 Commits

Author SHA1 Message Date
2c4bb7c808 for bug 34498. ULong 2017-03-23 20:24:52 +03:00
15a711396f x2t xlsx outline level save/read in binary 2017-03-22 17:53:09 +03:00
3d8403346b fix added bug 34297 2017-03-20 17:42:00 +03:00
5700503efe fix build converter ios 2017-03-16 12:56:04 +03:00
d01b1e7d41 fix bug 33781 2017-03-15 13:28:49 +03:00
584cc6ab80 fix bug 34297 2017-03-11 18:47:30 +03:00
15 changed files with 165 additions and 109 deletions

View File

@ -6689,7 +6689,7 @@ public:
else if ( c_oSerImageType2::RelativeHeight == type )
{
pDrawingProperty->bRelativeHeight = true;
pDrawingProperty->RelativeHeight = m_oBufferedStream.GetLong();
pDrawingProperty->RelativeHeight = m_oBufferedStream.GetULong();
}
else if ( c_oSerImageType2::BSimplePos == type )
{

View File

@ -5651,7 +5651,7 @@ namespace BinDocxRW
{
m_oBcw.m_oStream.WriteBYTE(c_oSerImageType2::RelativeHeight);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(pAnchor.m_oRelativeHeight->GetValue());
m_oBcw.m_oStream.WriteULONG(pAnchor.m_oRelativeHeight->GetValue());
}
if(pAnchor.m_bSimplePos.IsInit())
{

View File

@ -263,7 +263,7 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
if(false != Base64::Base64Decode((const char*)(pBase64Data + nIndex), nBase64DataSize - nIndex, pData, &nDataSize))
{
NSBinPptxRW::CDrawingConverter oDrawingConverter;
NSBinPptxRW::CDrawingConverter oDrawingConverter;
NSBinPptxRW::CBinaryFileReader& oBufferedStream = *oDrawingConverter.m_pReader;
oBufferedStream.Init(pData, 0, nDataSize);

View File

@ -85,9 +85,9 @@ namespace BinXlsxRW{
}
bool CXlsxSerializer::loadFromFile(const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sMediaDir, const std::wstring& sEmbedDir)
{
NSBinPptxRW::CDrawingConverter oOfficeDrawingConverter;
oOfficeDrawingConverter.SetMediaDstPath(sMediaDir);
oOfficeDrawingConverter.SetEmbedDstPath(sEmbedDir);
NSBinPptxRW::CDrawingConverter oOfficeDrawingConverter;
oOfficeDrawingConverter.SetMediaDstPath(sMediaDir);
oOfficeDrawingConverter.SetEmbedDstPath(sEmbedDir);
//папка с бинарников
std::wstring strFileInDir = NSSystemPath::GetDirectoryName(sSrcFileName);
@ -95,7 +95,7 @@ namespace BinXlsxRW{
oOfficeDrawingConverter.SetSourceFileDir(strFileInDir, 2);
BinXlsxRW::BinaryFileReader oBinaryFileReader;
oBinaryFileReader.ReadFile(sSrcFileName, sDstPath, &oOfficeDrawingConverter, sXMLOptions);
oBinaryFileReader.ReadFile(sSrcFileName, sDstPath, &oOfficeDrawingConverter, sXMLOptions);
return true;
}
bool CXlsxSerializer::saveToFile(const std::wstring& sDstFileName, const std::wstring& sSrcPath, const std::wstring& sXMLOptions)

View File

@ -33,6 +33,7 @@
6967B1C11E27B4B800A129E2 /* RtfWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6967B1991E27B4B800A129E2 /* RtfWriter.cpp */; };
6967B1C21E27B4B800A129E2 /* OOXDocumentWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6967B19F1E27B4B800A129E2 /* OOXDocumentWriter.cpp */; };
6967B1C31E27B4B800A129E2 /* OOXWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6967B1A81E27B4B800A129E2 /* OOXWriter.cpp */; };
69ACB6D31E7A983400096E94 /* svg_parser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 69ACB6D11E7A983400096E94 /* svg_parser.cpp */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@ -167,6 +168,8 @@
6967B1C61E27B81B00A129E2 /* StringBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StringBuilder.h; path = ../../../../DesktopEditor/common/StringBuilder.h; sourceTree = "<group>"; };
6967B1C71E27B89400A129E2 /* PPTShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PPTShape.h; path = ../../../../ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTShape/PPTShape.h; sourceTree = "<group>"; };
6967B1C81E27B8F900A129E2 /* BaseShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BaseShape.h; path = ../../../../ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/BaseShape.h; sourceTree = "<group>"; };
69ACB6D11E7A983400096E94 /* svg_parser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = svg_parser.cpp; path = ../../../../ASCOfficeOdfFile/src/odf/svg_parser.cpp; sourceTree = "<group>"; };
69ACB6D21E7A983400096E94 /* svg_parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = svg_parser.h; path = ../../../../ASCOfficeOdfFile/src/odf/svg_parser.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -208,6 +211,7 @@
6967B13D1E27B4B800A129E2 /* Reader */ = {
isa = PBXGroup;
children = (
69ACB6D01E7A982B00096E94 /* odf */,
6967B13E1E27B4B800A129E2 /* OOXAbstractNumReader.h */,
6967B13F1E27B4B800A129E2 /* OOXAppReader.h */,
6967B1401E27B4B800A129E2 /* OOXBorderReader.h */,
@ -355,6 +359,15 @@
name = common;
sourceTree = "<group>";
};
69ACB6D01E7A982B00096E94 /* odf */ = {
isa = PBXGroup;
children = (
69ACB6D11E7A983400096E94 /* svg_parser.cpp */,
69ACB6D21E7A983400096E94 /* svg_parser.h */,
);
name = odf;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@ -419,6 +432,7 @@
6967B1B61E27B4B800A129E2 /* RtfField.cpp in Sources */,
6967B1BB1E27B4B800A129E2 /* RtfParagraph.cpp in Sources */,
6967B1AC1E27B4B800A129E2 /* OOXDrawingGraphicReader.cpp in Sources */,
69ACB6D31E7A983400096E94 /* svg_parser.cpp in Sources */,
6967B1AD1E27B4B800A129E2 /* OOXHeaderReader.cpp in Sources */,
6967B1B31E27B4B800A129E2 /* RtfBookmark.cpp in Sources */,
6967B1C11E27B4B800A129E2 /* RtfWriter.cpp in Sources */,
@ -547,6 +561,7 @@
PPT_DEF,
_IOS,
DONT_WRITE_EMBEDDED_FONTS,
AVS_USE_CONVERT_PPTX_TOCUSTOM_VML,
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
@ -579,6 +594,7 @@
PPT_DEF,
_IOS,
DONT_WRITE_EMBEDDED_FONTS,
AVS_USE_CONVERT_PPTX_TOCUSTOM_VML,
);
HEADER_SEARCH_PATHS = (
"$(inherited)",

View File

@ -297,7 +297,13 @@ namespace OOX
case 'x':
if ( _T("x:ClientData") == sName )
{
pItem = new OOX::Vml::CClientData( oReader );
OOX::Vml::CClientData * client_data = dynamic_cast<OOX::Vml::CClientData*>(pItem);
if ((client_data) && (client_data->m_oObjectType.IsInit()))
if (client_data->m_oObjectType->GetValue() == SimpleTypes::Vml::vmlclientdataobjecttypeNote)
m_bComment = true;
}
break;

View File

@ -56,7 +56,7 @@ namespace OOX
{
public:
WritingElement_AdditionConstructors(CVmlCommonElements)
CVmlCommonElements(){}
CVmlCommonElements(){m_bComment = false;}
virtual ~CVmlCommonElements(){}
@ -137,6 +137,9 @@ namespace OOX
std::wstring WriteAttributes() const;
std::wstring WriteElements() const;
//internal
bool m_bComment;
};
//--------------------------------------------------------------------------------

View File

@ -102,7 +102,7 @@ namespace OOX
ReadAttributes( oReader );
std::wstring elementContent;
bool bReadyElement = false;//собираем все до нахождения собственно элемента
bool bReadyElement = false;//собираем все до нахождения собственно элемента
if ( !oReader.IsEmptyNode() )
{
@ -219,12 +219,15 @@ namespace OOX
OOX::Vml::CVmlCommonElements* common = dynamic_cast<OOX::Vml::CVmlCommonElements*>(pItem);
std::wstring sSpid;
bool bComment = false;
if (common)
{
if (common->m_sSpId.IsInit()) sSpid = *common->m_sSpId;
else if (common->m_sId.IsInit())sSpid = *common->m_sId;
}
bComment = common->m_bComment;
}
else
{
OOX::Vml::CGroup *group = dynamic_cast<OOX::Vml::CGroup*>(pItem);
@ -243,11 +246,13 @@ namespace OOX
element.nId = (int)m_arrItems.size()-1;
element.sXml = elementContent;
element.pElement = pItem;
element.bUsed = bComment;
m_mapShapes.insert(std::make_pair(sSpid, element));
}
elementContent.clear();
bReadyElement = false;
bReadyElement = false;
bComment = false;
}
}
}

View File

@ -224,7 +224,15 @@ namespace OOX
if (pShape == NULL) continue;
for(size_t j = 0, length2 = pShape->m_arrItems.size(); j < length2; ++j)
if (pShape->m_sId.IsInit())
{//mark shape as used
std::map<std::wstring, OOX::CVmlDrawing::_vml_shape>::iterator pFind = pVmlDrawing->m_mapShapes.find(pShape->m_sId.get());
if (pFind != pVmlDrawing->m_mapShapes.end())
{
pFind->second.bUsed = true;
}
}
for(size_t j = 0, length2 = pShape->m_arrItems.size(); j < length2; ++j)
{
OOX::WritingElement* pElem = pShape->m_arrItems[j];
if( OOX::et_v_ClientData == pElem->getType())

View File

@ -553,6 +553,11 @@ HRESULT CPdfRenderer::NewPage()
m_oFont.Reset();
m_oPath.Clear();
// clear font!!!
m_oFont.SetName(L"");
m_oFont.SetSize(-1);
m_oFont.SetStyle(1 << 5);
m_lClipDepth = 0;
m_nPagesCount++;//printf("Page %d\n", m_nPagesCount++);

View File

@ -7,7 +7,7 @@
QT -= core
QT -= gui
VERSION = 2.0.3.446
VERSION = 2.0.3.447
DEFINES += INTVER=$$VERSION
TARGET = x2t

View File

@ -344,52 +344,41 @@ namespace NExtractTools
else return AVS_FILEUTILS_ERROR_CONVERT;
}
return pptx_dir2pptt_bin(sTempUnpackedPPTX, sTo, params);
return pptx_dir2pptt_bin(sTempUnpackedPPTX, sTo, sTemp, params);
}
int pptx_dir2pptt_bin (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params)
int pptx_dir2pptt_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{
// convert unzipped pptx to unzipped pptt
CPPTXFile *pptx_file = new CPPTXFile(NULL, NULL, NULL, NULL);
int nRes = 0;
if (pptx_file)
{
#if defined(_WIN32) || defined (_WIN64)
BSTR bstrFontPath = SysAllocString(params.getFontPath().c_str());
BSTR bstrTempUnpackedPPTX = SysAllocString(sFrom.c_str());
BSTR bstrTo = SysAllocString(sTo.c_str());
pptx_file->SetFontDir (bstrFontPath);
nRes = (S_OK == pptx_file->OpenFileToPPTY (bstrTempUnpackedPPTX, bstrTo)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
SysFreeString(bstrFontPath);
SysFreeString(bstrTempUnpackedPPTX);
SysFreeString(bstrTo);
#else
pptx_file->put_TempDirectory(sTemp);
pptx_file->SetFontDir (params.getFontPath());
nRes = (S_OK == pptx_file->OpenFileToPPTY (sFrom, sTo)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
#endif
delete pptx_file;
}
return nRes;
}
}
// pptx -> pptt
int pptx2pptt (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{
std::wstring sResultPpttDir = sTemp + FILE_SEPARATOR_STR + L"pptt_unpacked";
std::wstring sTempPpttFileEditor = sResultPpttDir + FILE_SEPARATOR_STR + L"Editor.bin";
std::wstring sResultPpttDir = sTemp + FILE_SEPARATOR_STR + _T("pptt_unpacked");
std::wstring sTempPpttFileEditor = sResultPpttDir + FILE_SEPARATOR_STR + _T("Editor.bin");
NSDirectory::CreateDirectory(sResultPpttDir);
int nRes = pptx2pptt_bin(sFrom, sTempPpttFileEditor, sTemp, params);
if (SUCCEEDED_X2T(nRes))
{
// zip pptt folder to output file
COfficeUtils oCOfficeUtils(NULL);
nRes = (S_OK == oCOfficeUtils.CompressFileOrDirectory (sResultPpttDir, sTo, -1)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
}
COfficeUtils oCOfficeUtils(NULL);
nRes = (S_OK == oCOfficeUtils.CompressFileOrDirectory (sResultPpttDir, sTo)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
}
return nRes;
}
@ -2160,36 +2149,36 @@ namespace NExtractTools
}
int fromPptxDir(const std::wstring &sFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sTemp, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, InputParams& params)
{
int nRes = 0;
if(0 != (AVS_OFFICESTUDIO_FILE_PRESENTATION & nFormatTo))
{
if(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX == nFormatTo)
{
nRes = dir2zip(sFrom, sTo);
}
//else if(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT == nFormatTo)
//else if(AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP == nFormatTo)
else
nRes = AVS_FILEUTILS_ERROR_CONVERT;
}
else if(AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION == nFormatTo)
{
nRes = pptx_dir2pptt_bin(sFrom, sTo, params);
}
else
{
std::wstring sPpttDir = sTemp + FILE_SEPARATOR_STR + L"pptt_unpacked";
NSDirectory::CreateDirectory(sPpttDir);
std::wstring sTFile = sPpttDir + FILE_SEPARATOR_STR + L"Editor.bin";
nRes = pptx_dir2pptt_bin(sFrom, sTFile, params);
if(SUCCEEDED_X2T(nRes))
{
nRes = fromPpttBin(sTFile, sTo, nFormatTo, sTemp, sThemeDir, bFromChanges, bPaid, params);
}
}
return nRes;
{
int nRes = 0;
if(0 != (AVS_OFFICESTUDIO_FILE_PRESENTATION & nFormatTo))
{
if(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX == nFormatTo)
{
nRes = dir2zip(sFrom, sTo);
}
//else if(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT == nFormatTo)
//else if(AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP == nFormatTo)
else
nRes = AVS_FILEUTILS_ERROR_CONVERT;
}
else if(AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION == nFormatTo)
{
nRes = pptx_dir2pptt_bin(sFrom, sTo, sTemp, params);
}
else
{
std::wstring sPpttDir = sTemp + FILE_SEPARATOR_STR + _T("pptt_unpacked");
NSDirectory::CreateDirectory(sPpttDir);
std::wstring sTFile = sPpttDir + FILE_SEPARATOR_STR + _T("Editor.bin");
nRes = pptx_dir2pptt_bin(sFrom, sTFile, sTemp, params);
if(SUCCEEDED_X2T(nRes))
{
nRes = fromPpttBin(sTFile, sTo, nFormatTo, sTemp, sThemeDir, bFromChanges, bPaid, params);
}
}
return nRes;
}
int fromPpttBin(const std::wstring &sFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sTemp, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, InputParams& params)
{

50
XlsxSerializerCom/Common/BinReaderWriterDefines.h Normal file → Executable file
View File

@ -242,39 +242,41 @@ namespace BinXlsxRW
};}
namespace c_oSerWorksheetColTypes{enum c_oSerWorksheetColTypes
{
BestFit = 0,
Hidden = 1,
Max = 2,
Min = 3,
Style = 4,
Width = 5,
CustomWidth = 6
BestFit = 0,
Hidden = 1,
Max = 2,
Min = 3,
Style = 4,
Width = 5,
CustomWidth = 6,
OutLevel = 7
};}
namespace c_oSerHyperlinkTypes{enum c_oSerWorksheetColTypes
{
Ref = 0,
Hyperlink = 1,
Location = 2,
Tooltip = 3,
Display = 4
Ref = 0,
Hyperlink = 1,
Location = 2,
Tooltip = 3,
Display = 4
};}
namespace c_oSerSheetFormatPrTypes{enum c_oSerSheetFormatPrTypes
{
DefaultColWidth = 0,
DefaultRowHeight = 1,
BaseColWidth = 2,
CustomHeight = 3,
ZeroHeight = 4
DefaultColWidth = 0,
DefaultRowHeight = 1,
BaseColWidth = 2,
CustomHeight = 3,
ZeroHeight = 4
};}
namespace c_oSerRowTypes{enum c_oSerRowTypes
{
Row = 0,
Style = 1,
Height = 2,
Hidden = 3,
Cells = 4,
Cell = 5,
CustomHeight = 6
Row = 0,
Style = 1,
Height = 2,
Hidden = 3,
Cells = 4,
Cell = 5,
CustomHeight = 6,
OutLevel = 7
};}
namespace c_oSerCellTypes{enum c_oSerCellTypes
{

View File

@ -1937,14 +1937,20 @@ namespace BinXlsxRW {
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDoubleReal(oCol.m_oWidth->GetValue());
}
//CustomWidth
if(oCol.m_oCustomWidth.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerWorksheetColTypes::CustomWidth);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(oCol.m_oCustomWidth->ToBool());
}
}
//CustomWidth
if(oCol.m_oCustomWidth.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerWorksheetColTypes::CustomWidth);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(oCol.m_oCustomWidth->ToBool());
}
if(oCol.m_oOutlineLevel.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerWorksheetColTypes::OutLevel);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(oCol.m_oOutlineLevel->GetValue());
}
}
void WriteSheetViews(const OOX::Spreadsheet::CSheetViews& oSheetViews)
{
@ -2402,7 +2408,13 @@ namespace BinXlsxRW {
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBOOL(oRows.m_oCustomHeight->ToBool());
}
if(oRows.m_arrItems.size() > 0)
if(oRows.m_oOutlineLevel.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerRowTypes::OutLevel);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(oRows.m_oOutlineLevel->GetValue());
}
if(oRows.m_arrItems.size() > 0)
{
m_oBcw.m_oStream.WriteBYTE(c_oSerRowTypes::Cells);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);

View File

@ -2118,7 +2118,7 @@ namespace BinXlsxRW {
else
res = c_oSerConstants::ReadUnknown;
return res;
};
}
int ReadWorksheetProp(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
@ -2140,7 +2140,7 @@ namespace BinXlsxRW {
else
res = c_oSerConstants::ReadUnknown;
return res;
};
}
int ReadWorksheetCols(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
@ -2153,7 +2153,7 @@ namespace BinXlsxRW {
else
res = c_oSerConstants::ReadUnknown;
return res;
};
}
int ReadWorksheetCol(BYTE type, long length, void* poResult)
{
OOX::Spreadsheet::CCol* pCol = static_cast<OOX::Spreadsheet::CCol*>(poResult);
@ -2198,10 +2198,15 @@ namespace BinXlsxRW {
pCol->m_oCustomWidth.Init();
pCol->m_oCustomWidth->SetValue(false != m_oBufferedStream.GetBool() ? SimpleTypes::onoffTrue : SimpleTypes::onoffFalse);
}
else
else if(c_oSerWorksheetColTypes::OutLevel == type)
{
pCol->m_oOutlineLevel.Init();
pCol->m_oOutlineLevel->SetValue(m_oBufferedStream.GetLong());
}
else
res = c_oSerConstants::ReadUnknown;
return res;
};
}
int ReadSheetViews(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
@ -2978,7 +2983,12 @@ namespace BinXlsxRW {
pRow->m_oCustomHeight.Init();
pRow->m_oCustomHeight->SetValue(false != m_oBufferedStream.GetBool() ? SimpleTypes::onoffTrue : SimpleTypes::onoffFalse);
}
else if(c_oSerRowTypes::Cells == type)
else if(c_oSerRowTypes::OutLevel == type)
{
pRow->m_oOutlineLevel.Init();
pRow->m_oOutlineLevel->SetValue(m_oBufferedStream.GetLong());
}
else if(c_oSerRowTypes::Cells == type)
{
res = Read1(length, &BinaryWorksheetsTableReader::ReadCells, this, pRow);
}