Compare commits

..

4 Commits

19 changed files with 482 additions and 168 deletions

View File

@ -191,6 +191,12 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
}
CP_XML_STREAM() << impl_->drawing_.str();
if (!impl_->page_props_.str().empty())
{
CP_XML_STREAM() << impl_->page_props_.str();
}//props выше legacyDrawing !!
if (impl_->commentsId_.length()>0)
{
CP_XML_NODE(L"legacyDrawing")
@ -205,10 +211,7 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
CP_XML_STREAM() << impl_->ole_objects_.str();
}
}
if (!impl_->page_props_.str().empty())
{
CP_XML_STREAM() << impl_->page_props_.str();
}
//CP_XML_NODE(L"headerFooter){}
//CP_XML_NODE(L"rowBreaks){}

View File

@ -34,8 +34,6 @@
#include "office_presentation.h"
#include "draw_page.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
@ -76,9 +74,10 @@ void office_presentation::docx_convert(oox::docx_conversion_context & Context)
{
Context.start_office_text();
_CP_LOG << L"[info][docx] process pages (" << pages_.size() << L" elmements)" << std::endl;
BOOST_FOREACH(const office_element_ptr & elm, pages_)
{
elm->docx_convert(Context);
for (size_t i = 0; i < pages_.size(); i++)
{
pages_[i]->docx_convert(Context);
}
Context.end_office_text();
}
@ -87,9 +86,10 @@ void office_presentation::xlsx_convert(oox::xlsx_conversion_context & Context)
{
Context.start_office_spreadsheet(this);
_CP_LOG << L"[info][xlsx] process pages (" << pages_.size() << L" elmements)" << std::endl;
BOOST_FOREACH(const office_element_ptr & elm, pages_)
{
elm->xlsx_convert(Context);
for (size_t i = 0; i < pages_.size(); i++)
{
pages_[i]->xlsx_convert(Context);
}
Context.end_office_spreadsheet();
}
@ -100,29 +100,29 @@ void office_presentation::pptx_convert(oox::pptx_conversion_context & Context)
_CP_LOG << L"[info][pptx] process pages(" << pages_.size() << L" elmements)" << std::endl;
BOOST_FOREACH(const office_element_ptr & elm, footer_decls_)
for (size_t i = 0; i < footer_decls_.size(); i++)
{
presentation_footer_decl * style = dynamic_cast<presentation_footer_decl *>(elm.get());
presentation_footer_decl * style = dynamic_cast<presentation_footer_decl *>(footer_decls_[i].get());
if (!style)
continue;
std::wstring style_name_ = L"footer:" + style->presentation_name_.get_value_or(L"");
Context.root()->odf_context().drawStyles().add(style_name_, elm);
Context.root()->odf_context().drawStyles().add(style_name_, footer_decls_[i]);
}
BOOST_FOREACH(const office_element_ptr & elm, date_time_decls_)
{
presentation_date_time_decl * style = dynamic_cast<presentation_date_time_decl *>(elm.get());
for (size_t i = 0; i < date_time_decls_.size(); i++)
{
presentation_date_time_decl * style = dynamic_cast<presentation_date_time_decl *>(date_time_decls_[i].get());
if (!style)
continue;
std::wstring style_name_ = L"datetime:" + style->presentation_name_.get_value_or(L"");
Context.root()->odf_context().drawStyles().add(style_name_, elm);
Context.root()->odf_context().drawStyles().add(style_name_, date_time_decls_[i]);
}
BOOST_FOREACH(const office_element_ptr & elm, pages_)
for (size_t i = 0; i < pages_.size(); i++)
{
elm->pptx_convert(Context);
pages_[i]->pptx_convert(Context);
}
Context.end_office_presentation();
}

View File

@ -602,17 +602,24 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle*
bool bLine = odf_context()->drawing_context()->isLineShape();
if (!bLine)
if (custGeom && !custGeom->cxnLst.empty())
bLine = true;
odf_context()->drawing_context()->start_area_properties();
{
odf_context()->drawing_context()->start_area_properties();
if (bLine)
{
odf_context()->drawing_context()->set_no_fill();
}
else
{
if (oox_spPr->Fill.is_init())
convert(&oox_spPr->Fill);
else if (oox_sp_style)
convert(&oox_sp_style->fillRef, 1);
}
odf_context()->drawing_context()->end_area_properties();
}
odf_context()->drawing_context()->end_area_properties();
odf_context()->drawing_context()->start_line_properties();
{

View File

@ -72,6 +72,7 @@ using namespace cpdoccore;
namespace Oox2Odf
{
PptxConverter::PptxConverter(const std::wstring & path, const ProgressCallback* CallBack)
{
current_clrMap = NULL;
@ -342,7 +343,7 @@ void PptxConverter::convert_slides()
current_slide = slide->Master.operator->();
if (bShowLayoutMasterSp && bShowMasterSp)
convert_slide(&slide->Master->cSld, current_txStyles, false, true, 2);
convert_slide(&slide->Master->cSld, current_txStyles, false, true, Master);
else
convert(slide->Master->cSld.bg.GetPointer());
@ -350,7 +351,7 @@ void PptxConverter::convert_slides()
current_clrMap = slide->Layout->clrMapOvr->overrideClrMapping.GetPointer();
current_slide = slide->Layout.operator->();
convert_slide(&slide->Layout->cSld, current_txStyles, true, bShowLayoutMasterSp, 3);
convert_slide(&slide->Layout->cSld, current_txStyles, true, bShowLayoutMasterSp, Layout);
if (slide->Layout->transition.IsInit()) convert (slide->Layout->transition.GetPointer());
else convert (slide->Master->transition.GetPointer());
@ -402,7 +403,7 @@ void PptxConverter::convert_slides()
odp_context->current_slide().set_master_page (master_style_name);
odp_context->current_slide().set_layout_page (layout_style_name);
convert_slide (slide->cSld.GetPointer(), current_txStyles, true, bShowMasterSp, 1);
convert_slide (slide->cSld.GetPointer(), current_txStyles, true, bShowMasterSp, Slide);
convert (slide->comments.operator->());
convert (slide->Note.operator->());
@ -435,7 +436,7 @@ void PptxConverter::convert(PPTX::NotesMaster *oox_notes)
odf_context()->page_layout_context()->set_page_size(width, height);
}
convert_slide(&oox_notes->cSld, NULL, true, true, 2);
convert_slide(&oox_notes->cSld, NULL, true, true, NotesMaster);
odp_context->end_note();
@ -468,7 +469,7 @@ void PptxConverter::convert(PPTX::NotesSlide *oox_notes)
if (oox_notes->clrMapOvr.IsInit() && oox_notes->clrMapOvr->overrideClrMapping.IsInit())
current_clrMap = oox_notes->clrMapOvr->overrideClrMapping.GetPointer();
convert_slide(&oox_notes->cSld, NULL, true, true, 1);
convert_slide(&oox_notes->cSld, NULL, true, true, Notes);
odp_context->end_note();
@ -1312,13 +1313,19 @@ void PptxConverter::convert(PPTX::Logic::Bg *oox_background)
}
odf_writer::style* page_style_ = dynamic_cast<odf_writer::style*>(odp_context->current_slide().page_style_elm_.get());
odf_writer::style_drawing_page_properties* page_props = page_style_->content_.get_style_drawing_page_properties();
//необязательно
//if (page_props->content_.common_draw_fill_attlist_.draw_fill_image_name_)
//{
// page_props->content_.draw_background_size_ = L"border";
//}
odp_context->drawing_context()->end_drawing_background(page_props->content_.common_draw_fill_attlist_);
odp_context->end_drawings();
}
void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp, int type)
void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp, _typePages type)
{
if (oox_slide == NULL) return;
@ -1328,7 +1335,10 @@ void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxS
if (oox_slide->attrName.IsInit())
odp_context->current_slide().set_page_name(oox_slide->attrName.get());
convert(oox_slide->bg.GetPointer());
if (type != Notes && type != NotesMaster)
{
convert(oox_slide->bg.GetPointer());
}
for (size_t i = 0 ; i < oox_slide->spTree.SpTreeElems.size(); i++)
{
@ -1348,7 +1358,7 @@ void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxS
{
int ph_type = pShape->nvSpPr.nvPr.ph->type->GetBYTECode();
if (type == 3 && (ph_type == 5 || ph_type == 6 || ph_type == 7 || ph_type == 12))
if (type == Layout && (ph_type == 5 || ph_type == 6 || ph_type == 7 || ph_type == 12))
continue;
odf_context()->drawing_context()->set_placeholder_type(ph_type);

View File

@ -100,6 +100,14 @@ using namespace cpdoccore;
namespace Oox2Odf
{
enum _typePages
{
Slide,
Master,
Layout,
NotesMaster,
Notes
};
class PptxConverter : public OoxConverter
{
public:
@ -119,7 +127,7 @@ namespace Oox2Odf
void convert(OOX::WritingElement *oox_unknown);
void convert_slide (PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp, int type);
void convert_slide (PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp, _typePages type);
void convert_layout (PPTX::Logic::CSld *oox_slide);
void convert (PPTX::Comments *oox_comments);
void convert (PPTX::NotesSlide *oox_notes);

View File

@ -32,7 +32,6 @@
#include "FixedPoint.h"
#include <Binary/CFRecord.h>
//#include <Exception/AttributeDataWrong.h>
namespace OSHARED
{
@ -40,8 +39,14 @@ namespace OSHARED
FixedPoint::FixedPoint()
{
Integral = 0;
Fractional = 0;
}
FixedPoint::FixedPoint(unsigned short cbElement_)
{
Integral = 0;
Fractional = 0;
}
FixedPoint::FixedPoint(const int raw_data)
{
@ -49,7 +54,6 @@ FixedPoint::FixedPoint(const int raw_data)
Integral = static_cast<unsigned char>(raw_data >> 16);
}
XLS::BiffStructurePtr FixedPoint::clone()
{
return XLS::BiffStructurePtr(new FixedPoint(*this));

View File

@ -41,6 +41,7 @@ class CFRecord;
class FixedPoint : public XLS::BiffAttribute
{
public:
FixedPoint(unsigned short cbElement_); //fixed always!!
FixedPoint();
FixedPoint(const int raw_data);
XLS::BiffStructurePtr clone();

View File

@ -56,8 +56,11 @@ public:
unsigned short nElems, nElemsAlloc;
unsigned short cbElem;
int pos1 = record.getRdPtr();
record >> nElems >> nElemsAlloc >> cbElem;
while(nElems--)
for (unsigned short i = 0; i < nElems; i++)
{
Type element(cbElem);
record >> element;

View File

@ -223,18 +223,26 @@ OfficeArtFOPTEPtr OfficeArtFOPTE::load_and_create(XLS::CFRecord& record)
fopte = OfficeArtFOPTEPtr(new AdjustValue);
break;
case 0x0151:
fopte = OfficeArtFOPTEPtr(new pConnectionSites);
break;
case 0x0152:
fopte = OfficeArtFOPTEPtr(new pConnectionSitesDir);
break;
case 0x0153:
case 0x0154:
fopte = OfficeArtFOPTEPtr(new OfficeArtFOPTE);
break;
case 0x0155:
fopte = OfficeArtFOPTEPtr(new pAdjustHandles);
break;
case 0x0156:
fopte = OfficeArtFOPTEPtr(new pGuides);
break;
case 0x0152:
case 0x0153:
case 0x0154:
case 0x0155:
case 0x0157:
fopte = OfficeArtFOPTEPtr(new pInscribe);
break;
case 0x0158:
fopte = OfficeArtFOPTEPtr(new OfficeArtFOPTE);
fopte = OfficeArtFOPTEPtr(new OfficeArtFOPTE);//cxk
break;
case 0x017f:
fopte = OfficeArtFOPTEPtr(new GeometryBooleanProperties);
@ -427,6 +435,14 @@ OfficeArtFOPTEPtr OfficeArtFOPTE::load_and_create(XLS::CFRecord& record)
return fopte;
}
FixedPoint::FixedPoint()
{
dVal = 0;
}
FixedPoint::FixedPoint(unsigned short cbElement_)
{
dVal = 0;
}
void FixedPoint::load(XLS::CFRecord& record)
{
OfficeArtFOPTE::load(record);
@ -642,17 +658,6 @@ void pihlShape::ReadComplexData(XLS::CFRecord& record)
int pos = record.getRdPtr();
record >> complex;
int pos2 = record.getRdPtr() - pos;
if (pos2 > 0 && pos2 < op)
{
record.skipNunBytes(op - pos2);
}
if (pos2 > 0 && pos2 > op)
{
record.RollRdPtrBack( pos2 - op);
}
}
//---------------------------------------------------------------------------------------------
MSOPOINT::MSOPOINT()
@ -691,6 +696,44 @@ void MSOPOINT::load(XLS::CFRecord& record)
}
}
//---------------------------------------------------------------------------------------------
MSORECT::MSORECT()
{
cbElement = 8;
}
MSORECT::MSORECT(unsigned short cbElement_)
{
cbElement = 8;
if (cbElement_ == 0xfff0)
{
cbElement = 4;
}
}
XLS::BiffStructurePtr MSORECT::clone()
{
return XLS::BiffStructurePtr(new MSORECT(*this));
}
void MSORECT::load(XLS::CFRecord& record)
{
if (cbElement == 8)
{
record >> l >> t >> r >> b;
}
else
{
unsigned short l_, t_, r_, b_;
record >> l_ >> t_ >> r_ >> b_;
l = l_;
t = t_;
r = r_;
b = b_;
}
}
//---------------------------------------------------------------------------------------------
MSOPATHINFO::MSOPATHINFO()
{
cbElement = 4;
@ -926,17 +969,6 @@ void PVertices::ReadComplexData(XLS::CFRecord& record)
int pos = record.getRdPtr();
record >> complex;
int pos2 = record.getRdPtr() - pos;
if (pos2 > 0 && pos2 < op)
{
record.skipNunBytes(op - pos2);
}
if (pos2 > 0 && pos2 > op)
{
record.RollRdPtrBack( pos2 - op);
}
}
void PSegmentInfo::ReadComplexData(XLS::CFRecord& record)
@ -945,17 +977,6 @@ void PSegmentInfo::ReadComplexData(XLS::CFRecord& record)
int pos = record.getRdPtr();
record >> complex;
int pos2 = record.getRdPtr() - pos;
if (pos2 > 0 && pos2 < op)
{
record.skipNunBytes(op - pos2);
}
if (pos2 > 0 && pos2 > op)
{
record.RollRdPtrBack( pos2 - op);
}
}
void pGuides::ReadComplexData(XLS::CFRecord& record)
@ -964,17 +985,6 @@ void pGuides::ReadComplexData(XLS::CFRecord& record)
int pos = record.getRdPtr();
record >> complex;
int pos2 = record.getRdPtr() - pos;
if (pos2 > 0 && pos2 < op)
{
record.skipNunBytes(op - pos2);
}
if (pos2 > 0 && pos2 > op)
{
record.RollRdPtrBack( pos2 - op);
}
}
void pAdjustHandles::ReadComplexData(XLS::CFRecord& record)
{
@ -983,16 +993,26 @@ void pAdjustHandles::ReadComplexData(XLS::CFRecord& record)
int pos = record.getRdPtr();
record >> complex;
}
void pConnectionSites::ReadComplexData(XLS::CFRecord& record)
{
complex.op = op;
int pos = record.getRdPtr();
int pos2 = record.getRdPtr() - pos;
record >> complex;
}
void pConnectionSitesDir::ReadComplexData(XLS::CFRecord& record)
{
complex.op = op;
int pos = record.getRdPtr();
if (pos2 > 0 && pos2 < op)
{
record.skipNunBytes(op - pos2);
}
if (pos2 > 0 && pos2 > op)
{
record.RollRdPtrBack( pos2 - op);
}
record >> complex;
}
void pInscribe::ReadComplexData(XLS::CFRecord& record)
{
complex.op = op;
int pos = record.getRdPtr();
record >> complex;
}
}

View File

@ -88,7 +88,10 @@ class fillColor : public OfficeArtFOPTE
class FixedPoint : public OfficeArtFOPTE
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(fillColor)
BASE_STRUCTURE_DEFINE_CLASS_NAME(FixedPoint)
FixedPoint();
FixedPoint(unsigned short cbElement_); //fixed always!!
virtual void load(XLS::CFRecord& record);
double dVal;
@ -574,6 +577,28 @@ class MSOPOINT : public XLS::BiffStructure
int cbElement;
};
class MSORECT : public XLS::BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(MSORECT)
MSORECT(unsigned short cbElement_);
MSORECT();
XLS::BiffStructurePtr clone();
virtual void load(XLS::CFRecord& record);
static const XLS::ElementType type = XLS::typeOfficeArtRecord;
_INT32 l;
_INT32 t;
_INT32 r;
_INT32 b;
int cbElement;
};
class MSOPATHINFO : public XLS::BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(MSOPATHINFO)
@ -710,6 +735,40 @@ class pAdjustHandles : public OfficeArtFOPTE
IMsoArray<ADJH> complex;
};
class pConnectionSites : public OfficeArtFOPTE
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(pConnectionSites)
virtual void ReadComplexData(XLS::CFRecord& record);
IMsoArray<MSOPOINT> complex;
};
class pConnectionSitesDir : public OfficeArtFOPTE
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(pConnectionSitesDir)
virtual void ReadComplexData(XLS::CFRecord& record);
IMsoArray<ODRAW::FixedPoint> complex;
};
class pInscribe : public OfficeArtFOPTE
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(pInscribe)
virtual void ReadComplexData(XLS::CFRecord& record);
IMsoArray<MSORECT> complex;
};
//class cxk : public OfficeArtFOPTE
//{
// BASE_STRUCTURE_DEFINE_CLASS_NAME(cxk)
//
// virtual void ReadComplexData(XLS::CFRecord& record);
//
// IMsoArray<MSOCXK> complex;
//};
class lineOpacity : public OfficeArtFOPTE
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(lineOpacity)

