Commit 3143829d authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

XlsFormat - fix конвертации файлов с форматом не по спецификации (доп поля)

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@68190 954022d7-b5bf-4e40-9824-e11837661b57
parent d1dbf659
......@@ -22,9 +22,7 @@ BaseObjectPtr BigName::clone()
void BigName::writeFields(CFRecord& record)
{
#pragma message("####################### BigName record is not implemented")
Log::error("BigName record is not implemented.");
//record << some_value;
}
......@@ -32,7 +30,8 @@ void BigName::readFields(CFRecord& record)
{
#pragma message("####################### BigName record is not implemented")
Log::error("BigName record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -22,18 +22,13 @@ BaseObjectPtr BkHim::clone()
void BkHim::writeFields(CFRecord& record)
{
#pragma message("####################### BkHim record is not implemented")
Log::error("BkHim record is not implemented.");
//record << some_value;
}
void BkHim::readFields(CFRecord& record)
{
//#pragma message("####################### BkHim record is not implemented")
//Log::error("BkHim record is not implemented.");
//record >> some_value;
_UINT16 cf;
_UINT32 lcb;
......
......@@ -29,9 +29,7 @@ BaseObjectPtr CF12::clone()
void CF12::writeFields(CFRecord& record)
{
#pragma message("####################### CF12 record is not implemented")
Log::error("CF12 record is not implemented.");
//record << some_value;
}
......
......@@ -22,9 +22,7 @@ BaseObjectPtr CFEx::clone()
void CFEx::writeFields(CFRecord& record)
{
#pragma message("####################### CFEx record is not implemented")
Log::error("CFEx record is not implemented.");
//record << some_value;
}
......
......@@ -23,9 +23,7 @@ BaseObjectPtr CRN::clone()
void CRN::writeFields(CFRecord& record)
{
#pragma message("####################### CRN record is not implemented")
Log::error("CRN record is not implemented.");
//record << some_value;
}
......
......@@ -23,9 +23,7 @@ BaseObjectPtr ChartFrtInfo::clone()
void ChartFrtInfo::writeFields(CFRecord& record)
{
#pragma message("####################### ChartFrtInfo record is not implemented")
Log::error("ChartFrtInfo record is not implemented.");
//record << some_value;
}
......@@ -36,8 +34,7 @@ void ChartFrtInfo::readFields(CFRecord& record)
unsigned short cCFRTID;
record >> cCFRTID;
#pragma message("####################### ChartFrtInfo record is not implemented")
Log::error("ChartFrtInfo record is not implemented.");
}
} // namespace XLS
......
......@@ -22,9 +22,7 @@ BaseObjectPtr CondFmt12::clone()
void CondFmt12::writeFields(CFRecord& record)
{
#pragma message("####################### CondFmt12 record is not implemented")
Log::error("CondFmt12 record is not implemented.");
//record << some_value;
}
......
......@@ -22,9 +22,7 @@ BaseObjectPtr ContinueBigName::clone()
void ContinueBigName::writeFields(CFRecord& record)
{
#pragma message("####################### ContinueBigName record is not implemented")
Log::error("ContinueBigName record is not implemented.");
//record << some_value;
}
......@@ -32,7 +30,8 @@ void ContinueBigName::readFields(CFRecord& record)
{
#pragma message("####################### ContinueBigName record is not implemented")
Log::error("ContinueBigName record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -22,9 +22,7 @@ BaseObjectPtr ContinueFrt::clone()
void ContinueFrt::writeFields(CFRecord& record)
{
#pragma message("####################### ContinueFrt record is not implemented")
Log::error("ContinueFrt record is not implemented.");
//record << some_value;
}
......@@ -32,7 +30,8 @@ void ContinueFrt::readFields(CFRecord& record)
{
#pragma message("####################### ContinueFrt record is not implemented")
Log::error("ContinueFrt record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -22,9 +22,7 @@ BaseObjectPtr CrErr::clone()
void CrErr::writeFields(CFRecord& record)
{
#pragma message("####################### CrErr record is not implemented")
Log::error("CrErr record is not implemented.");
//record << some_value;
}
......@@ -33,7 +31,7 @@ void CrErr::readFields(CFRecord& record)
#pragma message("####################### CrErr record is not implemented")
Log::error("CrErr record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -22,9 +22,7 @@ BaseObjectPtr CrtLayout12A::clone()
void CrtLayout12A::writeFields(CFRecord& record)
{
#pragma message("####################### CrtLayout12A record is not implemented")
Log::error("CrtLayout12A record is not implemented.");
//record << some_value;
}
......@@ -32,7 +30,8 @@ void CrtLayout12A::readFields(CFRecord& record)
{
#pragma message("####################### CrtLayout12A record is not implemented")
Log::error("CrtLayout12A record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -22,9 +22,7 @@ BaseObjectPtr CrtMlFrt::clone()
void CrtMlFrt::writeFields(CFRecord& record)
{
#pragma message("####################### CrtMlFrt record is not implemented")
Log::error("CrtMlFrt record is not implemented.");
//record << some_value;
}
......@@ -33,7 +31,7 @@ void CrtMlFrt::readFields(CFRecord& record)
#pragma message("####################### CrtMlFrt record is not implemented")
Log::error("CrtMlFrt record is not implemented.");
record >> cb;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
//
// if (cb > 0)
// {
......
......@@ -22,9 +22,7 @@ BaseObjectPtr CrtMlFrtContinue::clone()
void CrtMlFrtContinue::writeFields(CFRecord& record)
{
#pragma message("####################### CrtMlFrtContinue record is not implemented")
Log::error("CrtMlFrtContinue record is not implemented.");
//record << some_value;
}
......@@ -32,7 +30,8 @@ void CrtMlFrtContinue::readFields(CFRecord& record)
{
#pragma message("####################### CrtMlFrtContinue record is not implemented")
Log::error("CrtMlFrtContinue record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -33,6 +33,8 @@ void DBQueryExt::readFields(CFRecord& record)
#pragma message("####################### DBQueryExt record is not implemented")
Log::error("DBQueryExt record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -33,6 +33,7 @@ void DConBin::readFields(CFRecord& record)
#pragma message("####################### DConBin record is not implemented")
Log::error("DConBin record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -32,7 +32,8 @@ void DConName::readFields(CFRecord& record)
{
#pragma message("####################### DConName record is not implemented")
Log::error("DConName record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -32,7 +32,8 @@ void DConRef::readFields(CFRecord& record)
{
#pragma message("####################### DConRef record is not implemented")
Log::error("DConRef record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -33,7 +33,7 @@ void DConn::readFields(CFRecord& record)
#pragma message("####################### DConn record is not implemented")
Log::error("DConn record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -22,9 +22,7 @@ BaseObjectPtr DXF::clone()
void DXF::writeFields(CFRecord& record)
{
#pragma message("####################### DXF record is not implemented")
Log::error("DXF record is not implemented.");
//record << some_value;
}
......
......@@ -33,6 +33,8 @@ void DbOrParamQry::readFields(CFRecord& record)
#pragma message("####################### DbOrParamQry record is not implemented")
Log::error("DbOrParamQry record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -32,7 +32,8 @@ void DocRoute::readFields(CFRecord& record)
{
#pragma message("####################### DocRoute record is not implemented")
Log::error("DocRoute record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -23,9 +23,7 @@ BaseObjectPtr DropDownObjIds::clone()
void DropDownObjIds::writeFields(CFRecord& record)
{
#pragma message("####################### DropDownObjIds record is not implemented")
Log::error("DropDownObjIds record is not implemented.");
//record << some_value;
}
......
......@@ -12,9 +12,7 @@ BaseObjectPtr Dv::clone()
void Dv::writeFields(CFRecord& record)
{
#pragma message("####################### Dv record is not implemented")
Log::error("Dv record is not implemented.");
//record << some_value;
}
......
......@@ -22,9 +22,7 @@ BaseObjectPtr End::clone()
void End::writeFields(CFRecord& record)
{
#pragma message("####################### End record is not implemented")
Log::error("End record is not implemented.");
//record << some_value;
}
......
......@@ -36,6 +36,7 @@ void ExtSST::writeFields(CFRecord& record)
void ExtSST::readFields(CFRecord& record)
{
record >> dsst;
while(!record.isEOF())
{
ISSTInfPtr element(new ISSTInf);
......
#include "FrtWrapper.h"
namespace XLS
{
FrtWrapper::FrtWrapper()
{
}
FrtWrapper::~FrtWrapper()
{
}
BaseObjectPtr FrtWrapper::clone()
{
return BaseObjectPtr(new FrtWrapper(*this));
}
void FrtWrapper::writeFields(CFRecord& record)
{
}
void FrtWrapper::readFields(CFRecord& record)
{
#pragma message("####################### FrtWrapper record is not implemented")
Log::error("FrtWrapper record is not implemented.");
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
#pragma once
#include "BiffRecord.h"
namespace XLS
{
// Logical representation of FrtWrapper record in BIFF8
class FrtWrapper: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(FrtWrapper)
BASE_OBJECT_DEFINE_CLASS_NAME(FrtWrapper)
public:
FrtWrapper();
~FrtWrapper();
BaseObjectPtr clone();
void writeFields(CFRecord& record);
void readFields(CFRecord& record);
static const ElementType type = typeFrtWrapper;
};
} // namespace XLS
......@@ -21,6 +21,7 @@ public:
void writeFields(CFRecord& record);
void readFields(CFRecord& record);
static const ElementType type = typeLineFormat;
int serialize(std::wostream & _stream);
//-----------------------------
LongRGB rgb;
......
......@@ -33,6 +33,7 @@ void SXAddl::readFields(CFRecord& record)
#pragma message("####################### SXAddl record is not implemented")
Log::error("SXAddl record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -33,6 +33,7 @@ void SXDI::readFields(CFRecord& record)
#pragma message("####################### SXDI record is not implemented")
Log::error("SXDI record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -33,6 +33,7 @@ void SXLI::readFields(CFRecord& record)
#pragma message("####################### SXLI record is not implemented")
Log::error("SXLI record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -33,6 +33,7 @@ void SXPI::readFields(CFRecord& record)
#pragma message("####################### SXPI record is not implemented")
Log::error("SXPI record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -33,6 +33,7 @@ void SXPIEx::readFields(CFRecord& record)
#pragma message("####################### SXPIEx record is not implemented")
Log::error("SXPIEx record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -33,6 +33,7 @@ void SXStreamID::readFields(CFRecord& record)
#pragma message("####################### SXStreamID record is not implemented")
Log::error("SXStreamID record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -33,6 +33,7 @@ void SXString::readFields(CFRecord& record)
#pragma message("####################### SXString record is not implemented")
Log::error("SXString record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -33,6 +33,7 @@ void SXTBRGIITM::readFields(CFRecord& record)
#pragma message("####################### SXTBRGIITM record is not implemented")
Log::error("SXTBRGIITM record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -33,6 +33,7 @@ void SXTH::readFields(CFRecord& record)
#pragma message("####################### SXTH record is not implemented")
Log::error("SXTH record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -33,6 +33,7 @@ void SXTbl::readFields(CFRecord& record)
#pragma message("####################### SXTbl record is not implemented")
Log::error("SXTbl record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -33,6 +33,7 @@ void SXVDEx::readFields(CFRecord& record)
#pragma message("####################### SXVDEx record is not implemented")
Log::error("SXVDEx record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -33,6 +33,7 @@ void SXVDTEx::readFields(CFRecord& record)
#pragma message("####################### SXVDTEx record is not implemented")
Log::error("SXVDTEx record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -33,6 +33,7 @@ void SXVI::readFields(CFRecord& record)
#pragma message("####################### SXVI record is not implemented")
Log::error("SXVI record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -33,6 +33,9 @@ void SXVS::readFields(CFRecord& record)
#pragma message("####################### SXVS record is not implemented")
Log::error("SXVS record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -33,6 +33,7 @@ void SXViewEx::readFields(CFRecord& record)
#pragma message("####################### SXViewEx record is not implemented")
Log::error("SXViewEx record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -33,6 +33,7 @@ void SXViewEx9::readFields(CFRecord& record)
#pragma message("####################### SXViewEx9 record is not implemented")
Log::error("SXViewEx9 record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -33,6 +33,7 @@ void SXViewLink::readFields(CFRecord& record)
#pragma message("####################### SXViewLink record is not implemented")
Log::error("SXViewLink record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -33,6 +33,7 @@ void SxDXF::readFields(CFRecord& record)
#pragma message("####################### SxDXF record is not implemented")
Log::error("SxDXF record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -33,6 +33,7 @@ void SxFilt::readFields(CFRecord& record)
#pragma message("####################### SxFilt record is not implemented")
Log::error("SxFilt record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -33,6 +33,7 @@ void SxFormat::readFields(CFRecord& record)
#pragma message("####################### SxFormat record is not implemented")
Log::error("SxFormat record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -33,6 +33,7 @@ void SxItm::readFields(CFRecord& record)
#pragma message("####################### SxItm record is not implemented")
Log::error("SxItm record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -33,6 +33,7 @@ void SxIvd::readFields(CFRecord& record)
#pragma message("####################### SxIvd record is not implemented")
Log::error("SxIvd record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -33,6 +33,7 @@ void SxRule::readFields(CFRecord& record)
#pragma message("####################### SxRule record is not implemented")
Log::error("SxRule record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -33,6 +33,7 @@ void SxSelect::readFields(CFRecord& record)
#pragma message("####################### SxSelect record is not implemented")
Log::error("SxSelect record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -33,6 +33,9 @@ void SxTbpg::readFields(CFRecord& record)
#pragma message("####################### SxTbpg record is not implemented")
Log::error("SxTbpg record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -33,6 +33,7 @@ void SxView::readFields(CFRecord& record)
#pragma message("####################### SxView record is not implemented")
Log::error("SxView record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -33,6 +33,8 @@ void Sxvd::readFields(CFRecord& record)
#pragma message("####################### Sxvd record is not implemented")
Log::error("Sxvd record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -32,7 +32,8 @@ void YMult::readFields(CFRecord& record)
{
#pragma message("####################### YMult record is not implemented")
Log::error("YMult record is not implemented.");
//record >> some_value;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
}
} // namespace XLS
......
......@@ -139,29 +139,19 @@ XLS::BiffStructurePtr OfficeArtChildAnchor::clone()
int OfficeArtChildAnchor::serialize(std::wostream &stream)
{
//-------------------------------------------------
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"xdr:from")
CP_XML_NODE(L"a:xfrm")
{
CP_XML_NODE(L"xdr:colOff")
CP_XML_NODE(L"a:off")
{
CP_XML_STREAM() << boost::lexical_cast<std::wstring>(_dxL );
CP_XML_ATTR(L"x", _x);
CP_XML_ATTR(L"y", _y);
}
CP_XML_NODE(L"xdr:rowOff")
{
CP_XML_STREAM() << boost::lexical_cast<std::wstring>(_dyT);
}
}
CP_XML_NODE(L"xdr:to")
{
CP_XML_NODE(L"xdr:colOff")
{
CP_XML_STREAM() << boost::lexical_cast<std::wstring>(_dxR );
}
CP_XML_NODE(L"xdr:rowOff")
{
CP_XML_STREAM() << boost::lexical_cast<std::wstring>(_dyB);
CP_XML_ATTR(L"cx", _cx);
CP_XML_ATTR(L"cy", _cy);
}
}
}
......@@ -174,37 +164,24 @@ void OfficeArtChildAnchor::loadFields(XLS::CFRecord& record)
record >> dxL >> dyT >> dxR >> dyB;
//----------------------------------------------------------------------------------------------------
double kfCol = 17640 / 256.;
double kfRow = ( 360000 * 2.54 / 72) / 256. ;
_x = (std::min)(dxL, dxR);
_cx = (std::max)(dxL, dxR) - _x;
_y = (std::min)(dyT, dyB) ;
_cy = (std::max)(dyT, dyB) - _y;
//if (global_info->customColumnsWidth.find(colL) != global_info->customColumnsWidth.end())
//{
// _dxL = dxL * kfCol * global_info->customColumnsWidth[colL];
//}
//else
_dxL = dxL * kfCol * global_info->defaultColumnWidth;
if (_x < 0) _x = 0;
if (_y < 0) _y = 0;
//if (global_info->customColumnsWidth.find(colR) != global_info->customColumnsWidth.end())
//{
// _dxR = dxR * kfCol * global_info->customColumnsWidth[colR];
//}
//else
_dxR = dxR * kfCol * global_info->defaultColumnWidth;
double kfCol = 17640 / 256.;
double kfRow = ( 360000 * 2.54 / 72) / 256. ;
//---------------------------------------------------------------------------------------------------
//if (global_info->customRowsHeight.find(rwT) != global_info->customRowsHeight.end())
//{
// _dyT = dyT * kfRow * global_info->customRowsHeight[rwT];
//}
//else
_dyT = dyT * kfRow * global_info->defaultRowHeight;
//if (global_info->customRowsHeight.find(rwB) != global_info->customRowsHeight.end())
//{
// _dyB = dyB * kfRow * global_info->customRowsHeight[rwB];
//}
//else
_dyB = dyB * kfRow * global_info->defaultRowHeight;
_x *= 326;
_cx *= 326;
_y *= kfRow;//326;
_cy *= kfRow;//326;
//todooo . ... flip?
}
} // namespace XLS
......
......@@ -65,10 +65,10 @@ public:
short dxR;
short dyB;
_UINT32 _dxL;
_UINT32 _dyT;
_UINT32 _dxR;
_UINT32 _dyB;
int _x;
int _y;
int _cx;
int _cy;
};
typedef boost::shared_ptr<OfficeArtChildAnchor> OfficeArtChildAnchorPtr;
......
......@@ -18,24 +18,6 @@ XLS::BiffStructurePtr OfficeArtFSPGR::clone()
}
//void OfficeArtFSPGR::setXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
// xml_tag->setAttribute(L"xLeft", xLeft);
// xml_tag->setAttribute(L"yTop", yTop);
// xml_tag->setAttribute(L"xRight", xRight);
// xml_tag->setAttribute(L"yBottom", yBottom);
//}
//
//void OfficeArtFSPGR::getXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
// xLeft = getStructAttribute(xml_tag, L"xLeft");
// yTop = getStructAttribute(xml_tag, L"yTop");
// xRight = getStructAttribute(xml_tag, L"xRight");
// yBottom = getStructAttribute(xml_tag, L"yBottom");
//}
void OfficeArtFSPGR::storeFields(XLS::CFRecord& record)
{
record << xLeft << yTop << xRight << yBottom;
......
......@@ -53,14 +53,15 @@ const bool AXISPARENT::loadContent(BinProcessor& proc)
}
int count = proc.repeated<CRT>(1, 4);
while(count > 0)
while(count > 0 && !elements_.empty())
{
m_arCRT.insert(m_arCRT.begin(), elements_.back());
elements_.pop_back();
count--;
}
proc.mandatory<End>(); elements_.pop_back();
if (proc.mandatory<End>()) elements_.pop_back();
return true;
}
......
......@@ -4,6 +4,7 @@
#include <Logic/Biff_records/StartObject.h>
#include <Logic/Biff_unions/ATTACHEDLABEL.h>
#include <Logic/Biff_records/EndObject.h>
#include <Logic/Biff_records/FrtWrapper.h>
namespace XLS
{
......@@ -32,11 +33,17 @@ const bool AXM::loadContent(BinProcessor& proc)
{
return false;
}
m_YMult = elements_.back(); elements_.pop_back();
proc.mandatory<StartObject>(); elements_.pop_back();
proc.mandatory<ATTACHEDLABEL>();
m_ATTACHEDLABEL = elements_.back(); elements_.pop_back();
proc.mandatory<EndObject>(); elements_.pop_back();
m_YMult = elements_.back(); elements_.pop_back();
if (proc.optional<StartObject>()) elements_.pop_back();
int count = proc.repeated<FrtWrapper>(0,0);
if (proc.optional<ATTACHEDLABEL>())
{
m_ATTACHEDLABEL = elements_.back(); elements_.pop_back();
}
if (proc.optional<EndObject>()) elements_.pop_back();
return true;
}
......
......@@ -12,6 +12,8 @@
#include <Logic/Biff_records/ContinueFrt12.h>
#include <Logic/Biff_records/Font.h>
#include <Logic/Biff_records/StartObject.h>
#include <Logic/Biff_records/EndObject.h>
namespace XLS
{
......@@ -43,6 +45,11 @@ public:
return false;
}
proc.mandatory<LineFormat>();
if (proc.optional<StartObject>())
{
proc.optional<EndObject>();
}
return true;
};
};
......
......@@ -144,8 +144,12 @@ const bool CHARTFORMATS::loadContent(BinProcessor& proc)
}
count = proc.repeated<AXISPARENT>(1, 2);
m_arAXISPARENT.push_back(elements_.front());
elements_.pop_front(); count--;
if (elements_.size() > 0)
{
m_arAXISPARENT.push_back(elements_.front());
elements_.pop_front();
}
count--;
if (count > 0)
{
AXISPARENT * ax_first = dynamic_cast<AXISPARENT *>(m_arAXISPARENT[0].get());
......@@ -215,7 +219,7 @@ const bool CHARTFORMATS::loadContent(BinProcessor& proc)
}
count = proc.repeated<CRTMLFRT>(0, 2);
proc.mandatory<End>(); elements_.pop_back();
if(proc.mandatory<End>()) elements_.pop_back();
return true;
}
......
......@@ -35,7 +35,8 @@
#include <Logic/Biff_records/DropBar.h>
#include <Logic/Biff_records/CrtMlFrt.h>
#include <Logic/Biff_records/StartObject.h>
#include <Logic/Biff_records/EndObject.h>
namespace XLS
{
......@@ -162,7 +163,10 @@ const bool CRT::loadContent(BinProcessor& proc)
m_CrtLink = elements_.back();
elements_.pop_back();
}
if (proc.optional<StartObject>())
{
proc.optional<EndObject>();
}
if (proc.optional<SeriesList>())
{
m_SeriesList = elements_.back();
......
......@@ -7,6 +7,8 @@
#include <Logic/Biff_unions/GELFRAME.h>
#include <Logic/Biff_unions/SHAPEPROPS.h>
#include <Logic/Biff_records/End.h>
#include <Logic/Biff_records/StartObject.h>
#include <Logic/Biff_records/EndObject.h>
namespace XLS
{
......@@ -35,26 +37,34 @@ const bool DROPBAR::loadContent(BinProcessor& proc)
{
return false;
}
m_DropBar = elements_.back(); elements_.pop_back();
m_DropBar = elements_.back(); elements_.pop_back();
proc.mandatory<Begin>(); elements_.pop_back();
if (proc.mandatory<Begin>()) elements_.pop_back();
proc.mandatory<LineFormat>();
m_LineFormat = elements_.back(); elements_.pop_back();
proc.mandatory<AreaFormat>();
m_AreaFormat = elements_.back(); elements_.pop_back();
if (proc.mandatory<LineFormat>())
{
m_LineFormat = elements_.back(); elements_.pop_back();
}
if (proc.optional<StartObject>())
{
elements_.pop_back();
if (proc.mandatory<EndObject>()) elements_.pop_back();
}
if (proc.mandatory<AreaFormat>())
{
m_AreaFormat = elements_.back(); elements_.pop_back();
}
if (proc.optional<GELFRAME>())
{
m_GELFRAME = elements_.back(); elements_.pop_back();
m_GELFRAME = elements_.back(); elements_.pop_back();
}
if (proc.optional<SHAPEPROPS>())
{
m_SHAPEPROPS = elements_.back(); elements_.pop_back();
}
proc.mandatory<End>(); elements_.pop_back();
if (proc.mandatory<End>()) elements_.pop_back();
return true;
}
......
......@@ -82,7 +82,7 @@ const bool DVAXIS::loadContent(BinProcessor& proc)
elements_.pop_back();
}
proc.mandatory<End>(); elements_.pop_back();
if (proc.mandatory<End>()) elements_.pop_back();
return true;
}
......
......@@ -5,6 +5,7 @@
#include <Logic/Biff_records/Font.h>
#include <Logic/Biff_records/Fbi.h>
#include <Logic/Biff_records/EndObject.h>
#include <Logic/Biff_records/FrtWrapper.h>
namespace XLS
{
......
......@@ -9,6 +9,9 @@
#include <Logic/Biff_unions/GELFRAME.h>
#include <Logic/Biff_unions/SHAPEPROPS.h>
#include <Logic/Biff_records/StartObject.h>
#include <Logic/Biff_records/EndObject.h>
#include <utils.h>
namespace XLS
......@@ -41,32 +44,33 @@ const bool FRAME::loadContent(BinProcessor& proc)
m_Frame = elements_.back();
elements_.pop_back();
proc.mandatory<Begin>(); elements_.pop_back();
if (proc.mandatory<Begin>()) elements_.pop_back();
if (proc.mandatory<LineFormat>())
{
m_LineFormat = elements_.back();
m_LineFormat = elements_.back(); elements_.pop_back();
}
if (proc.optional<StartObject>())
{
elements_.pop_back();
if (proc.mandatory<EndObject>()) elements_.pop_back();
}
if (proc.mandatory<AreaFormat>())
{
m_AreaFormat = elements_.back();
elements_.pop_back();
m_AreaFormat = elements_.back(); elements_.pop_back();
}
if (proc.optional<GELFRAME>())
{
m_GELFRAME = elements_.back();
elements_.pop_back();
m_GELFRAME = elements_.back(); elements_.pop_back();
}
if (proc.optional<SHAPEPROPS>())
{
m_SHAPEPROPS = elements_.back();
elements_.pop_back();
m_SHAPEPROPS = elements_.back(); elements_.pop_back();
}
proc.mandatory<End>(); elements_.pop_back();
if(proc.mandatory<End>()) elements_.pop_back();
return true;
}
......
......@@ -68,14 +68,12 @@ int GELFRAME::serialize(std::wostream & _stream)
GelFrame * frame = dynamic_cast<GelFrame*>(m_GelFrame.get());
if (frame == NULL) return 0;
global_info->xls_converter->xlsx_context->get_drawing_context().start_drawing(2); //rect
global_info->xls_converter->convert(&frame->OPT1);
global_info->xls_converter->convert(&frame->OPT2);
global_info->xls_converter->xlsx_context->get_drawing_context().serialize_fill(_stream);
//global_info->xls_converter->xlsx_context->get_drawing_context().serialize_line(_stream);
global_info->xls_converter->xlsx_context->get_drawing_context().end_drawing();
return 0;
}
......
......@@ -92,7 +92,7 @@ const bool IVAXIS::loadContent(BinProcessor& proc)
// fix
proc.optional<CRTMLFRT>(); ///????
proc.mandatory<End>(); elements_.pop_back();
if (proc.mandatory<End>()) elements_.pop_back();
return true;
}
......
......@@ -191,7 +191,7 @@ const bool SERIESFORMAT::loadContent(BinProcessor& proc)
m_SeriesEx.push_back(ex);
}
proc.mandatory<End>(); elements_.pop_back(); //skip
if (proc.mandatory<End>()) elements_.pop_back(); //skip
return true;
}
......
......@@ -15,6 +15,9 @@
#include <Logic/Biff_unions/SHAPEPROPS.h>
#include <Logic/Biff_unions/CRTMLFRT.h>
#include <Logic/Biff_records/StartObject.h>
#include <Logic/Biff_records/EndObject.h>
namespace XLS
{
......@@ -73,63 +76,117 @@ const bool SS::loadContent(BinProcessor& proc)
m_DataFormat = elements_.back();
elements_.pop_back();
proc.mandatory<Begin>(); elements_.pop_back();
if (proc.optional<Chart3DBarShape>())
{
m_Chart3DBarShape = elements_.back();
elements_.pop_back();
}
if(proc.optional<LineFormat>())
if (proc.mandatory<Begin>())
{
m_LineFormat = elements_.back();
elements_.pop_back();
if (proc.optional<AreaFormat>())
while (true)
{
m_AreaFormat = elements_.back();
elements_.pop_back();
}
if (proc.optional<PieFormat>())
{
m_PieFormat = elements_.back();
elements_.pop_back();
CFRecordType::TypeId type = proc.getNextRecordType();
if (type == rt_NONE) break;
if (type == rt_End)
{
if (proc.mandatory<End>()) elements_.pop_back();
break;
}
switch(type)
{
case rt_Chart3DBarShape:
{
if (proc.optional<Chart3DBarShape>())
{
m_Chart3DBarShape = elements_.back();
elements_.pop_back();
}
}break;
case rt_LineFormat:
{
if(proc.optional<LineFormat>())
{
m_LineFormat = elements_.back();
elements_.pop_back();
}
}break;
case rt_AreaFormat:
{
if (proc.optional<AreaFormat>())
{
m_AreaFormat = elements_.back();
elements_.pop_back();
}
}break;
case rt_PieFormat:
{
if (proc.optional<PieFormat>())
{
m_PieFormat = elements_.back();
elements_.pop_back();
}
}break;
case rt_SerFmt:
{
if (proc.optional<SerFmt>())
{
m_SerFmt = elements_.back();
elements_.pop_back();
}
}break;
case rt_GelFrame:
{
if (proc.optional<GELFRAME>())
{
m_GELFRAME = elements_.back();
elements_.pop_back();
}
}break;
case rt_MarkerFormat:
{
if (proc.optional<MarkerFormat>())
{
m_MarkerFormat = elements_.back();
elements_.pop_back();
}
}break;
case rt_AttachedLabel:
{
if (proc.optional<AttachedLabel>())
{
m_AttachedLabel = elements_.back();
elements_.pop_back();
}
}break;
case rt_ShapePropsStream:
{
int count = proc.repeated<SHAPEPROPS>(0, 2);
while(count > 0)
{
m_arSHAPEPROPS.insert(m_arSHAPEPROPS.begin(), elements_.back());
elements_.pop_back();
count--;
}
}break;
case rt_CrtMlFrt:
{
proc.optional<CRTMLFRT>();
}break;
case rt_StartBlock:
case rt_EndBlock:
case rt_StartObject:
{
if (proc.optional<StartObject>())
{
elements_.pop_back();
if (proc.mandatory<EndObject>()) elements_.pop_back();
}
}break;
default://skip
{
return true;
}break;
}
}
}
if (proc.optional<SerFmt>())
{
m_SerFmt = elements_.back();
elements_.pop_back();
}
if (proc.optional<GELFRAME>())
{
m_GELFRAME = elements_.back();
elements_.pop_back();
}
if (proc.optional<MarkerFormat>())
{
m_MarkerFormat = elements_.back();
elements_.pop_back();
}
if (proc.optional<AttachedLabel>())
{
m_AttachedLabel = elements_.back();
elements_.pop_back();
}
int count = proc.repeated<SHAPEPROPS>(0, 2);
while(count > 0)
{
m_arSHAPEPROPS.insert(m_arSHAPEPROPS.begin(), elements_.back());
elements_.pop_back();
count--;
}
proc.optional<CRTMLFRT>();
proc.mandatory<End>(); elements_.pop_back();
return true;
}
......
......@@ -159,7 +159,16 @@ const bool BinReaderProcessor::getNextSubstreamType(unsigned short& type)
return true;
}
// Check the next record type
const CFRecordType::TypeId BinReaderProcessor::getNextRecordType()
{
CFRecordPtr record = reader_.touchTheNextRecord();
if(!record)
{
return rt_NONE; // EOF
}
return record->getTypeId();
}
void BinReaderProcessor::SeekToEOF()
{
reader_.SeekToEOF();
......
......@@ -58,7 +58,9 @@ public:
// Universal check if the we have the specified record in our processing plans (in binary it is not more than 'num_records_to_check' records forward)
virtual const bool checkNextRecord(const CFRecordType::TypeId desirable_type, const size_t num_records_to_check) = 0;
// Determine the next substream type
virtual const bool getNextSubstreamType(_UINT16& type) = 0;
virtual const CFRecordType::TypeId getNextRecordType() = 0;
virtual const bool getNextSubstreamType(_UINT16& type) = 0;
virtual void SeekToEOF() = 0;
BaseObject* getParent() const { return parent_;};
......@@ -82,7 +84,8 @@ public:
const bool checkNextRecord(const CFRecordType::TypeId desirable_type, const size_t num_records_to_check);
// Assume that the next record is BOF (if not - return false) and get the type without extracting is from cache
// In the case of stream end returns false
const bool getNextSubstreamType(_UINT16& type);
const CFRecordType::TypeId getNextRecordType();
const bool getNextSubstreamType(_UINT16& type);
void SeekToEOF();
private:
......
......@@ -285,7 +285,7 @@ int ChartSheetSubstream::serialize (std::wostream & _stream)
if (chart_rect)
{
pGlobalWorkbookInfo->xls_converter->xlsx_context->get_drawing_context().set_chart_sheet_anchor(chart_rect->dx.dVal, chart_rect->dy.dVal);
pGlobalWorkbookInfo->xls_converter->xlsx_context->get_drawing_context().set_absolute_anchor(chart_rect->dx.dVal, chart_rect->dy.dVal);
}
return 0;
......
......@@ -292,6 +292,15 @@ const bool GlobalsSubstream::loadContent(BinProcessor& proc)
count--;
}
proc.repeated<SUPBOOK>(0, 0);//order_history.xls
count = proc.repeated<LBL>(0, 0);
int start_pos = m_arLBL.size();
while(count > 0)
{
m_arLBL.insert(m_arLBL.begin() + start_pos, elements_.back());
elements_.pop_back();
count--;
}
SHAREDSTRINGS shared_strings(code_page_);
if (proc.optional(shared_strings))
......@@ -302,7 +311,11 @@ const bool GlobalsSubstream::loadContent(BinProcessor& proc)
proc.getGlobalWorkbookInfo()->startAddedSharedStrings = shared_strings.size_;
}
proc.optional<ExtSST>(); // OpenOffice Calc stored files workaround (ExtSST is mandatory according to [MS-XLS])
if (proc.optional<ExtSST>()) // OpenOffice Calc stored files workaround (ExtSST is mandatory according to [MS-XLS])
{
m_ExtSST = elements_.back();
elements_.pop_back();
}
proc.repeated<WebPub>(0, 0);
proc.optional<WOpt>();
proc.optional<CrErr>();
......
......@@ -29,6 +29,7 @@ public:
BaseObjectPtr m_Formating;
BaseObjectPtr m_Template;
BaseObjectPtr m_SHAREDSTRINGS;
BaseObjectPtr m_ExtSST;
BaseObjectPtr m_CodePage;
BaseObjectPtr m_Country;
......
......@@ -137,6 +137,7 @@ enum ElementType
typeFormula,
typeFrame,
typeFrtFontList,
typeFrtWrapper,
typeGelFrame,
typeGridSet,
typeGUIDTypeLib,
......
#pragma once
#include "BaseShape.h"
#include PPTShape.h"
NSGuidesVML::CBaseShape* NSPresentationEditor::CBaseShape::CreateByType(NSPresentationEditor::NSBaseShape::ClassType ClassType, int ShapeType)
{
#if defined(PPTX_DEF)
if(ClassType == pptx)
{
return CPPTXShape::CreateByType((OOXMLShapes::ShapeType)ShapeType);
}
#endif
#if defined(PPT_DEF)
if (ClassType == ppt)
{
return CPPTShape::CreateByType((PPTShapes::ShapeType)ShapeType);
}
#endif
return NULL;
}
bool NSGuidesVML::CBaseShape::SetType(NSPresentationEditor::NSBaseShape::ClassType ClassType, int ShapeType)
{
if (ClassType != GetClassType())
return false;
#if defined(PPTX_DEF)
if(ClassType == pptx)
{
return ((CPPTXShape*)this)->SetShapeType((OOXMLShapes::ShapeType)ShapeType);
}
#endif
#if defined(PPT_DEF)
if(ClassType == ppt)
{
return ((CPPTShape*)this)->SetShapeType((PPTShapes::ShapeType)ShapeType);
}
#endif
return false;
}
\ No newline at end of file
#pragma once
#include "PathShape.h"
#include "../../../Common/DocxFormat/Source/Common/SimpleTypes_Base.h"
class CHandle_
{
public:
std::wstring position;
std::wstring xrange;
std::wstring yrange;
std::wstring switchHandle;
std::wstring polar;
std::wstring radiusrange;
public:
CHandle_()
{
position = _T("");
xrange = _T("");
yrange = _T("");
switchHandle = _T("");
polar = _T("");
radiusrange = _T("");
}
CHandle_& operator =(const CHandle_& oSrc)
{
position = oSrc.position;
xrange = oSrc.xrange;
yrange = oSrc.yrange;
switchHandle = oSrc.switchHandle;
polar = oSrc.polar;
radiusrange = oSrc.radiusrange;
return (*this);
}
};
//
namespace NSGuidesVML
{
class CBaseShape
{
public:
std::vector<long> m_arAdjustments;
std::vector<double> m_arGuides;
LONG m_eJoin;
bool m_bConcentricFill;
std::vector<SimpleTypes::CPoint> m_arConnectors;
std::vector<LONG> m_arConnectorAngles;
std::vector<Aggplus::RECT> m_arTextRects;
std::vector<CHandle_> m_arHandles;
std::wstring m_strTransformXml;
std::wstring m_strPath;
std::wstring m_strRect;
LONG m_lLimoX;
LONG m_lLimoY;
CPath m_oPath;
public:
CBaseShape()
{
}
//virtual bool LoadFromXML(const std::wstring& xml) = 0;
//virtual bool LoadFromXML(XmlUtils::CXmlNode& xmlNode) = 0;
//virtual bool LoadAdjustValuesList(const std::wstring& xml) = 0;
//virtual bool LoadGuidesList(const std::wstring& xml) = 0;
//virtual bool LoadAdjustHandlesList(const std::wstring& xml) = 0;
//virtual bool LoadConnectorsList(const std::wstring& xml) = 0;
virtual bool LoadTextRect(const std::wstring& xml) = 0;
virtual bool LoadPathList(const std::wstring& xml) = 0;
//virtual bool SetAdjustment(long index, long value) = 0;
//virtual void ReCalculate() = 0;
//virtual void AddGuide(const std::wstring& strGuide) {}
static CBaseShape* CreateByType(int ShapeType);
bool SetType(int ShapeType);
//virtual bool SetProperties(CBaseShape* Shape)
//{
// if( Shape == NULL)
// return false;
// m_oPath = Shape->m_oPath;
// m_strPath = Shape->m_strPath;
// m_strRect = Shape->m_strRect;
//
// m_arAdjustments.clear();
// for(int i = 0; i < Shape->m_arAdjustments.size(); i++)
// m_arAdjustments.push_back(Shape->m_arAdjustments[i]);
// Guides.clear();
// for(int i = 0; i < Shape->Guides.size(); i++)
// Guides.push_back(Shape->Guides[i]);
// m_eJoin = Shape->m_eJoin;
// m_bConcentricFill = Shape->m_bConcentricFill;
// m_arConnectors.clear();
// for(int i = 0; i < Shape->m_arConnectors.size(); i++)
// m_arConnectors.push_back(Shape->m_arConnectors[i]);
// m_arConnectorAngles.clear();
// for(int i = 0; i < Shape->m_arConnectorAngles.size(); i++)
// m_arConnectorAngles.push_back(Shape->m_arConnectorAngles[i]);
// m_arTextRects.clear();
// for(int i = 0; i < Shape->m_arTextRects.size(); i++)
// m_arTextRects.push_back(Shape->m_arTextRects[i]);
// m_arHandles.clear();
// for(int i = 0; i < Shape->m_arHandles.size(); i++)
// m_arHandles.push_back(Shape->m_arHandles[i]);
// m_strRect = Shape->m_strRect;
// m_strTransformXml = Shape->m_strTransformXml;
// return true;
//}
//virtual bool SetToDublicate(CBaseShape* Shape)
//{
// if( Shape == NULL)
// return false;
// Shape->m_oPath = m_oPath;
// Shape->m_strPath = m_strPath;
// Shape->m_strRect = m_strRect;
//
// Shape->m_arAdjustments.clear();
// for(int i = 0; i < m_arAdjustments.size(); i++)
// Shape->m_arAdjustments.push_back(m_arAdjustments[i]);
// Shape->Guides.clear();
// for(int i = 0; i < Guides.size(); i++)
// Shape->Guides.push_back(Guides[i]);
// Shape->m_eJoin = m_eJoin;
// Shape->m_bConcentricFill = m_bConcentricFill;
// Shape->m_arConnectors.clear();
// for(int i = 0; i < m_arConnectors.size(); i++)
// Shape->m_arConnectors.push_back(m_arConnectors[i]);
// Shape->m_arConnectorAngles.clear();
// for(int i = 0; i < m_arConnectorAngles.size(); i++)
// Shape->m_arConnectorAngles.push_back(m_arConnectorAngles[i]);
// Shape->m_arTextRects.clear();
// for(int i = 0; i < m_arTextRects.size(); i++)
// Shape->m_arTextRects.push_back(m_arTextRects[i]);
// Shape->m_strRect = m_strRect;
// Shape->m_arHandles.clear();
// for(int i = 0; i < m_arHandles.size(); i++)
// Shape->m_arHandles.push_back(m_arHandles[i]);
// Shape->m_strTransformXml = m_strTransformXml;
// return true;
//}
};
}
\ No newline at end of file
#pragma once
#include "../../../../Common/DocxFormat/Source/Base/Types_32.h"
#define BINARY_READER_CHECK_OUT_RANGE(index, count) \
if (index > count) \
{ \
index = count; \
return 0; \
}
class CBinaryReader
{
private:
BYTE* m_pBuffer;
DWORD m_lCount;
DWORD m_lOrigin;
public:
CBinaryReader(BYTE* pBuffer, DWORD lCount)
{
m_pBuffer = pBuffer;
m_lCount = lCount;
m_lOrigin = 0;
}
~CBinaryReader()
{
m_pBuffer = NULL;
m_lCount = 0;
}
public:
LONG ReadLONG() // int32
{
DWORD lOldOrigin = m_lOrigin;
m_lOrigin += 4;
BINARY_READER_CHECK_OUT_RANGE(m_lOrigin, m_lCount)
return *(_INT32*)(m_pBuffer + lOldOrigin);
}
DWORD ReadDWORD()
{
DWORD lOldOrigin = m_lOrigin;
m_lOrigin += 4;
BINARY_READER_CHECK_OUT_RANGE(m_lOrigin, m_lCount)
return *(DWORD*)(m_pBuffer + lOldOrigin);
}
WORD ReadWORD()
{
DWORD lOldOrigin = m_lOrigin;
m_lOrigin += 2;
BINARY_READER_CHECK_OUT_RANGE(m_lOrigin, m_lCount)
return *(WORD*)(m_pBuffer + lOldOrigin);
}
SHORT ReadSHORT()
{
DWORD lOldOrigin = m_lOrigin;
m_lOrigin += 2;
BINARY_READER_CHECK_OUT_RANGE(m_lOrigin, m_lCount)
return *(short*)(m_pBuffer + lOldOrigin);
}
double ReadDOUBLE()
{
DWORD lOldOrigin = m_lOrigin;
m_lOrigin += sizeof(double);
BINARY_READER_CHECK_OUT_RANGE(m_lOrigin, m_lCount)
return *(SHORT*)(m_pBuffer + lOldOrigin);
}
};
#pragma once
#include "FormulaShape.h"
LONG NSGuidesVML::CFormula::Calculate(NSGuidesVML::CFormulasManager* pManager)
{
if ((0 > m_lIndex) || (m_lIndex >= pManager->m_arResults.size()))
return 0;
if (0xFFFFFFFF != pManager->m_arResults[m_lIndex])
{
return pManager->m_arResults[m_lIndex];
}
LONG lResult = 0;
LONG lGuidesCount = pManager->m_arFormulas.size();
LONG lAdjCount = pManager->m_pAdjustments->size();
LONG a1 = m_lParam1;
if (ptFormula == m_eType1)
{
a1 = (m_lParam1 >= lGuidesCount) ? 0 : pManager->m_arFormulas[m_lParam1].Calculate(pManager);
}
else if (ptAdjust == m_eType1)
{
a1 = (m_lParam1 >= lAdjCount) ? 0 : (*(pManager->m_pAdjustments))[m_lParam1];
}
LONG b1 = m_lParam2;
if (ptFormula == m_eType2)
{
b1 = (m_lParam2 >= lGuidesCount) ? 0 : pManager->m_arFormulas[m_lParam2].Calculate(pManager);
}
else if (ptAdjust == m_eType2)
{
b1 = (m_lParam2 >= lAdjCount) ? 0 : (*(pManager->m_pAdjustments))[m_lParam2];
}
LONG c1 = m_lParam3;
if (ptFormula == m_eType3)
{
c1 = (m_lParam3 >= lGuidesCount) ? 0 : pManager->m_arFormulas[m_lParam3].Calculate(pManager);
}
else if (ptAdjust == m_eType3)
{
c1 = (m_lParam3 >= lAdjCount) ? 0 : (*(pManager->m_pAdjustments))[m_lParam3];
}
double a = (double)a1;
double b = (double)b1;
double c = (double)c1;
double dRes = 0.0;
try
{
//
switch (m_eFormulaType)
{
case ftSum: { dRes = a + b - c; break; }
case ftProduct: {
if (0 == c)
c = 1;
dRes = a * b / c;
break;
}
case ftMid: { dRes = (a + b) / 2.0; break; }
case ftAbsolute: { dRes = abs(a); break; }
case ftMin: { dRes = (std::min)(a, b); break; }
case ftMax: { dRes = (std::max)(a, b); break; }
case ftIf: { dRes = (a > 0) ? b : c; break; }
case ftSqrt: { dRes = sqrt(a); break; }
case ftMod: { dRes = sqrt(a*a + b*b + c*c); break; }
case ftSin: {
//dRes = a * sin(b);
//dRes = a * sin(b / pow2_16);
dRes = a * sin(M_PI * b / (pow2_16 * 180));
break;
}
case ftCos: {
//dRes = a * cos(b);
//dRes = a * cos(b / pow2_16);
dRes = a * cos(M_PI * b / (pow2_16 * 180));
break;
}
case ftTan: {
//dRes = a * tan(b);
dRes = a * tan(M_PI * b / (pow2_16 * 180));
break;
}
case ftAtan2: {
dRes = 180 * pow2_16 * atan2(b,a) / M_PI;
break;
}
case ftSinatan2: { dRes = a * sin(atan2(c,b)); break; }
case ftCosatan2: { dRes = a * cos(atan2(c,b)); break; }
case ftSumangle: {
//dRes = a + b - c;
dRes = a + b * pow2_16 - c * pow2_16;
/*while (23592960 < dRes)
{
dRes -= 23592960;
}
while (-23592960 > dRes)
{
dRes += 23592960;
}*/
break;
}
case ftEllipse: {
if (0 == b)
b = 1;
dRes = c * sqrt(1-(a*a/(b*b)));
break;
}
case ftVal: { dRes = a; break; }
default: break;
};
}
catch (...)
{
dRes = 0;
}
lResult = (LONG)dRes;
pManager->m_arResults[m_lIndex] = lResult;
return lResult;
}
#pragma once
#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#include "ShapeUtils.h"
#include "../../../../Common/DocxFormat/Source/XML/xmlutils.h"
#include "../../../../DesktopEditor/graphics/aggplustypes.h"
namespace NSGuidesVML
{
enum FormulaType
{
// VML
ftSum = 0, // a + b - c
ftProduct = 1, // a * b / c
ftMid = 2, // (a + b) / 2
ftAbsolute = 3, // abs(a)
ftMin = 4, // min(a,b)
ftMax = 5, // max(a,b)
ftIf = 6, // if a > 0 ? b : c
ftMod = 7, // sqrt(a*a + b*b + c*c)
ftAtan2 = 8, // atan2(b,a)
ftSin = 9, // a * sin(b)
ftCos = 10, // a * cos(b)
ftCosatan2 = 11, // a * cos(atan2(c,b))
ftSinatan2 = 12, // a * sin(atan2(c,b))
ftSqrt = 13, // sqrt(a)
ftSumangle = 14, // a + b - c
ftEllipse = 15, // c * sqrt(1-(a/b)2)
ftTan = 16, // a * tan(b)
ftVal = 17 // a
};
#define VML_GUIDE_COUNT 18
const LPSTR VML_GUIDE_TYPE[VML_GUIDE_COUNT] = {
"sum",
"prod",
"mid",
"abs",
"min",
"max",
"if",
"mod",
"atan2",
"sin",
"cos",
"cosatan2",
"sinatan2",
"sqrt",
"sumangle",
"ellipse",
"tan",
"val"
};
const BYTE VML_GUIDE_PARAM_COUNT[VML_GUIDE_COUNT] = {
3,
3,
2,
1,
2,
2,
3,
3,
2,
2,
2,
3,
3,
1,
3,
3,
2,
1
};
enum ParamType
{
ptFormula = 0,
ptAdjust = 1,
ptValue = 2
};
static LONG GetValue(std::wstring strParam, ParamType& ptType, bool& bRes,
long lShapeWidth = ShapeSizeVML, long lShapeHeight = ShapeSizeVML)
{
ptType = ptValue;
bRes = true;
if ('#' == strParam[0])
{
ptType = ptAdjust;
return (LONG)XmlUtils::GetInteger(strParam.substr(1).c_str());
}
else if ('@' == strParam[0])
{
ptType = ptFormula;
return (LONG)XmlUtils::GetInteger(strParam.substr(1).c_str());
}
else if (!NSStringUtils::IsNumber(strParam))
{
if (_T("width") == strParam)
{
return lShapeWidth;
}
else if (_T("height") == strParam)
{
return lShapeHeight;
}
else if (_T("pixelWidth") == strParam)
{
return lShapeWidth;
}
else if (_T("pixelHeight") == strParam)
{
return lShapeHeight;
}
else if (_T("pixelLineWidth") == strParam || _T("lineDrawn") == strParam)
{
return 1;
}
else
{
bRes = false;
return 0;
}
}
else
{
ptType = ptValue;
return (int)XmlUtils::GetInteger(strParam.c_str());
}
}
static FormulaType GetFormula(std::wstring strName, bool& bRes)
{
bRes = true;
if (_T("sum") == strName) return ftSum;
else if ((_T("prod") == strName) || (_T("product") == strName)) return ftProduct;
else if (_T("mid") == strName) return ftMid;
else if ((_T("absolute") == strName) || (_T("abs") == strName)) return ftAbsolute;
else if (_T("min") == strName) return ftMin;
else if (_T("max") == strName) return ftMax;
else if (_T("if") == strName) return ftIf;
else if (_T("sqrt") == strName) return ftSqrt;
else if (_T("mod") == strName) return ftMod;
else if (_T("sin") == strName) return ftSin;
else if (_T("cos") == strName) return ftCos;
else if (_T("tan") == strName) return ftTan;
else if (_T("atan2") == strName) return ftAtan2;
else if (_T("sinatan2") == strName) return ftSinatan2;
else if (_T("cosatan2") == strName) return ftCosatan2;
else if (_T("sumangle") == strName) return ftSumangle;
else if (_T("ellipse") == strName) return ftEllipse;
else if (_T("val") == strName) return ftVal;
else bRes = false;
return ftVal;
}
}
namespace NSGuidesVML
{
struct SPointType
{
ParamType x;
ParamType y;
};
struct SPointExist
{
bool x;
bool y;
SPointExist()
{
x = false;
y = false;
}
};
struct SHandle
{
Aggplus::POINT gdRef;
SPointType gdRefType;
SPointExist bRefExist;
SPointExist bRefPolarExist;
Aggplus::POINT Max;
SPointType MaxType;
SPointExist bMaxExist;
SPointExist bMaxPolarExist;
Aggplus::POINT Min;
SPointType MinType;
SPointExist bMinExist;
SPointExist bMinPolarExist;
Aggplus::POINT Pos;
SPointType PosType;
Aggplus::POINT PolarCentre;
SPointType PolarCentreType;
};
class CFormulasManager;
class CFormula
{
public:
FormulaType m_eFormulaType;
int m_lIndex;
LONG m_lParam1;
ParamType m_eType1;
LONG m_lParam2;
ParamType m_eType2;
LONG m_lParam3;
ParamType m_eType3;
private:
long m_lCountRecurs;
public:
CFormula()
{
m_eFormulaType = ftSum;
m_lIndex = 0;
m_lParam1 = 0; m_eType1 = ptValue;
m_lParam2 = 0; m_eType2 = ptValue;
m_lParam3 = 0; m_eType3 = ptValue;
m_lCountRecurs = 0;
}
CFormula(int nIndex)
{
m_eFormulaType = ftSum;
m_lIndex = nIndex;
m_lParam1 = 0; m_eType1 = ptValue;
m_lParam2 = 0; m_eType2 = ptValue;
m_lParam3 = 0; m_eType3 = ptValue;
m_lCountRecurs = 0;
}
CFormula& operator =(const CFormula& oSrc)
{
m_eFormulaType = oSrc.m_eFormulaType;
m_lIndex = oSrc.m_lIndex;
m_lParam1 = oSrc.m_lParam1;
m_eType1 = oSrc.m_eType1;
m_lParam2 = oSrc.m_lParam2;
m_eType2 = oSrc.m_eType2;
m_lParam3 = oSrc.m_lParam3;
m_eType3 = oSrc.m_eType3;
m_lCountRecurs = 0;
return (*this);
}
void FromString(std::wstring strFormula, long lShapeWidth = ShapeSizeVML, long lShapeHeight = ShapeSizeVML)
{
std::vector<std::wstring> oArrayParams;
NSStringUtils::ParseString(_T(" "), strFormula, &oArrayParams);
int nCount = oArrayParams.size();
if (0 >= nCount)
return;
bool bRes = true;
m_eFormulaType = GetFormula(oArrayParams[0], bRes);
ParamType ptType = ptValue;
if (1 < nCount)
{
m_lParam1 = GetValue(oArrayParams[1], ptType, bRes, lShapeWidth, lShapeHeight);
m_eType1 = ptType;
}
if (2 < nCount)
{
m_lParam2 = GetValue(oArrayParams[2], ptType, bRes, lShapeWidth, lShapeHeight);
m_eType2 = ptType;
}
if (3 < nCount)
{
m_lParam3 = GetValue(oArrayParams[3], ptType, bRes, lShapeWidth, lShapeHeight);
m_eType3 = ptType;
}
}
LONG Calculate(CFormulasManager* pManager);
};
class CFormulasManager
{
public:
std::vector<LONG>* m_pAdjustments;
std::vector<LONG> m_arResults;
std::vector<CFormula> m_arFormulas;
long m_lShapeWidth;
long m_lShapeHeight;
public:
CFormulasManager() : m_arFormulas(), m_arResults()
{
m_pAdjustments = NULL;
m_lShapeWidth = ShapeSizeVML;
m_lShapeHeight = ShapeSizeVML;
}
CFormulasManager& operator =(const CFormulasManager& oSrc)
{
m_pAdjustments = oSrc.m_pAdjustments;
m_lShapeWidth = oSrc.m_lShapeWidth;
m_lShapeHeight = oSrc.m_lShapeHeight;
m_arResults.clear();
for (int nIndex = 0; nIndex < oSrc.m_arResults.size(); ++nIndex)
{
m_arResults.push_back(oSrc.m_arResults[nIndex]);
}
m_arFormulas.clear();
for (int nIndex = 0; nIndex < oSrc.m_arFormulas.size(); ++nIndex)
{
m_arFormulas.push_back(oSrc.m_arFormulas[nIndex]);
}
return (*this);
}
void Clear()
{
m_pAdjustments = NULL;
m_lShapeWidth = ShapeSizeVML;
m_lShapeHeight = ShapeSizeVML;
m_arFormulas.clear();
m_arResults.clear();
}
void Clear(std::vector<LONG>* pAdjusts)
{
m_pAdjustments = pAdjusts;
//m_arFormulas.clear();
//m_arResults.clear();
for (int nIndex = 0; nIndex < m_arResults.size(); ++nIndex)
{
m_arResults[nIndex] = 0xFFFFFFFF;
}
}
void AddFormula(std::wstring strFormula)
{
CFormula oFormula(m_arFormulas.size());
oFormula.FromString(strFormula, m_lShapeWidth, m_lShapeHeight);
m_arFormulas.push_back(oFormula);
m_arResults.push_back(0xFFFFFFFF);
}
void AddFormula(CFormula oFormula)
{
oFormula.m_lIndex = m_arFormulas.size();
m_arFormulas.push_back(oFormula);
m_arResults.push_back(0xFFFFFFFF);
}
void CalculateResults()
{
for (int index = 0; index < m_arFormulas.size(); ++index)
{
LONG lResult = m_arFormulas[index].Calculate(this);
}
}
};
}
#pragma once
#include "../PPTShape.h"
// 51
class CAccentBorderCallout2Type : public CPPTShape
{
public:
CAccentBorderCallout2Type()
{
m_bConcentricFill = true;
m_eJoin = NSOfficeDrawing::lineJoinMiter;
//Encaps: Flat
m_strPath = _T("m@0@1l@2@3@4@5nfem@4,l@4,21600nfem,l21600,r,21600l,21600xe");
AddGuide(_T("val #0"));
AddGuide(_T("val #1"));
AddGuide(_T("val #2"));
AddGuide(_T("val #3"));
AddGuide(_T("val #4"));
AddGuide(_T("val #5"));
m_arAdjustments.push_back(-10080);
m_arAdjustments.push_back(24300);
m_arAdjustments.push_back(-3600);
m_arAdjustments.push_back(4050);
m_arAdjustments.push_back(-1800);
m_arAdjustments.push_back(4050);
LoadConnectorsList(_T("@0,@1;10800,0;10800,21600;0,10800;21600,10800"));
CHandle_ oHandle1;
oHandle1.position = _T("#0,#1");
m_arHandles.push_back(oHandle1);
CHandle_ oHandle2;
oHandle2.position = _T("#2,#3");
m_arHandles.push_back(oHandle2);
CHandle_ oHandle3;
oHandle3.position = _T("#4,#5");
m_arHandles.push_back(oHandle3);
}
};
\ No newline at end of file
#pragma once
#include "../PPTShape.h"
// 44
class CAccentCallout1Type : public CPPTShape
{
public:
CAccentCallout1Type()
{
m_bConcentricFill = true;
m_eJoin = NSOfficeDrawing::lineJoinMiter;
//Encaps: Flat
m_strPath = _T("m@0@1l@2@3nfem@2,l@2,21600nfem,l21600,r,21600l,21600nsxe");
AddGuide(_T("val #0"));
AddGuide(_T("val #1"));
AddGuide(_T("val #2"));
AddGuide(_T("val #3"));
m_arAdjustments.push_back(-8280);
m_arAdjustments.push_back(24300);
m_arAdjustments.push_back(-1800);
m_arAdjustments.push_back(4050);
LoadConnectorsList(_T("@0,@1;10800,0;10800,21600;0,10800;21600,10800"));
CHandle_ oHandle1;
oHandle1.position = _T("#0,#1");
m_arHandles.push_back(oHandle1);
CHandle_ oHandle2;
oHandle2.position = _T("#2,#3");
m_arHandles.push_back(oHandle2);
}
};
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment