Compare commits

...

12 Commits

Author SHA1 Message Date
d27b7b2f56 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
* 'develop' of https://github.com/ONLYOFFICE/core:
  x2t version up
  for bug 34597
  fix bug 34603
  for bug 34498
2017-03-31 17:57:44 +03:00
1dbf3e83ad ios collaboration 2017-03-31 17:57:35 +03:00
4a7d40d3fb x2t version up 2017-03-31 08:17:46 +03:00
f7f2629e9d for bug 34597 2017-03-30 16:51:08 +03:00
048c2fd034 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2017-03-30 16:04:22 +03:00
8977e2c792 fix bug 34603 2017-03-30 16:02:23 +03:00
bd5863a02d for bug 34498 2017-03-29 20:12:04 +03:00
bf6bfce051 fix bug 34509 2017-03-24 20:02:11 +03:00
805c24ff1a fix bug 27498 2017-03-24 18:35:08 +03:00
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
17 changed files with 130 additions and 70 deletions

View File

@ -2062,7 +2062,7 @@ distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\"><wp:extent cx=\"" + std::to_wstr
int nSimplePos = 0;
if(bBSimplePos && BSimplePos)
nSimplePos = 1;
int nRelativeHeight = 0;
unsigned long nRelativeHeight = 0;
if(bRelativeHeight)
nRelativeHeight = RelativeHeight;
int nBehindDoc = 0;

View File

@ -6589,6 +6589,9 @@ public:
OOX::CPath pathChartsWorksheetDir = m_oFileWriter.m_oChartWriter.m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR +_T("embeddings");
OOX::CSystemUtility::CreateDirectories(pathChartsWorksheetDir.GetPath());
bool oldValueType = m_oFileWriter.m_pDrawingConverter->m_pImageManager->m_bIsWord;
m_oFileWriter.m_pDrawingConverter->m_pImageManager->m_bIsWord = false;
m_oFileWriter.m_pDrawingConverter->SetDstContentRels();
std::wstring sThemeDir;
@ -6640,6 +6643,8 @@ public:
m_oFileWriter.m_pDrawingConverter->WriteRels(bstrChartRelType, sRelsName, std::wstring(), &rIdChart);
pDrawingProperty->sChartRels = L"rId" + std::to_wstring( rIdChart);
m_oFileWriter.m_pDrawingConverter->m_pImageManager->m_bIsWord = oldValueType;
}
else
res = c_oSerConstants::ReadUnknown;
@ -6689,7 +6694,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

@ -111,7 +111,13 @@ namespace PPTX
XmlUtils::CAttribute oAttr;
oAttr.Write(_T("id"), id);
oAttr.Write(_T("name"), XmlUtils::EncodeXmlString(name));
if (descr.IsInit()) oAttr.Write(_T("descr"), XmlUtils::EncodeXmlString(descr.get()));
if (descr.IsInit())
{
std::wstring d = XmlUtils::EncodeXmlString(descr.get());
XmlUtils::replace_all(d, L"\n", L"&#xA;");
oAttr.Write(_T("descr"), d);
}
oAttr.Write(_T("hidden"), hidden);
if (title.IsInit()) oAttr.Write(_T("title"), XmlUtils::EncodeXmlString(title.get()));
@ -157,7 +163,12 @@ namespace PPTX
pWriter->StartAttributes();
pWriter->WriteAttribute (_T("id"), _id);
pWriter->WriteAttribute (_T("name"), XmlUtils::EncodeXmlString(name));
if (descr.IsInit()) pWriter->WriteAttribute (_T("descr"), XmlUtils::EncodeXmlString(descr.get()));
if (descr.IsInit())
{
std::wstring d = XmlUtils::EncodeXmlString(descr.get());
XmlUtils::replace_all(d, L"\n", L"&#xA;");
pWriter->WriteAttribute (_T("descr"), d);
}
pWriter->WriteAttribute (_T("hidden"), hidden);
if (title.IsInit()) pWriter->WriteAttribute (_T("title"), XmlUtils::EncodeXmlString(title.get()));

View File

@ -217,18 +217,25 @@ namespace PPTX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("b"), b)
WritingElement_ReadAttributes_Read_if ( oReader, _T("altLang"), altLang)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("b"), b)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("bmk"), bmk)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("cap"), cap)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("dirty"), dirty)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("err"), err)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("i"), i)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("kern"), kern)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("kumimoji"), kumimoji)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("lang"), lang)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("noProof"), noProof)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("normalizeH"), normalizeH)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("smtClean"), smtClean)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("smtId"), smtId)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("strike"), strike)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("sz"), sz)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("u"), u)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("baseline"), baseline)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("spc"), spc)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("lang"), lang)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("kumimoji"), kumimoji)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("dirty"), dirty)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("normalizeH"), normalizeH)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("noProof"), noProof)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("smtClean"), smtClean)
WritingElement_ReadAttributes_End ( oReader )
Normalize();
@ -673,4 +680,4 @@ namespace PPTX
} // namespace Logic
} // namespace PPTX
#endif // PPTX_LOGIC_RUNPROPERTIES_INCLUDE_H
#endif // PPTX_LOGIC_RUNPROPERTIES_INCLUDE_H

View File

@ -176,7 +176,9 @@ namespace OOX
if ( m_sDescr.IsInit() )
{
sResult += _T("descr=\"");
sResult += m_sDescr.get2();
std::wstring d = XmlUtils::EncodeXmlString(m_sDescr.get());
XmlUtils::replace_all(d, L"\n", L"&#xA;");
sResult += d;
sResult += _T("\" ");
}
if ( m_oHidden.IsInit() ) sResult += _T("hidden=\"") + m_oHidden->ToString() + _T("\" ");

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

@ -1066,12 +1066,7 @@ namespace OOX{
}
else if(_T("clrMapOvr") == sName)
{
int nParentDepth1 = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth1 ) )
{
std::wstring sName1 = XmlUtils::GetNameNoNS(oReader.GetName());
m_oClrMapOvr = oReader;
}
m_oClrMapOvr = oReader;
}
else if(_T("pivotSource") == sName)
{

View File

@ -531,6 +531,7 @@ namespace NSEditorApi
private:
js_wrapper<CAscImageRaw> m_oRaw;
js_wrapper<std::wstring> m_sPath;
js_wrapper<std::wstring> m_sUploadPath;
js_wrapper<std::string> m_sBase64;
js_wrapper<CAscBinaryData> m_oBinaryData;
@ -544,6 +545,7 @@ namespace NSEditorApi
LINK_PROPERTY_OBJECT_JS(CAscImageRaw, Raw)
LINK_PROPERTY_STRING_JS(Path)
LINK_PROPERTY_STRING_JS(UploadPath)
LINK_PROPERTY_STRINGA_JS(Base64)
LINK_PROPERTY_OBJECT_JS(CAscBinaryData, BinaryData)
};

View File

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

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);
}