View File

@ -115,30 +115,30 @@ public:
m_strRect = Shape->m_strRect;
m_arAdjustments.clear();
for(int i = 0; i < Shape->m_arAdjustments.size(); i++)
for(size_t i = 0; i < Shape->m_arAdjustments.size(); i++)
m_arAdjustments.push_back(Shape->m_arAdjustments[i]);
m_arGuides.clear();
for(int i = 0; i < Shape->m_arGuides.size(); i++)
for(size_t i = 0; i < Shape->m_arGuides.size(); i++)
m_arGuides.push_back(Shape->m_arGuides[i]);
m_eJoin = Shape->m_eJoin;
m_bConcentricFill = Shape->m_bConcentricFill;
m_arConnectors.clear();
for(int i = 0; i < Shape->m_arConnectors.size(); i++)
for(size_t 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++)
for(size_t 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++)
for(size_t 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++)
for(size_t i = 0; i < Shape->m_arHandles.size(); i++)
m_arHandles.push_back(Shape->m_arHandles[i]);
@ -157,26 +157,26 @@ public:
// Shape->m_strRect = m_strRect;
//
// Shape->m_arAdjustments.clear();
// for(int i = 0; i < m_arAdjustments.size(); i++)
// for(size_t 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++)
// for(size_t 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++)
// for(size_t 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++)
// for(size_t 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++)
// for(size_t i = 0; i < m_arTextRects.size(); i++)
// Shape->m_arTextRects.push_back(m_arTextRects[i]);
// Shape->m_strRect = m_strRect;

