mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fc8784c540 | |||
| 17fe15948a | |||
| 38f11a9f4a | |||
| ea43991901 | |||
| 51781066b6 | |||
| 189cb94892 | |||
| 974b0cc984 | |||
| a202a87a67 | |||
| 7e33da3883 | |||
| 040c6abdef | |||
| 118bd98f4f | |||
| df69792402 | |||
| 6e20801b45 |
@ -47,10 +47,6 @@ const int heightrule_AtLeast = 0x00;
|
||||
const int heightrule_Auto = 0x01;
|
||||
const int heightrule_Exact = 0x02;
|
||||
|
||||
const int vertalign_Baseline = 0;
|
||||
const int vertalign_SuperScript = 1;
|
||||
const int vertalign_SubScript = 2;
|
||||
|
||||
const int align_Right = 0;
|
||||
const int align_Left = 1;
|
||||
const int align_Center = 2;
|
||||
|
||||
@ -586,12 +586,7 @@ void Binary_rPrWriter::Write_rPr(OOX::Logic::CRunProperty* rPr)
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::VertAlign);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
switch(rPr->m_oVertAlign.get().m_oVal.get().GetValue())
|
||||
{
|
||||
case SimpleTypes::verticalalignrunSuperscript: m_oBcw.m_oStream.WriteBYTE(vertalign_SuperScript);break;
|
||||
case SimpleTypes::verticalalignrunSubscript: m_oBcw.m_oStream.WriteBYTE(vertalign_SubScript);break;
|
||||
default: m_oBcw.m_oStream.WriteBYTE(vertalign_Baseline);break;
|
||||
}
|
||||
m_oBcw.m_oStream.WriteBYTE(rPr->m_oVertAlign.get().m_oVal.get().GetValue());
|
||||
}
|
||||
//HighLight
|
||||
if (false != rPr->m_oHighlight.IsInit() || false != rPr->m_oShd.IsInit())
|
||||
|
||||
@ -32,6 +32,8 @@
|
||||
|
||||
#include "Pic.h"
|
||||
|
||||
#include "../../../ASCOfficeXlsFile2/source/XlsXlsxConverter/ConvertXls2Xlsx.h"
|
||||
#include "../../../ASCOfficeDocFile/DocFormatLib/DocFormatLib.h"
|
||||
#include "../../../ASCOfficeDocxFile2/BinWriter/BinEquationWriter.h"
|
||||
#include "../../../ASCOfficeDocxFile2/BinWriter/BinWriters.h"
|
||||
#include "../../../ASCOfficeDocxFile2/BinReader/Readers.h"
|
||||
@ -127,16 +129,60 @@ namespace PPTX
|
||||
void COLEObject::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
smart_ptr<OOX::OleObject> ole_file = m_OleObjectFile;
|
||||
|
||||
if(m_oId.IsInit() && ole_file.IsInit() == false)
|
||||
|
||||
if (m_oId.IsInit() && ole_file.IsInit() == false)
|
||||
{
|
||||
OOX::IFileContainer* pRels = pWriter->GetRels().GetPointer();
|
||||
|
||||
ole_file = GetOleObject(m_oId.get(), pRels);
|
||||
}
|
||||
}
|
||||
std::wstring sData;
|
||||
std::wstring sProgID = m_sProgId.get_value_or(L"");
|
||||
|
||||
//test xls ole_file for convert to xlsx
|
||||
|
||||
COfficeFileFormatChecker checker;
|
||||
if (ole_file.IsInit() && (checker.isXlsFormatFile(ole_file->filename().GetPath()) ||
|
||||
checker.isDocFormatFile(ole_file->filename().GetPath())))
|
||||
{
|
||||
std::wstring sTemp = ole_file->filename().GetDirectory();
|
||||
|
||||
std::wstring sResultOoxmlDir = sTemp + FILE_SEPARATOR_STR + _T("ooxml_unpacked");
|
||||
NSDirectory::CreateDirectory(sResultOoxmlDir);
|
||||
|
||||
bool bMacro = true;
|
||||
_UINT32 nRes = 0;
|
||||
std::wstring ooxml_file;
|
||||
|
||||
if (checker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS)
|
||||
{
|
||||
nRes = ConvertXls2Xlsx(ole_file->filename().GetPath(), sResultOoxmlDir, L"", L"", sTemp, 0, bMacro);
|
||||
|
||||
ooxml_file = ole_file->filename().GetPath() + (bMacro ? L".xlsm" : L".xlsx");
|
||||
}
|
||||
else if (checker.nFileType == AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC)
|
||||
{
|
||||
COfficeDocFile docFile;
|
||||
docFile.m_sTempFolder = ole_file->filename().GetDirectory();
|
||||
|
||||
nRes = docFile.LoadFromFile(ole_file->filename().GetPath(), sResultOoxmlDir, L"", bMacro);
|
||||
|
||||
ooxml_file = ole_file->filename().GetPath() + (bMacro ? L".docm" : L".docx");
|
||||
}
|
||||
if (0 == nRes)
|
||||
{
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
nRes = (S_OK == oCOfficeUtils.CompressFileOrDirectory(sResultOoxmlDir, ooxml_file)) ? nRes : S_FALSE;
|
||||
}
|
||||
NSDirectory::DeleteDirectory(sResultOoxmlDir);
|
||||
|
||||
if (0 == nRes && false == ooxml_file.empty())
|
||||
{
|
||||
ole_file->set_MsPackage(true);
|
||||
ole_file->set_filename(ooxml_file, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (ole_file.IsInit() && 0 == sProgID.find(L"asc."))
|
||||
{
|
||||
sData = GetOleData(ole_file->filename().GetPath());
|
||||
@ -149,7 +195,8 @@ namespace PPTX
|
||||
pWriter->WriteInt2 (3, m_oDyaOrig);
|
||||
pWriter->WriteLimit2(4, m_oDrawAspect);
|
||||
pWriter->WriteLimit2(5, m_oType);
|
||||
pWriter->WriteLimit2(6, m_oUpdateMode);
|
||||
pWriter->WriteLimit2(6, m_oUpdateMode);
|
||||
|
||||
if (ole_file.IsInit() && ole_file->isMsPackage() == false)
|
||||
{
|
||||
std::wstring sExt = ole_file->filename().GetExtention(false);
|
||||
|
||||
@ -34,32 +34,43 @@
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
HorizontalPageBreaks::HorizontalPageBreaks() {}
|
||||
HorizontalPageBreaks::~HorizontalPageBreaks() {}
|
||||
|
||||
HorizontalPageBreaks::HorizontalPageBreaks()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
HorizontalPageBreaks::~HorizontalPageBreaks()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BaseObjectPtr HorizontalPageBreaks::clone()
|
||||
{
|
||||
return BaseObjectPtr(new HorizontalPageBreaks(*this));
|
||||
}
|
||||
|
||||
void HorizontalPageBreaks::readFields(CFRecord& record)
|
||||
{
|
||||
record >> cbrk;
|
||||
for (int i = 0; i < cbrk ; i++)
|
||||
BaseObjectPtr HorizontalPageBreaks::clone()
|
||||
{
|
||||
HorzBrkPtr hb(new HorzBrk);
|
||||
record >> *hb;
|
||||
rgbrk.push_back(hb);
|
||||
return BaseObjectPtr(new HorizontalPageBreaks(*this));
|
||||
}
|
||||
}
|
||||
|
||||
void HorizontalPageBreaks::readFields(CFRecord& record)
|
||||
{
|
||||
record >> cbrk;
|
||||
for (int i = 0; i < cbrk; i++)
|
||||
{
|
||||
HorzBrkPtr hb(new HorzBrk);
|
||||
record >> *hb;
|
||||
rgbrk.push_back(hb);
|
||||
}
|
||||
}
|
||||
int HorizontalPageBreaks::serialize(std::wostream & stream)
|
||||
{
|
||||
if (rgbrk.empty()) return 0;
|
||||
|
||||
CP_XML_WRITER(stream)
|
||||
{
|
||||
CP_XML_NODE(L"rowBreaks")
|
||||
{
|
||||
CP_XML_ATTR(L"count", cbrk);
|
||||
CP_XML_ATTR(L"manualBreakCount", cbrk);
|
||||
|
||||
for (size_t i = 0; i < rgbrk.size(); ++i)
|
||||
{
|
||||
if (rgbrk[i])
|
||||
rgbrk[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -37,29 +37,24 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
class HorizontalPageBreaks : public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(HorizontalPageBreaks)
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(HorizontalPageBreaks)
|
||||
public:
|
||||
HorizontalPageBreaks();
|
||||
~HorizontalPageBreaks();
|
||||
|
||||
// Logical representation of HorizontalPageBreaks record in BIFF8
|
||||
class HorizontalPageBreaks: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(HorizontalPageBreaks)
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(HorizontalPageBreaks)
|
||||
public:
|
||||
HorizontalPageBreaks();
|
||||
~HorizontalPageBreaks();
|
||||
BaseObjectPtr clone();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeHorizontalPageBreaks;
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeHorizontalPageBreaks;
|
||||
|
||||
virtual int serialize(std::wostream & stream);
|
||||
//-----------------------------
|
||||
_UINT16 cbrk;
|
||||
BiffStructurePtrVector rgbrk;
|
||||
|
||||
};
|
||||
|
||||
_UINT16 cbrk;
|
||||
BiffStructurePtrVector rgbrk;
|
||||
};
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -64,10 +64,14 @@ void SST::readFields(CFRecord& record)
|
||||
{
|
||||
XLUnicodeRichExtendedStringPtr element(new XLUnicodeRichExtendedString(recs));
|
||||
|
||||
if (record.getRdPtr() + 3 > record.getDataSize()) // If the break is at the XLUnicodeRichExtendedString boundary
|
||||
if (record.getRdPtr() == record.getDataSize())
|
||||
{
|
||||
element->appendNextContinue(record, false);
|
||||
}
|
||||
else if (record.getRdPtr() + 3 > record.getDataSize())
|
||||
{
|
||||
element->appendNextContinue(record, true);
|
||||
}
|
||||
|
||||
if (record.getRdPtr() + 3 > record.getDataSize())
|
||||
break;
|
||||
|
||||
@ -34,32 +34,43 @@
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
VerticalPageBreaks::VerticalPageBreaks() {}
|
||||
VerticalPageBreaks::~VerticalPageBreaks() {}
|
||||
|
||||
VerticalPageBreaks::VerticalPageBreaks()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
VerticalPageBreaks::~VerticalPageBreaks()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BaseObjectPtr VerticalPageBreaks::clone()
|
||||
{
|
||||
return BaseObjectPtr(new VerticalPageBreaks(*this));
|
||||
}
|
||||
|
||||
void VerticalPageBreaks::readFields(CFRecord& record)
|
||||
{
|
||||
record >> cbrk;
|
||||
for (int i = 0; i < cbrk ; ++i)
|
||||
BaseObjectPtr VerticalPageBreaks::clone()
|
||||
{
|
||||
VertBrkPtr vb(new VertBrk);
|
||||
record >> *vb;
|
||||
rgbrk.push_back(vb);
|
||||
return BaseObjectPtr(new VerticalPageBreaks(*this));
|
||||
}
|
||||
}
|
||||
|
||||
void VerticalPageBreaks::readFields(CFRecord& record)
|
||||
{
|
||||
record >> cbrk;
|
||||
for (int i = 0; i < cbrk; ++i)
|
||||
{
|
||||
VertBrkPtr vb(new VertBrk);
|
||||
record >> *vb;
|
||||
rgbrk.push_back(vb);
|
||||
}
|
||||
}
|
||||
int VerticalPageBreaks::serialize(std::wostream & stream)
|
||||
{
|
||||
if (rgbrk.empty()) return 0;
|
||||
|
||||
CP_XML_WRITER(stream)
|
||||
{
|
||||
CP_XML_NODE(L"colBreaks")
|
||||
{
|
||||
CP_XML_ATTR(L"count", cbrk);
|
||||
CP_XML_ATTR(L"manualBreakCount", cbrk);
|
||||
|
||||
for (size_t i = 0; i < rgbrk.size(); ++i)
|
||||
{
|
||||
if (rgbrk[i])
|
||||
rgbrk[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -36,27 +36,24 @@
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
class VerticalPageBreaks : public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(VerticalPageBreaks)
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(VerticalPageBreaks)
|
||||
public:
|
||||
VerticalPageBreaks();
|
||||
~VerticalPageBreaks();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
// Logical representation of VerticalPageBreaks record in BIFF8
|
||||
class VerticalPageBreaks: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(VerticalPageBreaks)
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(VerticalPageBreaks)
|
||||
public:
|
||||
VerticalPageBreaks();
|
||||
~VerticalPageBreaks();
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeVerticalPageBreaks;
|
||||
static const ElementType type = typeVerticalPageBreaks;
|
||||
|
||||
virtual int serialize(std::wostream & stream);
|
||||
//-----------------------------
|
||||
_UINT16 cbrk;
|
||||
BiffStructurePtrVector rgbrk;
|
||||
};
|
||||
|
||||
_UINT16 cbrk;
|
||||
BiffStructurePtrVector rgbrk;
|
||||
};
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -31,21 +31,33 @@
|
||||
*/
|
||||
|
||||
#include "HorzBrk.h"
|
||||
#include "../../../Common/simple_xml_writer.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
BiffStructurePtr HorzBrk::clone()
|
||||
{
|
||||
return BiffStructurePtr(new HorzBrk(*this));
|
||||
}
|
||||
|
||||
|
||||
BiffStructurePtr HorzBrk::clone()
|
||||
{
|
||||
return BiffStructurePtr(new HorzBrk(*this));
|
||||
}
|
||||
|
||||
void HorzBrk::load(CFRecord& record)
|
||||
{
|
||||
record >> row >> colStart >> colEnd;
|
||||
}
|
||||
|
||||
|
||||
void HorzBrk::load(CFRecord& record)
|
||||
{
|
||||
record >> row >> colStart >> colEnd;
|
||||
}
|
||||
int HorzBrk::serialize(std::wostream & stream)
|
||||
{
|
||||
CP_XML_WRITER(stream)
|
||||
{
|
||||
CP_XML_NODE(L"brk")
|
||||
{
|
||||
CP_XML_ATTR(L"id", row);
|
||||
CP_XML_ATTR(L"max", colEnd);
|
||||
CP_XML_ATTR(L"man", 1);
|
||||
if (colStart > 0 )
|
||||
CP_XML_ATTR(L"min", colStart);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -36,25 +36,21 @@
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
class CFRecord;
|
||||
|
||||
class HorzBrk : public BiffStructure
|
||||
{
|
||||
BASE_STRUCTURE_DEFINE_CLASS_NAME(HorzBrk)
|
||||
public:
|
||||
BiffStructurePtr clone();
|
||||
|
||||
static const ElementType type = typeHorzBrk;
|
||||
static const ElementType type = typeHorzBrk;
|
||||
|
||||
virtual void load(CFRecord& record);
|
||||
|
||||
virtual int serialize(std::wostream & stream);
|
||||
|
||||
RwU row;
|
||||
unsigned short colStart;
|
||||
unsigned short colEnd;
|
||||
};
|
||||
|
||||
typedef boost::shared_ptr<HorzBrk> HorzBrkPtr;
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -31,20 +31,32 @@
|
||||
*/
|
||||
|
||||
#include "VertBrk.h"
|
||||
#include "../../../Common/simple_xml_writer.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
BiffStructurePtr VertBrk::clone()
|
||||
{
|
||||
return BiffStructurePtr(new VertBrk(*this));
|
||||
}
|
||||
|
||||
void VertBrk::load(CFRecord& record)
|
||||
{
|
||||
record >> col >> rowStart >> rowEnd;
|
||||
}
|
||||
|
||||
BiffStructurePtr VertBrk::clone()
|
||||
{
|
||||
return BiffStructurePtr(new VertBrk(*this));
|
||||
}
|
||||
void VertBrk::load(CFRecord& record)
|
||||
{
|
||||
record >> col >> rowStart >> rowEnd;
|
||||
}
|
||||
int VertBrk::serialize(std::wostream & stream)
|
||||
{
|
||||
CP_XML_WRITER(stream)
|
||||
{
|
||||
CP_XML_NODE(L"brk")
|
||||
{
|
||||
CP_XML_ATTR(L"id", col);
|
||||
CP_XML_ATTR(L"max", rowEnd);
|
||||
CP_XML_ATTR(L"man", 1);
|
||||
if (rowStart > 0)
|
||||
CP_XML_ATTR(L"min", rowStart);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -35,26 +35,22 @@
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
class VertBrk : public BiffStructure
|
||||
{
|
||||
BASE_STRUCTURE_DEFINE_CLASS_NAME(VertBrk)
|
||||
public:
|
||||
BiffStructurePtr clone();
|
||||
|
||||
class CFRecord;
|
||||
static const ElementType type = typeVertBrk;
|
||||
|
||||
class VertBrk : public BiffStructure
|
||||
{
|
||||
BASE_STRUCTURE_DEFINE_CLASS_NAME(VertBrk)
|
||||
public:
|
||||
BiffStructurePtr clone();
|
||||
virtual void load(CFRecord& record);
|
||||
virtual int serialize(std::wostream & stream);
|
||||
|
||||
static const ElementType type = typeVertBrk;
|
||||
|
||||
virtual void load(CFRecord& record);
|
||||
|
||||
|
||||
ColU col;
|
||||
RwU rowStart;
|
||||
RwU rowEnd;
|
||||
};
|
||||
|
||||
typedef boost::shared_ptr<VertBrk> VertBrkPtr;
|
||||
ColU col;
|
||||
RwU rowStart;
|
||||
RwU rowEnd;
|
||||
};
|
||||
typedef boost::shared_ptr<VertBrk> VertBrkPtr;
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -178,13 +178,14 @@ void XLUnicodeRichExtendedString::load(CFRecord& record)
|
||||
unsigned char flags = 0;
|
||||
record >> cch >> flags;
|
||||
|
||||
fHighByte = GETBIT(flags, 0);
|
||||
|
||||
if (record.getDataSize() == record.getRdPtr())
|
||||
{
|
||||
if (appendNextContinue(record,false) == false)
|
||||
if (appendNextContinue(record, true) == false) //fHighByte MUST be specified in the first byte of the continue field of the Continue
|
||||
return;
|
||||
}
|
||||
|
||||
fHighByte = GETBIT(flags, 0);
|
||||
fExtSt = GETBIT(flags, 2);
|
||||
fRichSt = GETBIT(flags, 3);
|
||||
|
||||
@ -235,7 +236,11 @@ void XLUnicodeRichExtendedString::load(CFRecord& record)
|
||||
}
|
||||
if (record.getRdPtr() + cRun * 4 > record.getDataSize() && !cont_recs_.empty())
|
||||
{
|
||||
record.appendRawData(cont_recs_.front());
|
||||
unsigned char flags = 0;
|
||||
(*cont_recs_.front()) >> flags;
|
||||
fHighByte = (0x01 == flags);
|
||||
|
||||
record.appendRawData(cont_recs_.front()->getData() + 1, cont_recs_.front()->getDataSize() - 1);
|
||||
cont_recs_.pop_front();
|
||||
}
|
||||
for(size_t i = 0; i < cRun; ++i)
|
||||
@ -249,8 +254,12 @@ void XLUnicodeRichExtendedString::load(CFRecord& record)
|
||||
{
|
||||
if (record.getRdPtr() + cbExtRst > record.getDataSize() && !cont_recs_.empty())
|
||||
{
|
||||
record.appendRawData(cont_recs_.front());
|
||||
cont_recs_.pop_front();
|
||||
unsigned char flags = 0;
|
||||
(*cont_recs_.front()) >> flags;
|
||||
fHighByte = (0x01 == flags);
|
||||
|
||||
record.appendRawData(cont_recs_.front()->getData() + 1, cont_recs_.front()->getDataSize() - 1);
|
||||
cont_recs_.pop_front();
|
||||
}
|
||||
extRst.load(record);
|
||||
}
|
||||
@ -295,7 +304,7 @@ void XLUnicodeRichExtendedString::loadSymbols(CFRecord& record, const size_t cch
|
||||
}
|
||||
else
|
||||
{
|
||||
str_ = STR::toStdWString(inp_str, record.getGlobalWorkbookInfo()->CodePage).c_str();
|
||||
str_ = STR::toStdWString(inp_str, record.getGlobalWorkbookInfo()->CodePage);
|
||||
}
|
||||
}
|
||||
record.skipNunBytes(raw_length);
|
||||
|
||||
@ -92,8 +92,16 @@ const bool CUSTOMVIEW::loadContent(BinProcessor& proc)
|
||||
count--;
|
||||
}
|
||||
|
||||
proc.optional<HorizontalPageBreaks>();
|
||||
proc.optional<VerticalPageBreaks>();
|
||||
if (proc.optional<HorizontalPageBreaks>())
|
||||
{
|
||||
m_HorizontalPageBreaks = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
if (proc.optional<VerticalPageBreaks>())
|
||||
{
|
||||
m_VerticalPageBreaks = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
|
||||
proc.optional<Header>();
|
||||
proc.optional<Footer>();
|
||||
@ -188,6 +196,14 @@ int CUSTOMVIEW::serialize(std::wostream & stream)
|
||||
if (m_arSelection[i] == NULL) continue;
|
||||
m_arSelection[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
if (m_HorizontalPageBreaks)
|
||||
{
|
||||
m_HorizontalPageBreaks->serialize(CP_XML_STREAM());
|
||||
}
|
||||
if (m_VerticalPageBreaks)
|
||||
{
|
||||
m_VerticalPageBreaks->serialize(CP_XML_STREAM());
|
||||
}
|
||||
//todooo пока не понятно как там определяется ref
|
||||
//if (m_AUTOFILTER)
|
||||
// m_AUTOFILTER->serialize(CP_XML_STREAM());
|
||||
|
||||
@ -35,29 +35,27 @@
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
class CUSTOMVIEW : public CompositeObject
|
||||
{
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(CUSTOMVIEW)
|
||||
public:
|
||||
CUSTOMVIEW();
|
||||
~CUSTOMVIEW();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
// Logical representation of CUSTOMVIEW union of records
|
||||
class CUSTOMVIEW: public CompositeObject
|
||||
{
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(CUSTOMVIEW)
|
||||
public:
|
||||
CUSTOMVIEW();
|
||||
~CUSTOMVIEW();
|
||||
virtual const bool loadContent(BinProcessor& proc);
|
||||
|
||||
BaseObjectPtr clone();
|
||||
static const ElementType type = typeCUSTOMVIEW;
|
||||
|
||||
virtual const bool loadContent(BinProcessor& proc);
|
||||
|
||||
static const ElementType type = typeCUSTOMVIEW;
|
||||
|
||||
int serialize(std::wostream & stream);
|
||||
|
||||
BaseObjectPtr m_UserSView;
|
||||
std::vector<BaseObjectPtr> m_arSelection;
|
||||
BaseObjectPtr m_pls;
|
||||
BaseObjectPtr m_AUTOFILTER;
|
||||
};
|
||||
int serialize(std::wostream & stream);
|
||||
|
||||
BaseObjectPtr m_UserSView;
|
||||
std::vector<BaseObjectPtr> m_arSelection;
|
||||
BaseObjectPtr m_pls;
|
||||
BaseObjectPtr m_AUTOFILTER;
|
||||
BaseObjectPtr m_HorizontalPageBreaks;
|
||||
BaseObjectPtr m_VerticalPageBreaks;
|
||||
};
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -125,9 +125,22 @@ const bool GLOBALS::loadContent(BinProcessor& proc)
|
||||
}
|
||||
}break;
|
||||
|
||||
case rt_HorizontalPageBreaks: proc.optional<HorizontalPageBreaks>(); break;
|
||||
case rt_VerticalPageBreaks: proc.optional<VerticalPageBreaks>(); break;
|
||||
|
||||
case rt_HorizontalPageBreaks:
|
||||
{
|
||||
if (proc.optional<HorizontalPageBreaks>())
|
||||
{
|
||||
m_HorizontalPageBreaks = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
}break;
|
||||
case rt_VerticalPageBreaks:
|
||||
{
|
||||
if (proc.optional<VerticalPageBreaks>())
|
||||
{
|
||||
m_VerticalPageBreaks = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
}break;
|
||||
default://unknown .... back upper
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -56,6 +56,8 @@ public:
|
||||
BaseObjectPtr m_DefaultRowHeight;
|
||||
BaseObjectPtr m_Guts;
|
||||
BaseObjectPtr m_WsBool;
|
||||
BaseObjectPtr m_HorizontalPageBreaks;
|
||||
BaseObjectPtr m_VerticalPageBreaks;
|
||||
|
||||
//--------------------------------------------------------------
|
||||
GlobalWorkbookInfoPtr global_info_;
|
||||
|
||||
@ -49,63 +49,55 @@
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
PAGESETUP::PAGESETUP() {}
|
||||
PAGESETUP::~PAGESETUP() {}
|
||||
|
||||
|
||||
PAGESETUP::PAGESETUP()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
PAGESETUP::~PAGESETUP()
|
||||
{
|
||||
}
|
||||
|
||||
class Parenthesis_PAGESETUP_1: public ABNFParenthesis
|
||||
{
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(Parenthesis_PAGESETUP_1)
|
||||
public:
|
||||
BaseObjectPtr clone()
|
||||
class Parenthesis_PAGESETUP_1 : public ABNFParenthesis
|
||||
{
|
||||
return BaseObjectPtr(new Parenthesis_PAGESETUP_1(*this));
|
||||
}
|
||||
|
||||
const bool loadContent(BinProcessor& proc)
|
||||
{
|
||||
//?????????
|
||||
//if(!proc.mandatory(Pls(proc.getParent())))
|
||||
//{
|
||||
return false;
|
||||
//}
|
||||
//proc.repeated<Continue>(0, 0);
|
||||
return true;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
BaseObjectPtr PAGESETUP::clone()
|
||||
{
|
||||
return BaseObjectPtr(new PAGESETUP(*this));
|
||||
}
|
||||
|
||||
|
||||
// PAGESETUP = Header Footer HCenter VCenter [LeftMargin] [RightMargin] [TopMargin] [BottomMargin] [Pls *Continue] Setup
|
||||
const bool PAGESETUP::loadContent(BinProcessor& proc)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
CFRecordType::TypeId type = proc.getNextRecordType();
|
||||
|
||||
if (type == rt_NONE)
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(Parenthesis_PAGESETUP_1)
|
||||
public:
|
||||
BaseObjectPtr clone()
|
||||
{
|
||||
proc.SkipRecord();
|
||||
continue; //file(6).xls
|
||||
//break;
|
||||
return BaseObjectPtr(new Parenthesis_PAGESETUP_1(*this));
|
||||
}
|
||||
|
||||
switch(type)
|
||||
const bool loadContent(BinProcessor& proc)
|
||||
{
|
||||
case rt_Header:
|
||||
//?????????
|
||||
//if(!proc.mandatory(Pls(proc.getParent())))
|
||||
//{
|
||||
return false;
|
||||
//}
|
||||
//proc.repeated<Continue>(0, 0);
|
||||
return true;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
BaseObjectPtr PAGESETUP::clone()
|
||||
{
|
||||
return BaseObjectPtr(new PAGESETUP(*this));
|
||||
}
|
||||
|
||||
|
||||
// PAGESETUP = Header Footer HCenter VCenter [LeftMargin] [RightMargin] [TopMargin] [BottomMargin] [Pls *Continue] Setup
|
||||
const bool PAGESETUP::loadContent(BinProcessor& proc)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
CFRecordType::TypeId type = proc.getNextRecordType();
|
||||
|
||||
if (type == rt_NONE)
|
||||
{
|
||||
proc.SkipRecord();
|
||||
continue; //file(6).xls
|
||||
//break;
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case rt_Header:
|
||||
{
|
||||
if (proc.optional<Header>())
|
||||
{
|
||||
@ -120,30 +112,31 @@ const bool PAGESETUP::loadContent(BinProcessor& proc)
|
||||
m_Footer = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
}break;
|
||||
}break;
|
||||
case rt_HCenter:
|
||||
{
|
||||
if (proc.optional<HCenter>())
|
||||
{
|
||||
if (proc.optional<HCenter>())
|
||||
{
|
||||
m_HCenter = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
}break;
|
||||
m_HCenter = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
}break;
|
||||
case rt_VCenter:
|
||||
{
|
||||
if (proc.optional<VCenter>())
|
||||
{
|
||||
if (proc.optional<VCenter>())
|
||||
{
|
||||
m_VCenter = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
}break;
|
||||
m_VCenter = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
}break;
|
||||
case rt_BottomMargin: proc.optional<BottomMargin>(); break;
|
||||
case rt_TopMargin: proc.optional<TopMargin>(); break;
|
||||
case rt_LeftMargin: proc.optional<LeftMargin>(); break;
|
||||
case rt_RightMargin: proc.optional<RightMargin>(); break;
|
||||
|
||||
case rt_HorizontalPageBreaks: proc.optional<HorizontalPageBreaks>(); break;
|
||||
case rt_VerticalPageBreaks: proc.optional<VerticalPageBreaks>(); break;
|
||||
|
||||
case rt_HorizontalPageBreaks: proc.optional<HorizontalPageBreaks>(); break;
|
||||
case rt_VerticalPageBreaks: proc.optional<VerticalPageBreaks>(); break;
|
||||
case rt_Pls:
|
||||
{
|
||||
if (proc.optional<Pls>())
|
||||
@ -275,7 +268,6 @@ int PAGESETUP::serialize(std::wostream & stream)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_Header || m_Footer)
|
||||
{
|
||||
CP_XML_NODE(L"headerFooter")
|
||||
@ -300,6 +292,7 @@ int PAGESETUP::serialize(std::wostream & stream)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
@ -127,12 +127,10 @@ bool PropertyDTM::Read (XLS::CFStreamPtr stream)
|
||||
}
|
||||
std::wstring PropertyDTM::toString()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
boost::winapi::FILETIME_ ft;
|
||||
ft.dwHighDateTime = dwHighDateTime;
|
||||
ft.dwLowDateTime = dwLowDateTime;
|
||||
_UINT64 temp = ((_UINT64)dwHighDateTime << 32) + dwLowDateTime;
|
||||
|
||||
boost::posix_time::ptime date_time_ = boost::posix_time::from_ftime<boost::posix_time::ptime>(ft);
|
||||
boost::posix_time::ptime daysFrom1601(boost::gregorian::date(1601, 1, 1));
|
||||
boost::posix_time::ptime date_time_ = daysFrom1601 + boost::posix_time::milliseconds(temp / 10000);
|
||||
|
||||
short Min = (short)date_time_.time_of_day().minutes();
|
||||
short Hour = (short)date_time_.time_of_day().hours();
|
||||
@ -151,9 +149,6 @@ std::wstring PropertyDTM::toString()
|
||||
value += (Hour < 10 ? L"0" : L"") + std::to_wstring(Hour) + L":" +
|
||||
(Min < 10 ? L"0" : L"") + std::to_wstring(Min) + L":00Z";
|
||||
return value;
|
||||
#else
|
||||
return L"";
|
||||
#endif
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
bool PropertyInt::Read (XLS::CFStreamPtr stream)
|
||||
@ -216,7 +211,7 @@ std::wstring PropertyVecString::toString()
|
||||
{
|
||||
CP_XML_NODE(L"vt:lpstr")
|
||||
{
|
||||
CP_XML_STREAM() << values[i];
|
||||
CP_XML_CONTENT(values[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -272,7 +267,7 @@ std::wstring PropertyVecHeadingPair::toString()
|
||||
{
|
||||
CP_XML_NODE(L"vt:lpstr")
|
||||
{
|
||||
CP_XML_STREAM() << values[i].headingString;
|
||||
CP_XML_CONTENT(values[i].headingString);
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"vt:variant")
|
||||
|
||||
@ -51,7 +51,7 @@ PropertyPtr PropertyFactory::ReadProperty(const unsigned int prop_id, XLS::CFStr
|
||||
|
||||
PropertyPtr property_;
|
||||
|
||||
if (prop_id == 0x0001 || prop_id == 0x1001)
|
||||
if (prop_id == CODEPAGE || prop_id == CODEPAGEEXT)
|
||||
{
|
||||
property_ = PropertyPtr(new PropertyCodePage(prop_id, value_type));
|
||||
property_->Read(stream);
|
||||
@ -62,37 +62,37 @@ PropertyPtr PropertyFactory::ReadProperty(const unsigned int prop_id, XLS::CFStr
|
||||
code_page = property_CodePage->code_page;
|
||||
}
|
||||
}
|
||||
else if (prop_id == 0x100C)
|
||||
else if (prop_id == HEADINGPAIR)
|
||||
{
|
||||
property_ = PropertyPtr(new PropertyVecHeadingPair(prop_id, value_type, code_page));
|
||||
}
|
||||
else if (prop_id == 0x100D)
|
||||
else if (prop_id == DOCPARTS)
|
||||
{
|
||||
property_ = PropertyPtr(new PropertyVecString(prop_id, value_type, code_page));
|
||||
}
|
||||
else if (prop_id == 0x1018)
|
||||
else if (prop_id == DIGSIG)
|
||||
{
|
||||
property_ = PropertyPtr(new PropertyDigSig(prop_id, value_type));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (value_type == 0x001E)
|
||||
if (value_type == Property::VT_LPSTR)
|
||||
{
|
||||
property_ = PropertyPtr(new PropertyString(prop_id, value_type, code_page));
|
||||
}
|
||||
else if (value_type == 0x001F)
|
||||
else if (value_type == Property::VT_LPWSTR)
|
||||
{
|
||||
property_ = PropertyPtr(new PropertyWString(prop_id, value_type));
|
||||
}
|
||||
else if (value_type == 0x0003)
|
||||
else if (value_type == Property::VT_I4)
|
||||
{
|
||||
property_ = PropertyPtr(new PropertyInt(prop_id, value_type));
|
||||
}
|
||||
else if (value_type == 0x000b)
|
||||
else if (value_type == Property::VT_BOOL)
|
||||
{
|
||||
property_ = PropertyPtr(new PropertyBool(prop_id, value_type));
|
||||
}
|
||||
else if (value_type == 0x0040)
|
||||
else if (value_type == Property::VT_FILETIME)
|
||||
{
|
||||
property_ = PropertyPtr(new PropertyDTM(prop_id, value_type));
|
||||
}
|
||||
|
||||
@ -31,12 +31,14 @@
|
||||
*/
|
||||
|
||||
#include "PropertySetStream.h"
|
||||
#include "CodePageOle.h"
|
||||
|
||||
#include "../../Binary/CFStream.h"
|
||||
#include "../../Auxiliary/HelpFunc.h"
|
||||
#include "../../../Common/simple_xml_writer.h"
|
||||
#include "../../../../../DesktopEditor/common/SystemUtils.h"
|
||||
#include "../../../../../Common/DocxFormat/Source/Base/Base.h"
|
||||
#include "../../../../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
|
||||
namespace OLEPS
|
||||
{
|
||||
@ -122,7 +124,7 @@ namespace OLEPS
|
||||
{
|
||||
CP_XML_NODE(L"Template")
|
||||
{
|
||||
CP_XML_STREAM() << prop->toString();
|
||||
CP_XML_CONTENT(prop->toString());
|
||||
}
|
||||
}
|
||||
prop = GetProperty(MANAGER);
|
||||
@ -130,7 +132,7 @@ namespace OLEPS
|
||||
{
|
||||
CP_XML_NODE(L"Manager")
|
||||
{
|
||||
CP_XML_STREAM() << prop->toString();
|
||||
CP_XML_CONTENT(prop->toString());
|
||||
}
|
||||
}
|
||||
prop = GetProperty(COMPANY);
|
||||
@ -138,7 +140,7 @@ namespace OLEPS
|
||||
{
|
||||
CP_XML_NODE(L"Company")
|
||||
{
|
||||
CP_XML_STREAM() << prop->toString();
|
||||
CP_XML_CONTENT(prop->toString());
|
||||
}
|
||||
}
|
||||
prop = GetProperty(PAGECOUNT);
|
||||
@ -297,16 +299,17 @@ namespace OLEPS
|
||||
// DIGSIG = 0x1018,
|
||||
CP_XML_NODE(L"Application")
|
||||
{
|
||||
std::wstring sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvApplicationName);
|
||||
if (sApplication.empty())
|
||||
sApplication = NSSystemUtils::gc_EnvApplicationNameDefault;
|
||||
|
||||
prop = GetProperty(APPNAME);
|
||||
if (prop)
|
||||
{
|
||||
CP_XML_STREAM() << prop->toString();
|
||||
CP_XML_STREAM() << (prop->toString() + L"/" + sApplication);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::wstring sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvApplicationName);
|
||||
if (sApplication.empty())
|
||||
sApplication = NSSystemUtils::gc_EnvApplicationNameDefault;
|
||||
CP_XML_STREAM() << sApplication;
|
||||
#if defined(INTVER)
|
||||
std::string s = VALUE2STR(INTVER);
|
||||
@ -340,6 +343,7 @@ namespace OLEPS
|
||||
|
||||
std::wstringstream output;
|
||||
PropertyPtr prop;
|
||||
std::wstring value;
|
||||
|
||||
CP_XML_WRITER(output)
|
||||
{
|
||||
@ -352,110 +356,123 @@ namespace OLEPS
|
||||
CP_XML_ATTR(L"xmlns:xsi", L"http://www.w3.org/2001/XMLSchema-instance");
|
||||
|
||||
prop = GetProperty(TITLE);
|
||||
if (prop)
|
||||
value = prop ? prop->toString() : L"";
|
||||
if (!value.empty())
|
||||
{
|
||||
CP_XML_NODE(L"dc:title")
|
||||
{
|
||||
CP_XML_STREAM() << prop->toString();
|
||||
CP_XML_CONTENT(value);
|
||||
}
|
||||
}
|
||||
prop = GetProperty(SUBJECT);
|
||||
if (prop)
|
||||
value = prop ? prop->toString() : L"";
|
||||
if (!value.empty())
|
||||
{
|
||||
CP_XML_NODE(L"dc:subject")
|
||||
{
|
||||
|
||||
auto correctedSubject = prop->toString();
|
||||
CP_XML_STREAM() << prop->toString();
|
||||
CP_XML_CONTENT(value);
|
||||
}
|
||||
}
|
||||
prop = GetProperty(AUTHOR);
|
||||
if (prop)
|
||||
value = prop ? prop->toString() : L"";
|
||||
if (!value.empty())
|
||||
{
|
||||
CP_XML_NODE(L"dc:creator")
|
||||
{
|
||||
CP_XML_STREAM() << prop->toString();
|
||||
CP_XML_CONTENT(value);
|
||||
}
|
||||
}
|
||||
prop = GetProperty(KEYWORDS);
|
||||
if (prop)
|
||||
value = prop ? prop->toString() : L"";
|
||||
if (!value.empty())
|
||||
{
|
||||
CP_XML_NODE(L"cp:keywords")
|
||||
{
|
||||
CP_XML_STREAM() << prop->toString();
|
||||
CP_XML_CONTENT(value);
|
||||
}
|
||||
}
|
||||
prop = GetProperty(COMMENTS);
|
||||
if (prop)
|
||||
value = prop ? prop->toString() : L"";
|
||||
if (!value.empty())
|
||||
{
|
||||
CP_XML_NODE(L"dc:description")
|
||||
{
|
||||
CP_XML_STREAM() << prop->toString();
|
||||
CP_XML_CONTENT(value);
|
||||
}
|
||||
}
|
||||
prop = GetProperty(LANGUAGE);
|
||||
if (prop)
|
||||
value = prop ? prop->toString() : L"";
|
||||
if (!value.empty())
|
||||
{
|
||||
CP_XML_NODE(L"dc:language")
|
||||
{
|
||||
CP_XML_STREAM() << prop->toString();
|
||||
CP_XML_STREAM() << value;
|
||||
}
|
||||
} prop = GetProperty(VERSION);
|
||||
if (prop)
|
||||
}
|
||||
prop = GetProperty(VERSION);
|
||||
value = prop ? prop->toString() : L"";
|
||||
if (!value.empty())
|
||||
{
|
||||
CP_XML_NODE(L"cp:version")
|
||||
{
|
||||
CP_XML_STREAM() << prop->toString();
|
||||
CP_XML_STREAM() << value;
|
||||
}
|
||||
}
|
||||
prop = GetProperty(LASTAUTHOR);
|
||||
if (prop)
|
||||
value = prop ? prop->toString() : L"";
|
||||
if (!value.empty())
|
||||
{
|
||||
CP_XML_NODE(L"cp:lastModifiedBy")
|
||||
{
|
||||
CP_XML_STREAM() << prop->toString();
|
||||
CP_XML_CONTENT(value);
|
||||
}
|
||||
}
|
||||
prop = GetProperty(REVNUMBER);
|
||||
if (prop)
|
||||
value = prop ? prop->toString() : L"";
|
||||
if (!value.empty())
|
||||
{
|
||||
unsigned int val = XmlUtils::GetUInteger(value);
|
||||
CP_XML_NODE(L"cp:revision")
|
||||
{
|
||||
CP_XML_STREAM() << prop->toString();
|
||||
CP_XML_STREAM() << val;
|
||||
}
|
||||
}
|
||||
prop = GetProperty(CREATE_DTM);
|
||||
if (prop)
|
||||
value = prop ? prop->toString() : L"";
|
||||
if (!value.empty())
|
||||
{
|
||||
CP_XML_NODE(L"dcterms:created")
|
||||
{
|
||||
CP_XML_ATTR(L"xsi:type", L"dcterms:W3CDTF");
|
||||
CP_XML_STREAM() << prop->toString();
|
||||
CP_XML_STREAM() << value;
|
||||
}
|
||||
}
|
||||
prop = GetProperty(LASTSAVE_DTM);
|
||||
if (prop)
|
||||
value = prop ? prop->toString() : L"";
|
||||
if (!value.empty())
|
||||
{
|
||||
CP_XML_NODE(L"dcterms:modified")
|
||||
{
|
||||
CP_XML_ATTR(L"xsi:type", L"dcterms:W3CDTF");
|
||||
CP_XML_STREAM() << prop->toString();
|
||||
CP_XML_STREAM() << value;
|
||||
}
|
||||
}
|
||||
prop = GetProperty(CATEGORY);
|
||||
if (prop)
|
||||
value = prop ? prop->toString() : L"";
|
||||
if (!value.empty())
|
||||
{
|
||||
CP_XML_NODE(L"cp:category")
|
||||
{
|
||||
CP_XML_STREAM() << prop->toString();
|
||||
CP_XML_CONTENT(value);
|
||||
}
|
||||
}
|
||||
prop = GetProperty(CONTENTSTATUS);
|
||||
if (prop)
|
||||
value = prop ? prop->toString() : L"";
|
||||
if (!value.empty())
|
||||
{
|
||||
CP_XML_NODE(L"cp:contentStatus")
|
||||
{
|
||||
CP_XML_STREAM() << prop->toString();
|
||||
CP_XML_STREAM() << value;
|
||||
}
|
||||
}
|
||||
// BYTECOUNT = 0x1004,
|
||||
|
||||
@ -508,9 +508,11 @@ void XlsConverter::convert_common (XLS::CommonSubstream* sheet)
|
||||
|
||||
xls_global_info->current_sheet = sheet->ws_index_ + 1;
|
||||
|
||||
if (sheet->m_GLOBALS)
|
||||
XLS::GLOBALS *globals = dynamic_cast<XLS::GLOBALS *>(sheet->m_GLOBALS.get());
|
||||
|
||||
if (globals)
|
||||
{
|
||||
sheet->m_GLOBALS->serialize(xlsx_context->current_sheet().sheetFormat());
|
||||
globals->serialize(xlsx_context->current_sheet().sheetFormat());
|
||||
}
|
||||
|
||||
if (!sheet->m_arWINDOW.empty())
|
||||
@ -540,6 +542,17 @@ void XlsConverter::convert_common (XLS::CommonSubstream* sheet)
|
||||
{
|
||||
sheet->m_PAGESETUP->serialize(xlsx_context->current_sheet().pageProperties());
|
||||
}
|
||||
if (globals)
|
||||
{
|
||||
if (globals->m_HorizontalPageBreaks)
|
||||
{
|
||||
globals->m_HorizontalPageBreaks->serialize(xlsx_context->current_sheet().pageProperties());
|
||||
}
|
||||
if (globals->m_VerticalPageBreaks)
|
||||
{
|
||||
globals->m_VerticalPageBreaks->serialize(xlsx_context->current_sheet().pageProperties());
|
||||
}
|
||||
}
|
||||
|
||||
if (sheet->m_arCUSTOMVIEW.size() > 0)
|
||||
{
|
||||
@ -2473,6 +2486,10 @@ void XlsConverter::convert(XLS::Obj * obj)
|
||||
xlsx_context->get_mediaitems().create_embeddings_path(xlsx_path);
|
||||
|
||||
std::wstring target;
|
||||
|
||||
if (xls_file->storage_->exists(object_stream + L"Workbook")) target = L".xls";
|
||||
if (xls_file->storage_->exists(object_stream + L"WordDocument")) target = L".doc";
|
||||
|
||||
std::wstring objectId = xlsx_context->get_mediaitems().add_embedding(target, info);
|
||||
|
||||
POLE::Storage *storageOle = new POLE::Storage((xlsx_context->get_mediaitems().embeddings_path() + target).c_str());
|
||||
|
||||
@ -130,10 +130,12 @@ std::wstring external_items::add_embedding(std::wstring & oox_target, const std:
|
||||
|
||||
std::wstring lowerInfo = XmlUtils::GetLower(info);
|
||||
|
||||
std::wstring extension = L".bin";
|
||||
|
||||
if (std::wstring::npos != lowerInfo.find(L"excel")) extension = L".xls";
|
||||
if (std::wstring::npos != lowerInfo.find(L"word")) extension = L".doc";
|
||||
std::wstring extension;
|
||||
|
||||
if ( false == oox_target.empty()) extension = oox_target;
|
||||
else if (std::wstring::npos != lowerInfo.find(L"excel")) extension = L".xls";
|
||||
else if (std::wstring::npos != lowerInfo.find(L"word")) extension = L".doc";
|
||||
else extension = L".bin";
|
||||
|
||||
oox_target = std::wstring(L"oleObject") + std::to_wstring(count_embeddings) + extension;
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ static std::wstring get_mime_type(const std::wstring & extension)
|
||||
else if (L"bin" == extension) return L"application/vnd.openxmlformats-officedocument.oleObject";
|
||||
else if (L"xlsx" == extension) return L"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
||||
else if (L"xls" == extension) return L"application/vnd.ms-excel";
|
||||
else if (L"doc" == extension) return L"application/vnd.ms-word";
|
||||
else if (L"doc" == extension) return L"application/msword";
|
||||
else if (L"vsd" == extension) return L"application/vnd.visio";
|
||||
else if (L"vsdx" == extension) return L"application/vnd.ms-visio.drawing";
|
||||
else if (L"pict" == extension) return L"image/pict";
|
||||
|
||||
@ -2742,6 +2742,8 @@ void xlsx_drawing_context::serialize_object(std::wostream & stream, _drawing_sta
|
||||
{
|
||||
CP_XML_ATTR(L"defaultSize", 0);
|
||||
//CP_XML_ATTR(L"autoPict", 0);
|
||||
if (!drawing_state->fill.picture_target.empty())
|
||||
drawing_state->fill.texture_target = drawing_state->fill.picture_target;
|
||||
|
||||
if (!drawing_state->fill.texture_target.empty())
|
||||
{
|
||||
|
||||
@ -319,7 +319,16 @@ namespace OOX
|
||||
int nDepthChild = oReader.GetDepth();
|
||||
fromXML(nDepthChild, oReader);
|
||||
}
|
||||
|
||||
else if (L"wx:sect" == sName && !oReader.IsEmptyNode())
|
||||
{
|
||||
int nWxSectDepth = oReader.GetDepth();
|
||||
fromXML(nWxSectDepth, oReader);
|
||||
}
|
||||
else if (L"wx:sub-section" == sName && !oReader.IsEmptyNode())
|
||||
{
|
||||
int nWxSubSectDepth = oReader.GetDepth();
|
||||
fromXML(nWxSubSectDepth, oReader);
|
||||
}
|
||||
if ( pItem )
|
||||
{
|
||||
m_arrItems.push_back( pItem );
|
||||
|
||||
@ -600,11 +600,15 @@ namespace OOX
|
||||
if ( oReader.IsEmptyNode() )
|
||||
return;
|
||||
|
||||
OOX::Document* document = WritingElement::m_pMainDocument;
|
||||
|
||||
int nParentDepth = oReader.GetDepth();
|
||||
CreateElements(oReader, nParentDepth);
|
||||
}
|
||||
void CTr::CreateElements(XmlUtils::CXmlLiteReader &oReader, int nDepth)
|
||||
{
|
||||
OOX::Document* document = WritingElement::m_pMainDocument;
|
||||
int nNumCol = 0;
|
||||
while( oReader.ReadNextSiblingNode( nParentDepth ) )
|
||||
|
||||
while( oReader.ReadNextSiblingNode(nDepth) )
|
||||
{
|
||||
std::wstring sName = oReader.GetName();
|
||||
WritingElement *pItem = NULL;
|
||||
@ -698,6 +702,16 @@ namespace OOX
|
||||
}
|
||||
m_pTableRowProperties->fromXML(oReader);
|
||||
}
|
||||
else if (L"wx:sect" == sName && !oReader.IsEmptyNode())
|
||||
{
|
||||
int nWxSectDepth = oReader.GetDepth();
|
||||
CreateElements(oReader, nWxSectDepth);
|
||||
}
|
||||
else if (L"wx:sub-section" == sName && !oReader.IsEmptyNode())
|
||||
{
|
||||
int nWxSubSectDepth = oReader.GetDepth();
|
||||
CreateElements(oReader, nWxSubSectDepth);
|
||||
}
|
||||
|
||||
if ( pItem )
|
||||
{
|
||||
@ -845,10 +859,14 @@ namespace OOX
|
||||
if ( oReader.IsEmptyNode() )
|
||||
return;
|
||||
|
||||
int nParentDepth = oReader.GetDepth();
|
||||
CreateElements(oReader, nParentDepth);
|
||||
}
|
||||
void CTc::CreateElements(XmlUtils::CXmlLiteReader &oReader, int nDepth)
|
||||
{
|
||||
OOX::Document* document = WritingElement::m_pMainDocument;
|
||||
|
||||
int nParentDepth = oReader.GetDepth();
|
||||
while( oReader.ReadNextSiblingNode( nParentDepth ) )
|
||||
while( oReader.ReadNextSiblingNode(nDepth) )
|
||||
{
|
||||
std::wstring sName = oReader.GetName();
|
||||
WritingElement *pItem = NULL;
|
||||
@ -923,7 +941,16 @@ namespace OOX
|
||||
|
||||
m_pTableCellProperties->fromXML(oReader);
|
||||
}
|
||||
|
||||
else if (L"wx:sect" == sName && !oReader.IsEmptyNode())
|
||||
{
|
||||
int nWxSectDepth = oReader.GetDepth();
|
||||
CreateElements(oReader, nWxSectDepth);
|
||||
}
|
||||
else if (L"wx:sub-section" == sName && !oReader.IsEmptyNode())
|
||||
{
|
||||
int nWxSubSectDepth = oReader.GetDepth();
|
||||
CreateElements(oReader, nWxSubSectDepth);
|
||||
}
|
||||
if ( pItem )
|
||||
{
|
||||
m_arrItems.push_back( pItem );
|
||||
|
||||
@ -521,13 +521,12 @@ namespace OOX
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void CreateElements(XmlUtils::CXmlLiteReader &oReader, int Depth);
|
||||
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
|
||||
|
||||
public:
|
||||
int m_nCountCell;
|
||||
|
||||
// Attributes
|
||||
nullable<SimpleTypes::CLongHexNumber<> > m_oRsidDel;
|
||||
nullable<SimpleTypes::CLongHexNumber<> > m_oRsidR;
|
||||
nullable<SimpleTypes::CLongHexNumber<> > m_oRsidRPr;
|
||||
@ -595,14 +594,12 @@ namespace OOX
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void CreateElements(XmlUtils::CXmlLiteReader &oReader, int Depth);
|
||||
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
|
||||
|
||||
public:
|
||||
int m_nNumCol; // Номер колонки
|
||||
// Attributes
|
||||
nullable<std::wstring > m_sId;
|
||||
// Childs
|
||||
OOX::Logic::CTableCellProperties* m_pTableCellProperties; //todooo - выкинуть из m_arrItems, переделать на nullable<>
|
||||
};
|
||||
|
||||
|
||||
@ -72,6 +72,10 @@ namespace OOX
|
||||
{
|
||||
m_filenameCache = file_path;
|
||||
}
|
||||
void set_MsPackage(bool val)
|
||||
{
|
||||
m_bMsPackage = val;
|
||||
}
|
||||
CPath filename_cache()
|
||||
{
|
||||
return m_filenameCache;
|
||||
|
||||
@ -69,6 +69,9 @@ public:
|
||||
bool isOpenOfficeFormatFile (const std::wstring & fileName, std::wstring & documentID);
|
||||
bool isOnlyOfficeFormatFile (const std::wstring & fileName);
|
||||
|
||||
bool isDocFormatFile (const std::wstring & fileName);
|
||||
bool isXlsFormatFile (const std::wstring & fileName);
|
||||
|
||||
bool isDocFormatFile (POLE::Storage *storage);
|
||||
bool isXlsFormatFile (POLE::Storage *storage);
|
||||
bool isPptFormatFile (POLE::Storage *storage);
|
||||
|
||||
@ -760,6 +760,32 @@ bool COfficeFileFormatChecker::isOOXFormatFile(const std::wstring & fileName, bo
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool COfficeFileFormatChecker::isDocFormatFile(const std::wstring & fileName)
|
||||
{
|
||||
POLE::Storage storage(fileName.c_str());
|
||||
if (storage.open())
|
||||
{
|
||||
if (isDocFormatFile(&storage))
|
||||
{
|
||||
//nFileType внутри;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool COfficeFileFormatChecker::isXlsFormatFile(const std::wstring & fileName)
|
||||
{
|
||||
POLE::Storage storage(fileName.c_str());
|
||||
if (storage.open())
|
||||
{
|
||||
if (isXlsFormatFile(&storage))
|
||||
{
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool COfficeFileFormatChecker::isOnlyOfficeFormatFile(const std::wstring & fileName)
|
||||
{
|
||||
COfficeUtils OfficeUtils(NULL);
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
#include "../../common/File.h"
|
||||
#include "../../common/Array.h"
|
||||
#include "../../../Common/DocxFormat/Source/Base/SmartPtr.h"
|
||||
#include "../../graphics/BaseThread.h"
|
||||
|
||||
#define JS_VALUE_EXIST(value) (value.is_init() && !value->isNull() && !value->isUndefined())
|
||||
#define JS_IS_VALUE_ARRAY(value) (value.is_init() && !value->isNull() && !value->isUndefined() && value->isArray())
|
||||
@ -245,7 +246,7 @@ namespace NSJSBase
|
||||
|
||||
JSSmart<CJSValue> runScript(const std::string& script, JSSmart<CJSTryCatch> exception = NULL, const std::wstring& scriptPath = std::wstring(L""));
|
||||
CJSValue* JSON_Parse(const char* json_content);
|
||||
void MoveToThread();
|
||||
void MoveToThread(ASC_THREAD_ID* id = NULL);
|
||||
|
||||
public:
|
||||
static CJSValue* createUndefined();
|
||||
|
||||
@ -10,7 +10,6 @@
|
||||
|
||||
#import "../../../../DesktopEditor/common/Mac/NSString+StringUtils.h"
|
||||
#include <vector>
|
||||
#include "../../../../DesktopEditor/graphics/BaseThread.h"
|
||||
|
||||
@protocol JSEmbedObjectProtocol
|
||||
- (void*) getNative;
|
||||
@ -53,9 +52,9 @@ namespace NSJSBase
|
||||
}
|
||||
|
||||
private:
|
||||
static bool RegisterContext(JSContext* ctx)
|
||||
static bool RegisterContext(JSContext* ctx, ASC_THREAD_ID* id = NULL)
|
||||
{
|
||||
ASC_THREAD_ID nCurrentThread = NSThreads::GetCurrentThreadId();
|
||||
ASC_THREAD_ID nCurrentThread = (id == NULL) ? NSThreads::GetCurrentThreadId() : *id;
|
||||
for (std::vector<std::pair<ASC_THREAD_ID, JSContext*>>::const_iterator i = g_contexts.begin(); i != g_contexts.end(); i++)
|
||||
{
|
||||
if (i->first == nCurrentThread)
|
||||
|
||||
@ -331,11 +331,11 @@ namespace NSJSBase
|
||||
return _value;
|
||||
}
|
||||
|
||||
void CJSContext::MoveToThread()
|
||||
void CJSContext::MoveToThread(ASC_THREAD_ID* id)
|
||||
{
|
||||
if (CJSContextPrivate::RegisterContext(m_internal->context))
|
||||
if (CJSContextPrivate::RegisterContext(m_internal->context, id))
|
||||
{
|
||||
m_internal->m_arThreads.push_back(NSThreads::GetCurrentThreadId());
|
||||
m_internal->m_arThreads.push_back((NULL == id) ? NSThreads::GetCurrentThreadId() : *id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -350,7 +350,7 @@ namespace NSJSBase
|
||||
return _value;
|
||||
}
|
||||
|
||||
void CJSContext::MoveToThread()
|
||||
void CJSContext::MoveToThread(ASC_THREAD_ID* id)
|
||||
{
|
||||
// none
|
||||
}
|
||||
|
||||
@ -67,14 +67,15 @@ android {
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility(JavaVersion.VERSION_1_8)
|
||||
targetCompatibility(JavaVersion.VERSION_1_8)
|
||||
sourceCompatibility(JavaVersion.VERSION_11)
|
||||
targetCompatibility(JavaVersion.VERSION_11)
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
jniLibs.useLegacyPackaging = true
|
||||
arrayOf("armeabi-v7a", "x86", "arm64-v8a", "x86_64").forEach { abi ->
|
||||
val dh = file("${extra.get("PATH_LIB_BUILD_TOOLS")}/$abi")
|
||||
dh.listFiles().forEach {
|
||||
dh.listFiles()?.forEach {
|
||||
if (it.name.contains(".so"))
|
||||
jniLibs.pickFirsts.add("lib/$abi/${it.name}")
|
||||
}
|
||||
@ -86,7 +87,7 @@ android {
|
||||
|
||||
dependencies {
|
||||
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
|
||||
implementation("androidx.appcompat:appcompat:1.3.0")
|
||||
implementation("androidx.appcompat:appcompat:1.4.2")
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${rootProject.extra.get("kotlin_version")}")
|
||||
}
|
||||
|
||||
|
||||
@ -20,6 +20,7 @@ class X2t private constructor() {
|
||||
const val CONVERTER_CODE_FAIL = -1
|
||||
const val CONVERTER_CODE_SUCCESS = 0
|
||||
const val CONVERTER_CODE_EXIST = 1
|
||||
const val CONVERTER_CODE_ERROR_XML = 88
|
||||
const val CONVERTED_CODE_PASSWORD = 90
|
||||
const val CONVERTER_CODE_INVALID_PASSWORD = 91
|
||||
|
||||
|
||||
@ -4770,33 +4770,32 @@ void BinaryWorksheetTableWriter::WriteOleObjects(const OOX::Spreadsheet::CWorksh
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pImageFileCache == NULL && pOleObject->m_oObjectPr.IsInit() && pOleObject->m_oObjectPr->m_oRid.IsInit())
|
||||
{
|
||||
sIdImageFileCache = pOleObject->m_oObjectPr->m_oRid->GetValue();
|
||||
|
||||
smart_ptr<OOX::File> pFile = oWorksheet.Find(sIdImageFileCache);
|
||||
if (pFile.IsInit() && ( OOX::FileTypes::Image == pFile->type()))
|
||||
{
|
||||
pImageFileCache = static_cast<OOX::Image*>(pFile.GetPointer());
|
||||
}
|
||||
}
|
||||
if (pImageFileCache)
|
||||
{
|
||||
OOX::CPath pathImage = pImageFileCache->filename();
|
||||
|
||||
if (olePic->oleObject->m_OleObjectFile.IsInit())
|
||||
{
|
||||
olePic->oleObject->m_OleObjectFile->set_filename_cache(pathImage);
|
||||
}
|
||||
|
||||
olePic->blipFill.blip->embed = new OOX::RId(sIdImageFileCache); //ваще то тут не важно что - приоритет у того что ниже..
|
||||
olePic->blipFill.blip->oleFilepathImage = pathImage.GetPath();
|
||||
}
|
||||
|
||||
oCellAnchor->m_oElement = new PPTX::Logic::SpTreeElem();
|
||||
oCellAnchor->m_oElement->InitElem(olePic);
|
||||
}
|
||||
if (pImageFileCache == NULL && pOleObject->m_oObjectPr.IsInit() && pOleObject->m_oObjectPr->m_oRid.IsInit())
|
||||
{
|
||||
sIdImageFileCache = pOleObject->m_oObjectPr->m_oRid->GetValue();
|
||||
|
||||
smart_ptr<OOX::File> pFile = oWorksheet.Find(sIdImageFileCache);
|
||||
if (pFile.IsInit() && (OOX::FileTypes::Image == pFile->type()))
|
||||
{
|
||||
pImageFileCache = static_cast<OOX::Image*>(pFile.GetPointer());
|
||||
}
|
||||
}
|
||||
if (pImageFileCache)
|
||||
{
|
||||
OOX::CPath pathImage = pImageFileCache->filename();
|
||||
|
||||
if (olePic->oleObject->m_OleObjectFile.IsInit())
|
||||
{
|
||||
olePic->oleObject->m_OleObjectFile->set_filename_cache(pathImage);
|
||||
}
|
||||
|
||||
olePic->blipFill.blip->embed = new OOX::RId(sIdImageFileCache); //ваще то тут не важно что - приоритет у того что ниже..
|
||||
olePic->blipFill.blip->oleFilepathImage = pathImage.GetPath();
|
||||
}
|
||||
|
||||
oCellAnchor->m_oElement = new PPTX::Logic::SpTreeElem();
|
||||
oCellAnchor->m_oElement->InitElem(olePic);
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
if (oCellAnchor.IsInit())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user