View File

@ -351,12 +351,12 @@ private:
m_lShapeHeight = oSrc.m_lShapeHeight;
m_arResults.clear();
for (int nIndex = 0; nIndex < oSrc.m_arResults.size(); ++nIndex)
for (size_t 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)
for (size_t nIndex = 0; nIndex < oSrc.m_arFormulas.size(); ++nIndex)
{
m_arFormulas.push_back(oSrc.m_arFormulas[nIndex]);
}
@ -379,7 +379,7 @@ private:
//m_arFormulas.clear();
//m_arResults.clear();
for (int nIndex = 0; nIndex < m_arResults.size(); ++nIndex)
for (size_t nIndex = 0; nIndex < m_arResults.size(); ++nIndex)
{
m_arResults[nIndex] = 0xFFFFFFFF;
}
@ -399,7 +399,7 @@ private:
}
void CalculateResults()
{
for (int index = 0; index < m_arFormulas.size(); ++index)
for (size_t index = 0; index < m_arFormulas.size(); ++index)
{
LONG lResult = m_arFormulas[index].CalculateFormula(this);
}

View File

@ -426,7 +426,7 @@ namespace NSCustomShapesConvert
{
m_eType = oSrc.m_eType;
this->m_arPoints.clear();
for (int nIndex = 0; nIndex < oSrc.m_arPoints.size(); ++nIndex)
for (size_t nIndex = 0; nIndex < oSrc.m_arPoints.size(); ++nIndex)
{
this->m_arPoints.push_back(oSrc.m_arPoints[nIndex]);
}
@ -771,7 +771,7 @@ namespace NSCustomShapesConvert
case rtAngleEllipseTo:
{
int nFigure = 0;
while ((nFigure + 3) <= this->m_arPoints.size())
while ((nFigure + 3) <= (int)this->m_arPoints.size())
{
double nLeft = this->m_arPoints[nFigure].dX - this->m_arPoints[nFigure + 1].dX / 2;
double nTop = this->m_arPoints[nFigure].dY - this->m_arPoints[nFigure + 1].dY / 2;
@ -790,7 +790,7 @@ namespace NSCustomShapesConvert
{
pRenderer->PathCommandStart();
int nFigure = 0;
while ((nFigure + 3) <= this->m_arPoints.size())
while ((nFigure + 3) <= (int)this->m_arPoints.size())
{
double nLeft = this->m_arPoints[nFigure].dX - this->m_arPoints[nFigure + 1].dX / 2;
double nTop = this->m_arPoints[nFigure].dY - this->m_arPoints[nFigure + 1].dY / 2;
@ -809,7 +809,7 @@ namespace NSCustomShapesConvert
{
pRenderer->PathCommandStart();
int nFigure = 0;
while ((nFigure + 4) <= this->m_arPoints.size())
while ((nFigure + 4) <= (int)this->m_arPoints.size())
{
double nCentreX = (this->m_arPoints[nFigure].dX + this->m_arPoints[nFigure + 1].dX) / 2;
double nCentreY = (this->m_arPoints[nFigure].dY + this->m_arPoints[nFigure + 1].dY) / 2;
@ -834,7 +834,7 @@ namespace NSCustomShapesConvert
case rtArcTo:
{
int nFigure = 0;
while ((nFigure + 4) <= this->m_arPoints.size())
while ((nFigure + 4) <= (int)this->m_arPoints.size())
{
double nCentreX = (this->m_arPoints[nFigure].dX + this->m_arPoints[nFigure + 1].dX) / 2;
double nCentreY = (this->m_arPoints[nFigure].dY + this->m_arPoints[nFigure + 1].dY) / 2;
@ -859,7 +859,7 @@ namespace NSCustomShapesConvert
case rtClockwiseArcTo:
{
int nFigure = 0;
while ((nFigure + 4) <= this->m_arPoints.size())
while ((nFigure + 4) <= (int)this->m_arPoints.size())
{
double nCentreX = (this->m_arPoints[nFigure].dX + this->m_arPoints[nFigure + 1].dX) / 2;
double nCentreY = (this->m_arPoints[nFigure].dY + this->m_arPoints[nFigure + 1].dY) / 2;
@ -885,7 +885,7 @@ namespace NSCustomShapesConvert
{
pRenderer->PathCommandStart();
int nFigure = 0;
while ((nFigure + 4) <= this->m_arPoints.size())
while ((nFigure + 4) <= (int)this->m_arPoints.size())
{
double nCentreX = (this->m_arPoints[nFigure].dX + this->m_arPoints[nFigure + 1].dX) / 2;
double nCentreY = (this->m_arPoints[nFigure].dY + this->m_arPoints[nFigure + 1].dY) / 2;

View File

@ -332,7 +332,7 @@ void XlsConverter::convert(XLS::WorkbookStreamObject* woorkbook)
convert((XLS::GlobalsSubstream*)woorkbook->m_GlobalsSubstream.get());
int count_sheets = 0, count_chart_sheets = 0;
for (int i=0 ; i < woorkbook->m_arWorksheetSubstream.size(); i++)
for (size_t i = 0 ; i < woorkbook->m_arWorksheetSubstream.size(); i++)
{
if (woorkbook->m_arWorksheetSubstream[i]->get_type() == XLS::typeWorksheetSubstream)
{
@ -406,14 +406,14 @@ void XlsConverter::convert(XLS::WorksheetSubstream* sheet)
{
CP_XML_NODE(L"mergeCells")
{
for (int i = 0 ; i < sheet->m_arMergeCells.size(); i++)
for (size_t i = 0 ; i < sheet->m_arMergeCells.size(); i++)
{
sheet->m_arMergeCells[i]->serialize(CP_XML_STREAM());
}
}
}
}
for (int i = 0 ; i < sheet->m_arHLINK.size(); i++)
for (size_t i = 0 ; i < sheet->m_arHLINK.size(); i++)
{
convert((XLS::HLINK*)sheet->m_arHLINK[i].get());
}
@ -438,7 +438,7 @@ void XlsConverter::convert(XLS::WorksheetSubstream* sheet)
if (!sheet->m_arNote.empty() && xls_global_info->Version < 0x0600)
{
xlsx_context->get_drawing_context().start_drawing(0);
for (int i = 0 ; i < sheet->m_arNote.size(); i++)
for (size_t i = 0 ; i < sheet->m_arNote.size(); i++)
{
xlsx_context->get_drawing_context().start_drawing(0x0019);
convert(dynamic_cast<XLS::Note*>(sheet->m_arNote[i].get()));
@ -452,7 +452,7 @@ void XlsConverter::convert(XLS::WorksheetSubstream* sheet)
sheet->m_PAGESETUP->serialize(xlsx_context->current_sheet().pageProperties());
}
for (int i = 0 ; i < sheet->m_arHFPictureDrawing.size(); i++)
for (size_t i = 0 ; i < sheet->m_arHFPictureDrawing.size(); i++)
{
//convert(dynamic_cast<XLS::Note*>(sheet->sheet->m_arHFPictureDrawing[i].get(),
}
@ -463,7 +463,7 @@ void XlsConverter::convert(XLS::WorksheetSubstream* sheet)
{
CP_XML_NODE(L"customSheetViews")
{
for (int i = 0 ; i < sheet->m_arCUSTOMVIEW.size(); i++)
for (size_t i = 0 ; i < sheet->m_arCUSTOMVIEW.size(); i++)
{
sheet->m_arCUSTOMVIEW[i]->serialize(CP_XML_STREAM());
}
@ -476,7 +476,7 @@ void XlsConverter::convert(XLS::WorksheetSubstream* sheet)
convert(dynamic_cast<XLS::BACKGROUND*>(sheet->m_BACKGROUND.get()));
}
for (int i = 0 ; i < sheet->m_arHFPictureDrawing.size(); i++)
for (size_t i = 0 ; i < sheet->m_arHFPictureDrawing.size(); i++)
{
convert((ODRAW::OfficeArtDgContainer*)sheet->m_arHFPictureDrawing[i].get());
}
@ -492,26 +492,26 @@ void XlsConverter::convert(XLS::GlobalsSubstream* global)
convert((XLS::SHAREDSTRINGS*)global->m_SHAREDSTRINGS.get());
for (int i = 0 ; i < global->m_arLBL.size(); i++)
for (size_t i = 0 ; i < global->m_arLBL.size(); i++)
{
convert((XLS::LBL*)global->m_arLBL[i].get());
}
for (int i = 0 ; i < global->m_arMSODRAWINGGROUP.size(); i++)
for (size_t i = 0 ; i < global->m_arMSODRAWINGGROUP.size(); i++)
{
convert((XLS::MSODRAWINGGROUP*)global->m_arMSODRAWINGGROUP[i].get());
}
for (int i = 0 ; i < global->m_arHFPictureDrawing.size(); i++)
for (size_t i = 0 ; i < global->m_arHFPictureDrawing.size(); i++)
{
convert((ODRAW::OfficeArtDgContainer*)global->m_arHFPictureDrawing[i].get());
}
for (int i = 0 ; i < global->m_arWindow1.size(); i++)
for (size_t i = 0 ; i < global->m_arWindow1.size(); i++)
{
global->m_arWindow1[i]->serialize(xlsx_context->workbook_views());
}
for (int i = 0 ; i < global->m_arUserBView.size(); i++)
for (size_t i = 0 ; i < global->m_arUserBView.size(); i++)
{
global->m_arUserBView[i]->serialize(xlsx_context->custom_views());
}
@ -544,7 +544,7 @@ void XlsConverter::convert(XLS::FORMATTING* formating)
}
CP_XML_ATTR(L"count", fills_out.size());
for (int i = 0 ;i < fills_out.size(); i++)
for (size_t i = 0 ;i < fills_out.size(); i++)
{
fills_out[i].serialize(CP_XML_STREAM());
}
@ -560,7 +560,7 @@ void XlsConverter::convert(XLS::FORMATTING* formating)
}
CP_XML_ATTR(L"count", borders_out.size());
for (int i = 0 ;i < borders_out.size(); i++)
for (size_t i = 0 ;i < borders_out.size(); i++)
{
borders_out[i].serialize(CP_XML_STREAM());
}
@ -740,7 +740,7 @@ void XlsConverter::convert(ODRAW::OfficeArtBStoreContainer* art_bstore, int star
if (art_bstore == NULL) return;
if (art_bstore->rgfb.size() < 1) return;
for (int i = 0 ; i < art_bstore->rgfb.size(); i++)
for (size_t i = 0 ; i < art_bstore->rgfb.size(); i++)
{
int bin_id = i + start_id + 1;
@ -896,7 +896,7 @@ void XlsConverter::convert_old(XLS::OBJECTS* objects, XLS::WorksheetSubstream *
xlsx_context->get_drawing_context().set_line_old_version(obj->old_version.line);
xlsx_context->get_drawing_context().set_flag_old_version(obj->old_version.flag, obj->old_version.flag2);
for (int i = 0 ; i < obj->old_version.additional.size(); i++)
for (size_t i = 0 ; i < obj->old_version.additional.size(); i++)
{
convert(obj->old_version.additional[i].get());
}
@ -1020,7 +1020,7 @@ void XlsConverter::convert(XLS::OBJECTS* objects, XLS::WorksheetSubstream * shee
{
text_obj->preserve_enabled = true;
for (int i = 0 ; i < sheet->m_arNote.size(); i++)
for (size_t i = 0 ; i < sheet->m_arNote.size(); i++)
{
XLS::Note* note = dynamic_cast<XLS::Note*>(sheet->m_arNote[i].get());
if ((note) && (note->note_sh.idObj == obj->cmo.id))
@ -1055,7 +1055,7 @@ void XlsConverter::convert(ODRAW::OfficeArtSpgrContainer * spgr)
if (spgr == NULL) return;
if (spgr->anchor_type_ != ODRAW::OfficeArtRecord::CA_HF) return; //todooo проверить что тока для header/footer это нужно
for (int i = 0; i < spgr->child_records.size(); i++)
for (size_t i = 0; i < spgr->child_records.size(); i++)
{
int type_object = 2;//rect
@ -1076,7 +1076,7 @@ void XlsConverter::convert(ODRAW::OfficeArtSpContainer *sp, bool anchor_only)
{
convert(sp->m_OfficeArtFSP.get());
for (int i = 0; i < sp->child_records.size(); i++)
for (size_t i = 0; i < sp->child_records.size(); i++)
{
convert(sp->child_records[i].get());
}
@ -1140,12 +1140,12 @@ void XlsConverter::convert(ODRAW::OfficeArtRecord * art)
{
ODRAW::OfficeArtDgContainer * dg = dynamic_cast<ODRAW::OfficeArtDgContainer *>(art);
for (int i = 0 ; i < dg->child_records.size(); i++) //a-la msodrawing for headers/footers
for (size_t i = 0 ; i < dg->child_records.size(); i++) //a-la msodrawing for headers/footers
{
convert(dg->child_records[i].get());
}
for (int i = 0; i < dg->m_OfficeArtSpContainer.size(); i++)
for (size_t i = 0; i < dg->m_OfficeArtSpContainer.size(); i++)
{
convert(dg->m_OfficeArtSpContainer[i].get());
}
@ -1167,7 +1167,7 @@ void XlsConverter::convert(ODRAW::OfficeArtFSP * fsp)
}
void XlsConverter::convert_fill_style(std::vector<ODRAW::OfficeArtFOPTEPtr> & props)
{
for (int i = 0 ; i < props.size() ; i++)
for (size_t i = 0 ; i < props.size() ; i++)
{
switch(props[i]->opid)
{
@ -1286,7 +1286,7 @@ void XlsConverter::convert_fill_style(std::vector<ODRAW::OfficeArtFOPTEPtr> & pr
{
ODRAW::fillShadeColors *shadeColors = (ODRAW::fillShadeColors *)(props[i].get());
for (int i = 0 ; (shadeColors) && (i < shadeColors->fillShadeColors_complex.data.size()); i++)
for (size_t i = 0 ; (shadeColors) && (i < shadeColors->fillShadeColors_complex.data.size()); i++)
{
ODRAW::OfficeArtCOLORREF & color = shadeColors->fillShadeColors_complex.data[i].color;
@ -1325,7 +1325,7 @@ void XlsConverter::convert_line_style(std::vector<ODRAW::OfficeArtFOPTEPtr> & pr
{
if (props.size() < 1) return;
for (int i = 0 ; i < props.size() ; i++)
for (size_t i = 0 ; i < props.size() ; i++)
{
switch(props[i]->opid)
{
@ -1403,6 +1403,18 @@ void XlsConverter::convert_line_style(std::vector<ODRAW::OfficeArtFOPTEPtr> & pr
}
}
}break;
case NSOfficeDrawing::lineMiterLimit:
{
xlsx_context->get_drawing_context().set_line_miter(props[i]->op);
}break;
case NSOfficeDrawing::lineJoinStyle:
{
xlsx_context->get_drawing_context().set_line_join(props[i]->op);
}break;
case NSOfficeDrawing::lineEndCapStyle:
{
xlsx_context->get_drawing_context().set_line_endcap(props[i]->op);
}break;
}
}
}
@ -1410,7 +1422,7 @@ void XlsConverter::convert_blip(std::vector<ODRAW::OfficeArtFOPTEPtr> & props)
{
if (props.size() < 1) return;
for (int i = 0 ; i < props.size() ; i++)
for (size_t i = 0 ; i < props.size() ; i++)
{
ODRAW::FixedPoint * fixed_point = static_cast<ODRAW::FixedPoint *>(props[i].get());
switch(props[i]->opid)
@ -1457,7 +1469,7 @@ void XlsConverter::convert_geometry(std::vector<ODRAW::OfficeArtFOPTEPtr> & prop
oox::_rect rect;
std::vector<_CP_OPT(int)> adjustValues(8);
for (int i = 0 ; i < props.size() ; i++)
for (size_t i = 0 ; i < props.size() ; i++)
{
switch(props[i]->opid)
{
@ -1489,6 +1501,24 @@ void XlsConverter::convert_geometry(std::vector<ODRAW::OfficeArtFOPTEPtr> & prop
adjustValues[props[i]->opid - 0x0147] = props[i]->op ;
}break;
case 0x0151:
{
ODRAW::pConnectionSites * a = (ODRAW::pConnectionSites *)(props[i].get());
xlsx_context->get_drawing_context().set_custom_connection(a->complex.data);
}break;
case 0x0152:
{
ODRAW::pConnectionSitesDir * a = (ODRAW::pConnectionSitesDir *)(props[i].get());
xlsx_context->get_drawing_context().set_custom_connectionDir(a->complex.data);
}break;
case 0x0153:
{
xlsx_context->get_drawing_context().set_custom_x_limo(props[i]->op);
}break;
case 0x0154:
{
xlsx_context->get_drawing_context().set_custom_y_limo(props[i]->op);
}break;
case 0x0155:
{
ODRAW::pAdjustHandles * a = (ODRAW::pAdjustHandles *)(props[i].get());
xlsx_context->get_drawing_context().set_custom_adjustHandles(a->complex.data);
@ -1498,6 +1528,16 @@ void XlsConverter::convert_geometry(std::vector<ODRAW::OfficeArtFOPTEPtr> & prop
ODRAW::pGuides* s = (ODRAW::pGuides *)(props[i].get());
xlsx_context->get_drawing_context().set_custom_guides(s->complex.data);
}break;
case 0x0157:
{
ODRAW::pInscribe * a = (ODRAW::pInscribe *)(props[i].get());
xlsx_context->get_drawing_context().set_custom_inscribe(a->complex.data);
}break;
//case 0x0158:
// {
// ODRAW::cxk * a = (ODRAW::cxk *)(props[i].get());
// xlsx_context->get_drawing_context().set_custom_cxk(a->complex.data);
// }break;
}
}
rect.cy -= rect.y;
@ -1510,7 +1550,7 @@ void XlsConverter::convert_geometry_text(std::vector<ODRAW::OfficeArtFOPTEPtr> &
{
if (props.size() < 1) return;
for (int i = 0 ; i < props.size() ; i++)
for (size_t i = 0 ; i < props.size() ; i++)
{
switch(props[i]->opid)
{
@ -1571,7 +1611,7 @@ void XlsConverter::convert_text(std::vector<ODRAW::OfficeArtFOPTEPtr> & props)
if (props.size() < 1) return;
RECT text_margin = {0x00016530, 0x0000b298, 0x00016530, 0x0000b298};
for (int i = 0 ; i < props.size() ; i++)
for (size_t i = 0 ; i < props.size() ; i++)
{
switch(props[i]->opid)
{
@ -1647,20 +1687,20 @@ void XlsConverter::convert_text(std::vector<ODRAW::OfficeArtFOPTEPtr> & props)
}
void XlsConverter::convert_shadow(std::vector<ODRAW::OfficeArtFOPTEPtr> & props)
{
for (int i = 0 ; i < props.size() ; i++)
for (size_t i = 0 ; i < props.size() ; i++)
{
}
}
void XlsConverter::convert_shape(std::vector<ODRAW::OfficeArtFOPTEPtr> & props)
{
for (int i = 0 ; i < props.size() ; i++)
for (size_t i = 0 ; i < props.size() ; i++)
{
}
}
void XlsConverter::convert_group_shape(std::vector<ODRAW::OfficeArtFOPTEPtr> & props)
{
for (int i = 0 ; i < props.size() ; i++)
for (size_t i = 0 ; i < props.size() ; i++)
{
switch(props[i]->opid)
{
@ -1726,7 +1766,7 @@ void XlsConverter::convert(XLS::Note* note)
void XlsConverter::convert_transform(std::vector<ODRAW::OfficeArtFOPTEPtr> & props)
{
for (int i = 0 ; i < props.size() ; i++)
for (size_t i = 0 ; i < props.size() ; i++)
{
switch(props[i]->opid)
{
@ -1774,7 +1814,7 @@ void XlsConverter::convert(XLS::SHAREDSTRINGS* sharedstrings)
}
}
for (int i = 0 ; i < xls_global_info->arAddedSharedStrings.size(); i++)
for (size_t i = 0 ; i < xls_global_info->arAddedSharedStrings.size(); i++)
{
CP_XML_NODE(L"si")
{

View File

@ -622,7 +622,7 @@ void xlsx_drawing_context::serialize_group()
//serialize_line(CP_XML_STREAM(), drawing_state);
}
for (int i = 1; i < current_drawing_states->size(); i++)
for (size_t i = 1; i < current_drawing_states->size(); i++)
{
CP_XML_STREAM() << current_drawing_states->at(i)->shape;
//todooo current_drawing_states->at(i).shape.erase(); // память поэкономить
@ -1033,7 +1033,7 @@ std::wstring xlsx_drawing_context::convert_custom_shape(_drawing_state_ptr & dra
shape->m_oCustomVML.m_bIsVerticesPresent = drawing_state->custom_verticles.empty() ? false : true;
for (int i = 0 ; i < drawing_state->custom_verticles.size(); i++)
for (size_t i = 0 ; i < drawing_state->custom_verticles.size(); i++)
{
Aggplus::POINT p;
@ -1043,7 +1043,7 @@ std::wstring xlsx_drawing_context::convert_custom_shape(_drawing_state_ptr & dra
shape->m_oCustomVML.m_arVertices.push_back(p);
}
for (int i = 0 ; i < drawing_state->custom_guides.size(); i++)
for (size_t i = 0 ; i < drawing_state->custom_guides.size(); i++)
{//todooo объеденить/срастить !!
NSCustomShapesConvert::CGuide guid;
@ -1058,7 +1058,7 @@ std::wstring xlsx_drawing_context::convert_custom_shape(_drawing_state_ptr & dra
shape->m_oCustomVML.addGuide(guid);
}
for (int i = 0 ; i < drawing_state->custom_segments.size(); i++)
for (size_t i = 0 ; i < drawing_state->custom_segments.size(); i++)
{
if (0 == drawing_state->custom_segments[i].m_nCount)
{
@ -1076,7 +1076,7 @@ std::wstring xlsx_drawing_context::convert_custom_shape(_drawing_state_ptr & dra
//{//todooo - ранее этого не было ?????
// shape->m_oCustomVML.addHandle(i, *drawing_state->custom_adjustHandles[i]);
//}
for (int i = 0; i < drawing_state->custom_adjustValues.size(); i++)
for (size_t i = 0; i < drawing_state->custom_adjustValues.size(); i++)
{
if (drawing_state->custom_adjustValues[i])
{
@ -1301,7 +1301,7 @@ void xlsx_drawing_context::serialize_gradient_fill(std::wostream & stream, _draw
if ( !fill.colorsPosition.empty() )
{
for (int i = 0; i < fill.colorsPosition.size(); i++)
for (size_t i = 0; i < fill.colorsPosition.size(); i++)
{
CP_XML_NODE(L"a:gs")
{
@ -1600,6 +1600,13 @@ void xlsx_drawing_context::serialize_line(std::wostream & stream, _drawing_state
else
CP_XML_ATTR(L"w", 9525); //default
switch(line.endcap)
{
case 0: CP_XML_ATTR(L"cap", L"rnd"); break;
case 1: CP_XML_ATTR(L"cap", L"sq"); break;
case 2: CP_XML_ATTR(L"cap", L"flat"); break;
}
serialize_fill(CP_XML_STREAM(), line.fill);
CP_XML_NODE(L"a:prstDash")
@ -1613,6 +1620,18 @@ void xlsx_drawing_context::serialize_line(std::wostream & stream, _drawing_state
case lineDashDotDot:CP_XML_ATTR(L"val", L"lgDashDotDot"); break;
}
}
switch(line.join)
{
case 0: CP_XML_NODE(L"a:bevel"); break;
case 1:
CP_XML_NODE(L"a:miter")
{
if (line.miter > 0)
CP_XML_ATTR(L"lim", line.miter * 1000);
}break;
case 2: CP_XML_NODE(L"a:round"); break;
}
if (line.arrow.enabled)
{
serialize_arrow(CP_XML_STREAM(), L"a:headEnd", line.arrow.start, line.arrow.start_width, line.arrow.start_length);
@ -2019,7 +2038,27 @@ void xlsx_drawing_context::set_line_width (int val)
current_drawing_states->back()->line.width = val;
}
void xlsx_drawing_context::set_line_miter(int val)
{
if (current_drawing_states == NULL) return;
if (current_drawing_states->empty()) return;
current_drawing_states->back()->line.miter = val;
}
void xlsx_drawing_context::set_line_join(int val)
{
if (current_drawing_states == NULL) return;
if (current_drawing_states->empty()) return;
current_drawing_states->back()->line.join = val;
}
void xlsx_drawing_context::set_line_endcap(int val)
{
if (current_drawing_states == NULL) return;
if (current_drawing_states->empty()) return;
current_drawing_states->back()->line.endcap = val;
}
void xlsx_drawing_context::set_line_arrow(bool val)
{
if (current_drawing_states == NULL) return;
@ -2032,7 +2071,8 @@ void xlsx_drawing_context::set_arrow_start (int val)
if (current_drawing_states == NULL) return;
if (current_drawing_states->empty()) return;
current_drawing_states->back()->line.arrow.start = val;
current_drawing_states->back()->line.arrow.start = val;
current_drawing_states->back()->line.arrow.enabled = true;
}
void xlsx_drawing_context::set_arrow_end (int val)
{
@ -2040,6 +2080,7 @@ void xlsx_drawing_context::set_arrow_end (int val)
if (current_drawing_states->empty()) return;
current_drawing_states->back()->line.arrow.end = val;
current_drawing_states->back()->line.arrow.enabled = true;
}
void xlsx_drawing_context::set_arrow_start_width (int val)
{
@ -2375,6 +2416,41 @@ void xlsx_drawing_context::set_custom_path (int type_path)
current_drawing_states->back()->custom_path = type_path;
}
void xlsx_drawing_context::set_custom_connection(std::vector<ODRAW::MSOPOINT>& points)
{
if (current_drawing_states == NULL) return;
if (current_drawing_states->empty()) return;
current_drawing_states->back()->custom_connection = points;
}
void xlsx_drawing_context::set_custom_connectionDir(std::vector<ODRAW::FixedPoint>& points)
{
if (current_drawing_states == NULL) return;
if (current_drawing_states->empty()) return;
current_drawing_states->back()->custom_connectionDir = points;
}
void xlsx_drawing_context::set_custom_inscribe(std::vector<ODRAW::MSORECT>& rects)
{
if (current_drawing_states == NULL) return;
if (current_drawing_states->empty()) return;
current_drawing_states->back()->custom_inscribe = rects;
}
void xlsx_drawing_context::set_custom_x_limo(int val)
{
if (current_drawing_states == NULL) return;
if (current_drawing_states->empty()) return;
current_drawing_states->back()->custom_x_limo = val;
}
void xlsx_drawing_context::set_custom_y_limo(int val)
{
if (current_drawing_states == NULL) return;
if (current_drawing_states->empty()) return;
current_drawing_states->back()->custom_y_limo = val;
}
//----------------------------------------------------------------------------------------------------------
bool xlsx_drawing_context::get_mode_vmlwrite ()
{//comment, shapes in header/footer, ....
@ -2435,7 +2511,7 @@ void xlsx_drawing_context::serialize_vml_HF(std::wostream & strm)
CP_XML_ATTR(L"xmlns:o" , L"urn:schemas-microsoft-com:office:office");
CP_XML_ATTR(L"xmlns:x" , L"urn:schemas-microsoft-com:office:excel");
for (int i = 0 ; i < drawing_states_vml_HF.size(); i++)
for (size_t i = 0 ; i < drawing_states_vml_HF.size(); i++)
{
serialize_vml(CP_XML_STREAM(), drawing_states_vml_HF[i]);
}
@ -2471,7 +2547,7 @@ void xlsx_drawing_context::serialize_vml_comments(std::wostream & strm)
}
}
for (int i = 0 ; i < drawing_states_vml_comments.size(); i++)
for (size_t i = 0 ; i < drawing_states_vml_comments.size(); i++)
{
serialize_vml(CP_XML_STREAM(), drawing_states_vml_comments[i]);
}
@ -2490,7 +2566,7 @@ void xlsx_drawing_context::serialize(std::wostream & strm)
CP_XML_ATTR(L"xmlns:r" , L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"xmlns:mc" , L"http://schemas.openxmlformats.org/markup-compatibility/2006");
for (int i = 0 ; i < drawing_states.size(); i++)
for (size_t i = 0 ; i < drawing_states.size(); i++)
{
serialize(CP_XML_STREAM(), drawing_states[i]);
}

View File

@ -137,10 +137,12 @@ public:
type_anchor(0),
vmlwrite_mode_(false)
{
id = -1;
rotation = 0;
parent_drawing_states = NULL;
custom_path = -1;
id = -1;
rotation = 0;
parent_drawing_states = NULL;
custom_path = -1;
custom_x_limo = 0x80000000;
custom_y_limo = 0x80000000;
}
external_items::Type type;
@ -179,10 +181,15 @@ public:
std::vector<ODRAW::MSOSG> custom_guides;
std::vector<ODRAW::MSOPOINT> custom_verticles;
std::vector<ODRAW::ADJH> custom_adjustHandles;
std::vector<ODRAW::MSOPOINT> custom_connection;
std::vector<ODRAW::FixedPoint> custom_connectionDir;
std::vector<ODRAW::MSORECT> custom_inscribe;
_rect custom_rect;
std::vector<_CP_OPT(int)> custom_adjustValues;
int custom_path;
int custom_x_limo;
int custom_y_limo;
//-----------------------------------------------
std::wstring hyperlink;
struct _text
@ -265,12 +272,15 @@ public:
};
struct _line
{
_line() { fill.color.SetRGB(0, 0, 0); width = 0; }
_line() : join(-1), endcap(-1), miter(0), width(0) { fill.color.SetRGB(0, 0, 0); }
std::wstring style;
int width;
_line_typeDash typeDash;
_fill fill;
_arrow arrow;
int miter;
int join;
int endcap;
}line;
struct _object
{
@ -357,6 +367,9 @@ public:
void set_arrow_end_width (int val);
void set_arrow_start_length (int val);
void set_arrow_end_length (int val);
void set_line_miter (int val);
void set_line_join (int val);
void set_line_endcap (int val);
void set_fill_old_version (_UINT32 val);
void set_line_old_version (_UINT32 val);
@ -399,6 +412,11 @@ public:
void set_custom_adjustHandles(std::vector<ODRAW::ADJH> & handles);
void set_custom_adjustValues(std::vector<_CP_OPT(int)> & values);
void set_custom_path (int type_path);
void set_custom_connection (std::vector<ODRAW::MSOPOINT> & points);
void set_custom_connectionDir(std::vector<ODRAW::FixedPoint>& points);
void set_custom_inscribe (std::vector<ODRAW::MSORECT> & rects);
void set_custom_x_limo (int val);
void set_custom_y_limo (int val);
//------------------------------------------------------------------------------
void serialize_group ();
void serialize_shape (_drawing_state_ptr & drawing_state);

View File

@ -369,6 +369,71 @@ namespace XmlUtils
return buffer;
}
AVSINLINE static std::wstring EncodeXmlStringExtend(const std::wstring& data, bool bDeleteNoUnicode = false)
{
std::wstring buffer;
buffer.reserve(data.size());
if(bDeleteNoUnicode)
{
for(size_t pos = 0; pos < data.size(); ++pos)
{
switch(data[pos])
{
case '&': buffer.append(L"&amp;"); break;
case '\"': buffer.append(L"&quot;"); break;
case '\'': buffer.append(L"&apos;"); break;
case '<': buffer.append(L"&lt;"); break;
case '>': buffer.append(L"&gt;"); break;
case '\n': buffer.append(L"&#xA;"); break;
case '\r': buffer.append(L"&#xD;"); break;
case '\t': buffer.append(L"&#x9;"); break;
case 160: buffer.append(L"&#160;"); break;
default:
{
if ( false == IsUnicodeSymbol( data[pos] ) )
{
wchar_t symbol1 = data[pos];
if(0xD800 <= symbol1 && symbol1 <= 0xDFFF && pos + 1 < data.size())
{
pos++;
wchar_t symbol2 = data[pos];
if (symbol1 < 0xDC00 && symbol2 >= 0xDC00 && symbol2 <= 0xDFFF)
{
buffer.append(&data[pos-1], 2);
}
}
}
else
buffer.append(&data[pos], 1);
}break;
}
}
}
else
{
for(size_t pos = 0; pos < data.size(); ++pos)
{
switch(data[pos])
{
case '&': buffer.append(L"&amp;"); break;
case '\"': buffer.append(L"&quot;"); break;
case '\'': buffer.append(L"&apos;"); break;
case '<': buffer.append(L"&lt;"); break;
case '>': buffer.append(L"&gt;"); break;
case '\n': buffer.append(L"&#xA;"); break;
case '\r': buffer.append(L"&#xD;"); break;
case '\t': buffer.append(L"&#x9;"); break;
case 160: buffer.append(L"&#160;"); break;
case '\0':
return buffer;
default: buffer.append(&data[pos], 1); break;
}
}
}
return buffer;
}
//#ifndef _USE_LIBXML2_READER_
class CStringWriter
{

View File

@ -7,7 +7,7 @@
QT -= core
QT -= gui
VERSION = 2.4.462.0
VERSION = 2.4.463.0
DEFINES += INTVER=$$VERSION
TARGET = x2t

View File

@ -544,7 +544,7 @@ namespace NExtractTools
}
sRes = L"<xmlOptions><fileOptions fileType='" + std::to_wstring(nFileType);
sRes += L"' codePage='" + std::to_wstring(nCsvEncoding);
sRes += L"' delimiter='" + XmlUtils::EncodeXmlString(cDelimiter) + L"' " + sSaveType;
sRes += L"' delimiter='" + XmlUtils::EncodeXmlStringExtend(cDelimiter) + L"' " + sSaveType;
sRes += L"/><TXTOptions><Encoding>" + std::to_wstring(nCsvEncoding) + L"</Encoding></TXTOptions></xmlOptions>";
return sRes;